Any interesting waveforms besides the sine and square?
Hey there,
Been doing a cheap DDS solution for a little music box, but the sine and square wave seems to sound dull or boring after a few plays.
When I'm searching for more ideas of how to spice up the sound in a microcontroller, I found this in youtube: http://www.youtube.com/watch?v=qetnEUlbY-c&feature=related
Yeah - it isn't a microcontroller, but a generic wall-clock with some pretty good melodies. Plus, it's nice, it would be a great addition to some microcontroller projects!
I wonder what kind of waveform, or what kind of technique they used on these. I'm thinking of using Inverse FFT for all that, but would like to hear your opinions first.
Been doing a cheap DDS solution for a little music box, but the sine and square wave seems to sound dull or boring after a few plays.
When I'm searching for more ideas of how to spice up the sound in a microcontroller, I found this in youtube: http://www.youtube.com/watch?v=qetnEUlbY-c&feature=related
Yeah - it isn't a microcontroller, but a generic wall-clock with some pretty good melodies. Plus, it's nice, it would be a great addition to some microcontroller projects!
I wonder what kind of waveform, or what kind of technique they used on these. I'm thinking of using Inverse FFT for all that, but would like to hear your opinions first.

Comments
Single-note plinking is what's "dull or boring."
You have to do chords.
By the way, my DDS unit has two simultaneous tones for now, which is polyphonic.
Tried chords, but chords of square waves and sine waves didn't really worked that well. Sounds a bit awful. I don't know whether it's some sampling issues or other things.
Musical instruments tend to have even as well as odd harmonics. This is emulated in synthesizers by adding up sine waves of the appropriate fundamental and harmonic frequencies at properly falling-off amplitude to create a composite waveform.
Musical instruments also have a characteristic pattern by which the total sound level intensifies and falls off, called ADSR for Attack (quickly building to a high amplitude), Decay (quickly falling to an intermediate amplitude), Sustain, and Release (time to fall from sustain level back to zero). Applying ADSR to a sine wave will get you a pretty decent imitation of a flute.
Thanks, I'll try to put the ADSR inside, to simulate a music-box chime effect. It's not easy, but my dsPIC could handle all that okay.
Also, will be trying the triangle wave. Need to write up a look-up wavetable on the triangle too.
I'm still wondering whether IFFT and some filtering will actually make them sound better or not. However, I haven't tried a convolution/filtering algorithm inside before on a microcontroller. Maybe I will test it in Matlab first.
In addition, by setting the amplitude of one sine wave higher than the other and separating their frequencies more widely, you can get a vibrato effect.
Also, take a look at the [url=http://forums.parallax.com/showthread.php?131306[/url]Karplus-Strong thread[/url], which shows how to get a guitar strumming effect.
-Phil
Clever idea here. Will try that as well. Would that work on square waves too?
edit : Phil - yeah, saw your latest edited post. I'm also looking on that too.
-Phil
http://www.youtube.com/watch?v=EJcbxrdErkY
There's a thread about the project somewhere on the old forum. I'm not sure if search will find it or not, but google does.
-Phil
- 3 Independent audio channels
- 4 selectable waveforms on each channel (Triangle, Saw, Noise, Square)
- Variable pulse width
- Each channel has got an ADSR envelope
- Ring modulation
- Oscillator synchronisation
- An "analog" 12db multi-mode filter (any combination of lp, bp, hp)
- Selectable resonance amount
- Selectable cutoff frequency
(Did I say it uses only one cog for everything?!)
The propeller is fast and has got little memory so doing waveforms on the fly is the way to go.
Using samples for "easy to do waveforms" is unnecessary, eats memory and produces audiable aliasing.
/Ahle2
The nearest thing on the propeller is the phase modulation synthesis object made by Ariba.
I think a "chime like" sound should be possible to generate with that object.
/Ahle2
Thanks. I did guessed that too previously, but my ears aren't sharp enough, so I may need others to hear it for me.
I'll try to write it in dsPIC later. Right now been flooded with research work in office, so may be writing routines when I'm free.
Then, from reconstruction, by adding all the major frequencies present in the data, and also discarding the rest of it, I got the sound reaching close to 70% of the original chime, but it sounds mellow instead of the sharp one.
I will post details of the each frequencies and the power inside for that specific chime later.