Skip to content

Commit

Permalink
Merge pull request naudio#884 from wwwMADwww/squaregenfix
Browse files Browse the repository at this point in the history
Fixed wrong duty cycle in generated square wave
  • Loading branch information
markheath authored Apr 23, 2022
2 parents 7b29cbb + 597d702 commit 0203800
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion NAudio.Core/Wave/SampleProviders/SignalGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public int Read(float[] buffer, int offset, int count)

multiple = 2*Frequency/waveFormat.SampleRate;
sampleSaw = ((nSample*multiple)%2) - 1;
sampleValue = sampleSaw > 0 ? Gain : -Gain;
sampleValue = sampleSaw >= 0 ? Gain : -Gain;

nSample++;
break;
Expand Down

0 comments on commit 0203800

Please sign in to comment.