View previous topic :: View next topic |
Author |
Message |
jenn Guest
|
old music box sounds-for experts..(?) |
Posted: Fri Nov 06, 2009 5:26 am |
|
|
Hi
I need to produce a sounds like an old Hand Cranked music box.
I really want to get this sound into a little electric sound box.
I could produce a mono sounds with my pic but I want more.
Can I do this ? Or the only way is record it into a small memory ?
Does a micro.p has this ability anyway ?? Its a complex sound...
Thanx |
|
|
yerpa
Joined: 19 Feb 2004 Posts: 58 Location: Wisconsin
|
|
Posted: Fri Nov 06, 2009 12:32 pm |
|
|
I would suggest trying the Karplus-Strong plucked string algorithm. It generates realistic plucked string sounds by simple computations. Do a YouTube search for yerpa58 and you will find a demo called frak effects that uses a PIC 18F4520 to generate some tones. The source code is free, but you can expect to spend some effort in programming to get exactly what you want.
I have also had good luck using PWM output yo play back wav files directly from PIC 18F series flash memory using chips like the 18F2625 which have more memory. You could probably digitize each note separately and play them back in the order required. I used 8-bit samples at 11 KHz sample rate. Definitely not hi-fi!
Good luck! |
|
|
jenn Guest
|
Karplus-Strong plucked string algorithm |
Posted: Fri Nov 06, 2009 4:24 pm |
|
|
I read about this Karplus-Strong plucked string algorithm, but couldn't understand how to do this in real...(the delay and z transform)'
I can do this in programing or need extra hardware ?
Where is the source code you talked about ?
I have a square wave, now I need this Strong plucked sound.... how ??
Thanks a lot |
|
|
yerpa
Joined: 19 Feb 2004 Posts: 58 Location: Wisconsin
|
|
Posted: Mon Nov 09, 2009 1:30 pm |
|
|
You do not need any extra hardware. You can find source code here:
http://www.reprolabs.com/fs2.htm
Basically, you fill a RAM buffer (say 64 bytes) with noise (random numbers), then have two pointers into the buffer that increment for each sample. The two pointers are right next to each other, such as *array[0] and *array[1]. Read the values from each pointer, add them together, then shift right one bit (this is divide by two operation), and write the value into the trailing pointer location and output it to PWM output for audio out. Then increment each pointer and repeat. |
|
|
|