Creating sound effects with PIC microcontroller

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
I am developing a "smart" alarm clock. I need to determine how to I
will generate the alarm sounds. The main requirement is the ability to
generate loud sounds and to vary the sound volume. One option is to use
a PIC18Fxx processor (already part of the circuit) to generate the
alarm tones and then feed them through an audio amplifier IC and small
speaker. I could use a digital potentiometer to vary sound volume,
however if I could get the same effect by using the PIC's 10-bit PWM
peripherals it would be ideal.
Does anyone have code examples or strategies for creating such sound
effects using a PIC processor? Thanks


Re: Creating sound effects with PIC microcontroller
["Followup-To:" header set to sci.electronics.misc.]

Quoted text here. Click to load it

map out the wave form you want and send it to the PWM, connect the PWM to
the amplifier,  with a bit of work (and if the chip and PWM is fast enough)
you can even go polyphonic.

to reduce the volume either shift the values right before outputting them
or use a lower waveform map.

I have a code example, but it's for AVR 90S2313 (10MHz)

Bye.
   Jasen

Re: Creating sound effects with PIC microcontroller

Quoted text here. Click to load it

If the sound is just tones or assending/descending tones then I would be
tempted to use a pieze instead of a speaker. Nice and loud, only a
darlington driver required.
As far as varying the volume then this is easilly achievable using one of
the PWM modules on the 18F part. Connect the output of the PWM pin through a
charging resistor to a capacitor. Connect the capacitor to the power pin of
your darlington pair. This will give you control over the voltage presented
to the piezo. I have done this before and it works very well. If I remember
correctly using a 1K series resistor to 10uF capacitor is perfectly adequate
for volume control.

If you need PWM code then I should be able to dig some out on Monday. But
where would the fun be in that? :-)

Have fun
Jim
www.picmodules.com



Re: Creating sound effects with PIC microcontroller

Quoted text here. Click to load it

Google suggests  PICBASIC supports the BASIC SOUND command.



Re: Creating sound effects with PIC microcontroller

Quoted text here. Click to load it

Record and playback samples...
http://centauri.ezy.net.au/~fastvid/picsound.htm



Re: Creating sound effects with PIC microcontroller

Quoted text here. Click to load it

www.beyondlogic.org

http://www.beyondlogic.org/pic/ringtones.htm works with 16f87x
does it in software
good for awful sounding phone ring tones
works with Hitech compiler or demo version



Re: Creating sound effects with PIC microcontroller

Quoted text here. Click to load it

There was an article regarding RC-2 encoding an playback of sound in
"Circuit Cellar" a few months ago. Only 2 I/O pins, 2 Resitors and a
Capacitor is needed to generate sound. In the original article a 8051
was used, but I have implimented it on an AVR with very good results.
Using a PIC plus a reasonably large data flash should be fine. The
author of the Circuit Cellar Article, Mariano Barrón, wrote a PC app
which can be used to generate the RC-2 data from a 16-bit mono
wave file.

Regards
  Anton Erasmus

Site Timeline