The sine wave I was getting was good, but I wanted a raspier sound, so I added a second wave table (this one in RAM) and filled it with random values. My first attempt at mixing this with the sine wave failed. All I got was noise. I worked with the values some and got it working, but I think the next build will have a total volume level. The noise level is user variable, and the sine level is the master volume minus the noise level.
I used a LDR (light sensor) to set the noise level, but it was more fun to use it to alter the tempo. My desk gets a sliver of sunlight crossing it around 12:30 pm, so I set the Arduino on the desk. The music starts out slow, getting faster as the light moves over it, then slowing again as darkness returns. If a cloud passes in front of the sun that also slows the tempo.
This is more fun than you might expect already, but I have several ideas for continuing the project. I'm going to use one of my Arduino Pro boards to build this as a permanent fixture. I'll have to build an enclosure for it, with a built-in audio amplifier and speaker. I'll mount the LDR on top and a few variable resistors. I also want to try IR synchronization like the original ABG project. I'll probably add a breadboard section for experimenting with the generated audio.
On the software side I want to expand the melody section to three 'passages'. The default will be to cycle through each in turn, over and over again. A second mode will change just one or two notes in each passage. There will also be a way to replace all the notes in the melody at once. The goal here is to make a kind of musical game, with the Arduino playing the bassline and the human improvising over the top.
1 comment:
I have also used this code to make a synth oscillator. mine has 8 wavetables based on classic synth ones (saw, trinagle etc)
but i receive the note to play from MIDI, and can change the wavetable , attack, decay, and detune with a potentiometer.
I would like to know how you mixed 2 wavetables, that would help me nicely :) then i could pick first and second one, and use the potentiometer or MIDI velocity to mix between them.
best regards
DeFex
Post a Comment