Here's an obligatory photo of the breadboard.
Interesting huh? Anyway it worked - I had sound! A chunky sounding square wave and a surprisingly chunky ramp. However there was an oddity - the PWM control seem to only have a could of steps so it wasn't possible to get that classic PWM sweep I like. Taking a look at the output on my scope it soon became apparent why. Here's the ramp wave:
It's a ramp Jim, but not as we know it. If I'd stopped to think a bit about how the circuit works then it would have made more sense. The 4520 is a four-bit counter and essentially divides the input into four square waves that are added together to make this stepped ramp.
Reading the PicSynth site a bit more closely I realized that the author knew this of course and had an alternative. This circuit based on a 4046 and 4024 gives more conventional sounds and much better looking waveforms. There's also an excellent explanation on that page of how the ramp->square conversion works. This explains very well why the stepped ramp wave can't really be used for PWM. I won't repeat it now, go read it yourself.
Here's the circuit on the breadboard:
I haven't built the LFO yet but I've simply been using a pot as a voltage divider to control the pulse width. Here's the ramp and the square with the square wave near the minimum width:
You can see the ramp wave looks much better - more or less like the real thing. This is a 256 step conversion so it's pretty smooth. There's a bit of noise, but hey - it's on a breadboard!
Here's another image with the pulse width near maximum:
I don't have any proper input device yet but have simply been using a pot connected up to the analog input of the Arduino and using that to sweep across the notes.
Finally I used my guitar tuner, which has a chromatic mode, to verify the notes were as I expect them. Every single one was within about 5 cents and I confirmed a few with the frequency counting mode of my multimeter as well. So this is a promising start. The next thing I will try is hooking up some MIDI input so I have a more conventional way of setting the current note.
No comments:
Post a Comment