An interesting little Arduino Noise Maker with a good range of sound generation.
How it works:
In essence, the waveform is constructed continuously using both the data from the arrays as well as external electrical states (pots, signals etc).
Two arrays store the data for pitch (128 ints) and waveform (544 bytes). The pitch array has been generated from converting MIDI notes to frequency, then from frequency to period time. This value is then divided by 32 to provide 32 samples per cycle. The pitch byte is read from an analog potentiometer on a cycle by cycle basis.
The waveform array was calculated by taking a sinewave of length 32 samples and then squaring it out over the 16 repetitions over the 512 bytes left in the array. The data bytes in the array are 6 bits in length and then they have been shifted left by 2 bits, so that port d (pins 0 to 7) of the Arduino can be set quickly without any bit shifting.
Arduino pins 2 to 7 are used in a resistor network to create a 6 bit digital to analog converter. One of the binary counters (4040 IC) is connected directly into pins 8, 9 and 10 and are read into the Arduino to scale the waveform on a sample by sample basis, effectively creating the possibility of an envelope generator.
The other 4040 IC is used to create a 3 bit digital to analog converter that is scaled by a potentiometer and then fed into an Arduino analog input. This data adds a delay in microseconds to the waveform on a sample by sample basis, effectively creating a pitch shifter / vibrato etc. This value is read on a cycle by cycle basis.
Link to schematic & code:
http://little-scale.blogspot.com/2008/01/arduino-noise-maker-info.html
Leave a Reply