I'm working on an Arduino Due based synth based on this wonderful post: http://rcarduino.blogspot.jp/2012/12/arduino-due-dds-part-1-sinewaves-and.html
I'm attempting to implement a very simple volume control and running into some issues. My thought was to simply multiply the audio output by a fraction, which sort-of works. However, if I have a sawtooth wave (just for example), and I sweep through multiplying the output, I get these results:
Multiplying by 0 - .15: The output sometimes get distorted. I'm imagining that's because the bits get squished together and my perfectly nice sawtooth wave becomes a bit mutated.
Multiplying by .15 - .60: This seems to work fairly well. The volume changes, and the sound's character remains the same.
Multiplying by .60 - 1: Strangely, this seems to stop changing the sounds volume, and the sound's character starts changing again (and sometimes the volume actually sounds like it's decreasing!)
My code is quite simple:
// cv is my control voltage, which ranges from 0 to 255 // audio ranges from 0 to 4095 // my class returns a uint32_t
return((float)((float)cv/(float)255) * audio);
Thanks for any suggestions, - Bret