View previous topic :: View next topic |
Author |
Message |
globalsys
Joined: 17 Apr 2007 Posts: 22 Location: france
|
Generate audio signals with PIC and PWM |
Posted: Tue Dec 09, 2008 10:35 am |
|
|
Hello everyone!
I want to know if somebody has already tried to generate audio signals with a PIC using the PWM output?
Because I'm looking for an easy and small way to make a speech synthesizer, and why not using a PIC...
Thanks
Bruno |
|
|
yerpa
Joined: 19 Feb 2004 Posts: 58 Location: Wisconsin
|
|
|
globalsys
Joined: 17 Apr 2007 Posts: 22 Location: france
|
|
Posted: Wed Dec 10, 2008 3:19 am |
|
|
Thanks Yerpa for your link, but I'm trying to make a vocal synthesis, I would like to have an idea of vocal signals generate by a PIC.
I'm going to have a look to the code an try to integrate vocal signals.
Thanks
Bruno |
|
|
RLScott
Joined: 10 Jul 2007 Posts: 465
|
|
Posted: Wed Dec 10, 2008 11:26 am |
|
|
Look up ADPCM (Adaptive Differential Pulse Code Modulation). It is a very efficient means to encode voice with less memory than storing each sample value, and it is still easy enough to decode that it doesn't stress a PIC too much.
Beyond that, you have to pick a PWM frequency that is easy to filter from the audio. Let's say you want the equivalent of an 8-bit D/A. That requires a PWM period that is at least 256 Fosc periods. For a 4 MHz crystal, that means the PWM frequency must be less than 15,625 Hz. This is getting awfully close to the audio range, and might require exotic filtering to remove it. If you raised the clock rate to 8 MHz, then you could use a PWM frequency of about 30 kHz, which is easy to filter out. _________________ Robert Scott
Real-Time Specialties
Embedded Systems Consulting |
|
|
Guest
|
|
Posted: Fri Dec 12, 2008 6:45 am |
|
|
Thanks for your inputs, my audio can be limited from 300hz to 3kHz, my audio interface is not for HiFi.
I'm going to try the ADPCM with a DSPic. The results showed on the microship website looks good |
|
|
Ttelmah Guest
|
|
Posted: Fri Dec 12, 2008 10:10 am |
|
|
The key though is that you do need very good filtering.
Remember that a single stage filter, only 'rolls off' at 6dB/octave. You do need to get good attenuation at your sampling frequency.
I have used CVDSM, in the past to do this type of work, and to get really acceptable audio, was using 5pole active filtration...
Best Wishes |
|
|
globalsys
Joined: 17 Apr 2007 Posts: 22 Location: france
|
|
Posted: Wed Dec 17, 2008 3:52 am |
|
|
Hi Ttelmah, i don't know CVDSM, on my project i'm using an active filter ( already used to another audio signals).
I found this website : http://www.romanblack.com/picsound.htm
On this web site there is a software able to convert wav files to bit stream.
But i don't know how integrate the file generated on my PIC software.
The software generate ASM, MikroC, and bin files, but i don't know how to turn this BIN file on a const on my software... |
|
|
globalsys
Joined: 17 Apr 2007 Posts: 22 Location: france
|
|
Posted: Wed Dec 17, 2008 11:17 am |
|
|
Hello,
This afternoon I insert the data generated by the "Romanblack" software on my the ROM memory of my PIC18F4520 but the result is very bad
I was expecting something more understandable.
On this forum there is few users who try to do the same as me but nobody says if the result is good.
Thanks |
|
|
|