Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LFPulse UGen gives asymmetrical waveform when duty (width) is 0.5 #1501

Closed
totalgee opened this issue May 27, 2015 · 1 comment
Closed

LFPulse UGen gives asymmetrical waveform when duty (width) is 0.5 #1501

totalgee opened this issue May 27, 2015 · 1 comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs.
Milestone

Comments

@totalgee
Copy link
Contributor

If you set the width (duty cycle) argument to exactly 0.5, you don’t get a symmetric waveform (equal number of ups and downs). To test this, it's most obvious when you set a high frequency (use an even multiple of the sample rate, so you should expect equal number of ups and downs). If you change the width to slightly over 0.5, it works as expected.

Compare:

var freq = s.sampleRate/4; {[LFPulse.ar(freq, 0, 0.5), LFPulse.ar(freq, 0, 0.500001)]}.plot(freq.reciprocal * 5);
// First one is [H, L, L, L, H, L, L, L, ...]
// Second one (correct) is [H, H, L, L, H, H, L, L, ...]

I tested this in v3.6.5 on OS X, but the code (in LFPulse_next_a() doesn't seem to have changed in current). Fixing this might change the sound of existing synths (at high frequencies). On the other hand, it definitely seems wrong; you'd expect a duty of 0.5 to produce equal numbers of highs and lows over time!

totalgee added a commit to totalgee/supercollider that referenced this issue May 27, 2015
- fixes issue supercollider#1501 (of interest: the default case when duty is 0.5)
@scztt scztt added this to the 3.7 milestone May 27, 2015
@scztt scztt added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. and removed needs unit test labels May 27, 2015
@totalgee
Copy link
Contributor Author

Fixed and merged with PR #1503.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs.
Projects
None yet
Development

No branches or pull requests

2 participants