|
|
|
|
|
by meindnoch
443 days ago
|
|
As others noted, merely switching back and forth between -1 and 1 will result in heavy aliasing. Also, since you can only switch from -1 to 1 at integer sample points, you won't be able to accurately generate frequencies that don't divide the sample rate evenly. E.g. if your sample rate is 48 kHz, you won't be able to generate a 50% duty cycle 11 kHz square wave. Either the duty cycle, or the frequency will be different. Like, audibly different. The proper way is either via the Fourier series; or look into BLIT [1] synthesis. [1] https://ccrma.stanford.edu/~stilti/papers/blit.pdf |
|