CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

old music box sounds-for experts..(?)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jenn
Guest







old music box sounds-for experts..(?)
PostPosted: Fri Nov 06, 2009 5:26 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Fri Nov 06, 2009 12:32 pm     Reply with quote

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
PostPosted: Fri Nov 06, 2009 4:24 pm     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Mon Nov 09, 2009 1:30 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group