Go Down

Topic: SciFi sounds for Piezo Buzzer (Read 7863 times) previous topic - next topic

I've got the Melody function working with a piezo buzzer, but I'm actually trying to generate creepy sci-fi type sounds like a sonic screwdriver or a ray gun or that theremin sound from twilight zone and such. I don't want to use a speaker, just a buzzer. It shouldn't really be that difficult, I just have a terrible ear and couldn't deconstruct a sound if my life depended on it.

Here's what a sonic screwdriver sounds like, for reference: http://soundfxnow.com/sound-fx/doctor-who-sonic-screwdriver/

Here's the sorta-kinda-wibbly-wobbly code I've got running the buzzer right now.
It's close, but it's pretty irritating and I'd like to smooth it out and get it doing that nice oscillating thing. (I don't want to build an oscillator either.  I'm mostly a software person, so I prefer to do it with code rather than more components)

Anyway, here it is.  It probably just needs small adjustments from someone with a more trained ear:

Code: [Select]
tone(buzzerPin,2200); // then buzz by going high
    tone(buzzerPin,1000);
    tone(buzzerPin,500);
    tone(buzzerPin,200);
    tone(buzzerPin,500);
    delayMicroseconds(10000);    // waiting
    noTone(buzzerPin);  // going low
    delayMicroseconds(10000);    // and waiting more
    tone(buzzerPin,2200);
    tone(buzzerPin,1000);
    delayMicroseconds(10000);    // waiting
    noTone(buzzerPin);  // going low
    delayMicroseconds(10000);    // and waiting more
    tone(buzzerPin,100);
    delayMicroseconds(10000);    // waiting
    noTone(buzzerPin);  // going low
    delayMicroseconds(10000);    // and waiting more
    tone(buzzerPin,100);
    delayMicroseconds(10000);    // waiting
    noTone(buzzerPin);  // going low
    delayMicroseconds(10000);    // and waiting more

DuaneB

Not sure if this helps, but here is a short clip or my Arduino playing the type of thing you may be looking for -

http://www.youtube.com/watch?v=BGkMBjvw1a8

Its a very simple circuit, just five potentiometers, I guess you could figure out what settings produce the sounds you are looking for and go from there.

The Auduino source code is here - http://code.google.com/p/tinkerit/wiki/Auduino

You should consider a small speaker and amp, here is a short post with a simple amp, really easy to build and great sound -

http://rcarduino.blogspot.com/2012/08/adding-audio-to-arduino-projects.html

Duane B

rcarduino.blogspot.com
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Ahhhhhh! Why did my subscription to this thread not notify me that a cool person had replied to it!?!?!

That looks like a really fun music toy to play with, but I'm running a tiny piezo buzzer in a tiny space, and I just need to hit a switch and have it play a little sound effect.  So no nifty pots in combination for me! 

basically I just want to take some sci-fi sound effects and convert them to hertz so I can use them with; tone(frequency,duration).

I've downloaded a program that will convert any audio file to hertz values, but even with the shortest sound effects I always end up with a page or two full of numbers, which is too many.  I want, max, like a series of 20 tones I can loop that make a nifty sci-fi sound. I made some good progress on the concept today, but everything sounded like 8bit video game music, which isn't really the effect I'm going for.  I mean, if I wanted to play mary had a little lamb on my buzzer, I could just look up the hertz values for the notes (which are in the melody library already) and plug them in.  But nobody write sheet music for sound effects, you know what I mean?  If I could just get something like "oh yeah, the sonic screwdriver sound is BBBGAADEEFFGAGAGAAABBE" I would be golden. 

DuaneB

Hi,

Its certainly possible to do what you want, but I doubt that you will find an off the shelf option.

I would build and Auduino as linked in on of my earlier responses - yes it does need five potentiometers, but if you use these to experiment and then note the values that sound closest to what you want you stand a really good chance of acheiving what your looking for.

You might also find something interesting here - most of it sounds like 8-bit video games but there are one or two that have an industrial or sci fi sound and as it takes about four minutes to build, whats to lose ?

http://rcarduino.blogspot.com/2012/09/algorithmic-music-on-arduino.html

The Auduino post can be found here,it also takes minutes to build and is probably closer to what your looking for, its the basic technique for complex sound generation -

http://rcarduino.blogspot.com/2012/08/adding-audio-to-arduino-projects.html

I also have another project uses similar techniques to generate a more techno/industrial range of sounds, I will probably publish it later this week

Duane B

rcarduino.blogspot.com
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Far-seeker


I would build and Auduino as linked in on of my earlier responses - yes it does need five potentiometers, but if you use these to experiment and then note the values that sound closest to what you want you stand a really good chance of acheiving what your looking for.


Also there is such a thing as a digital potentiometer.  So it could be possible to replace the normal potentiometers and have a sketch with multiple or variable resistance values.  Though the final signal might need additional amplification due to digipots only being able to handle relatively low currents.

DuaneB

Its much simpler than that, the pots are only there to provide analog inputs, lots of people use light sensors instead or as I was originally suggesting just use the pots to find the sounds you like, then hard code the values and remove the pots.

Duane B
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Lakes



I've downloaded a program that will convert any audio file to hertz values, but even with the shortest sound effects I always end up with a page or two full of numbers, which is too many. 
Do you have the name of the program you used?

Is there a library of arduino "tone" tunes anywhere?

Thanks.

ssshake


I've downloaded a program that will convert any audio file to hertz values,


Can you tell me what program you used for this please.

Go Up