LockeddsPic audio player ?

Page: 12345.. > >> Showing page 1 of 6
Author
Guest
Super Member
  • Total Posts : 81021
  • Reward points : 0
  • Joined: 2003/01/01 00:00:00
  • Location: 0
  • Status: online
2006/05/28 01:33:52 (permalink)
0

dsPic audio player ?

Hi group,
 
I have about a 2-3 min audio recording in wav or mp3 format that I would like to play, any chance that this is doable with a dsPIC ? what peripheral components, if any, are needed ?
 
thanks,
 
etla
#1

105 Replies Related Threads

    leon_heller
    Super Member
    • Total Posts : 6401
    • Reward points : 0
    • Joined: 2004/08/17 13:19:45
    • Location: St. Leonards-on-Sea, E. Sussex, UK.
    • Status: offline
    RE: dsPic audio player ? 2006/05/28 02:16:21 (permalink)
    0
    Wav files would be quite easy, you could use PWM for output. Or, attach a suitable codec; the Si3000 is easy to use and the quality will be better. MP3 is difficult.
     
    Leon

    Leon Heller
    G1HSM
    #2
    Brick
    Super Member
    • Total Posts : 1692
    • Reward points : 0
    • Joined: 2006/05/25 09:10:40
    • Status: offline
    RE: dsPic audio player ? 2006/05/28 03:09:47 (permalink)
    0
    Microchip have recently released alot of libaries with the new C30 complier which I seen be used to play pack several minutes of speech with a small serial EEPROM and a dsPIC33F. I would recommend to look into the new C complier and its libaries, as this minght be usefull to you...
    #3
    Oznog
    Super Member
    • Total Posts : 1011
    • Reward points : 0
    • Joined: 2004/10/14 21:54:10
    • Status: offline
    RE: dsPic audio player ? 2006/05/28 11:59:55 (permalink)
    0
    Microchip has a sound recording/playback lib for the dsPIC.
    I believe it is designed for voice only.  It uses a type of compression that can be done on the fly by the controller, however, it still takes I think something like 1 k/sec.  So you would need an external chip to store audio of the length you want (not a really big problem).
    #4
    davidcary
    Starting Member
    • Total Posts : 36
    • Reward points : 0
    • Joined: 2005/09/12 09:21:35
    • Status: offline
    RE: dsPic audio player ? 2006/05/31 12:54:46 (permalink)
    0
    about a 2-3 min audio recording in wav or mp3 format that I would like to play


    You'll need:
    * some kind of external data storage chip
    * a DAC. (Some people enjoy the challenge of building a DAC out of resistors, perhaps using PWM and "1 bit DAC" techniques. Others find it much quicker and simpler to spend a couple of bucks on an off-the-shelf DAC chip).
    * anti-aliasing filter (Would a single resistor and a single capacitor be adequate?)
    * a speaker driver amp, such as the LM386N-3 .
    * ... As always, a few other things that you'll realize you need ...

    Audio data storage format:

    * WAV files are simplest. You could use any PIC to read bytes from the storage chip and dump them to the DAC. See WAV for details.

    You should probably get WAV playing first, to make sure "read byte from storage" and "write byte to DAC" are working properly.

    At 3 minutes * (60 sec/min) * 8000 samples/sec * 2 bytes/sample (stereo) = about 3 MegaBytes. That's about $18 worth of M25P40-VMN6 (Jameco) or $13 worth of AT45DB041B (Digikey) chips.

    Some other possibilities are:

    * I assume Oznog and Brick are both talking about the dsPIC30F Speech Encoding/Decoding Library User's Guide which uses CELP to compress audio down to 1 KByte/second, and play it back. It gives telephone-quality audio. The only benefit this gives you is 8x longer play time than WAV for a given amount of storage.

    * Some people are using a PIC connected to a hard drive in a MP3 player: http://opencircuits.com/Music_Player . The only benefit MP3 gives you is longer play time than WAV for a given amount of storage -- I suspect (?) MP3 gives even longer play time than CELP.

    * You could design your own custom audio-compression format.

    Have fun. Tell us what you learn. (What data storage did you select, and why?)

    #5
    Stefan Uhlemayr
    Super Member
    • Total Posts : 4300
    • Reward points : 0
    • Joined: 2005/05/12 12:25:46
    • Location: Germany
    • Status: offline
    RE: dsPic audio player ? 2006/06/01 12:12:00 (permalink)
    0
    Some time ago, I was doing something like this using the following parts:
     
    M25Pxx - EEPROM (size depending on the audio-length), where the WAV-file is stored in
    PIC18F1220 with external quarz and internal pll
    PCM1772 - Audio-DAC
     
    With this parts, I reached the following data´s:
    max. 22050 Hz sample
    16 bit resolution
    mono (the application needs only mono)
     
    The sound-quality coming out was really good. And there was no need for a ds-pic...
    One thing I may recommend: try to use the highest possible resolution as possible (most times a question of the memory...), a higher resolution may improve the quality of sound much more then a higher sample-rate. And the disturbing noise will be much smaller, too.
    And stereo will only be recommend, if the quality of sound will be much better then telephone...
     
    Good luck,
    Stefan
    #6
    sasian
    Starting Member
    • Total Posts : 69
    • Reward points : 0
    • Joined: 2006/04/03 05:28:18
    • Location: Puerto Real, Spain
    • Status: offline
    RE: dsPic audio player ? 2006/06/26 05:26:10 (permalink)
    0
    I can get data from WAV header but after that how I send audio data to the SI codec??
    can you share your code Stefan?
     
    thanks
    #7
    Stefan Uhlemayr
    Super Member
    • Total Posts : 4300
    • Reward points : 0
    • Joined: 2005/05/12 12:25:46
    • Location: Germany
    • Status: offline
    RE: dsPic audio player ? 2006/06/26 07:52:09 (permalink)
    0
    can you share your code Stefan?

     
    Unfortunately, no. Owner of the code is the company, where I´m working and my chief wouldn´t be amused, if I give it away...
     
    But I may give some more technical informations, of how you may realize it:
    To make the codec working (with oversampling of 384), you need some clock-signals:
     
    SCKI = 8,4672 MHz (quarz), which drives the pic and the codec (clockpin from codec connected to clock-out from pic), pic is working with internal pll
    BCK = 705,6 kHz (software-generated, output-pin from pic)
    LRCK = 44,1 kHz (software-generated, output-pin from pic)

    Between every BCK-change, you have to place 5 instructions, and between every LRCK-change, there have to be 95 instructions.
    You may first write only one complete program-loop (serving left and right-channel of the codec) with only generating the clock-signals (placing only nop-intructions between the clock-orders), then you can control these frequencies very easy with an icd2 and an oscilloscope.
    If you have stable signals and frequencies, you may replace the nop-instructions with the instructions needed for reading out the spi and for serving the codec with this data.
     
    Good luck,
    Stefan
    #8
    sasian
    Starting Member
    • Total Posts : 69
    • Reward points : 0
    • Joined: 2006/04/03 05:28:18
    • Location: Puerto Real, Spain
    • Status: offline
    RE: dsPic audio player ? 2006/06/27 02:41:19 (permalink)
    0
    thanks for the info Stefan, it´s a nice help. just a cuestion:
    i need to play a voice messge like 'thank you' or 'please...' so what it the best solution? just pwm, use the codec or use a mp3 chip (easy code but highest cost..)
    thank you
    #9
    Stefan Uhlemayr
    Super Member
    • Total Posts : 4300
    • Reward points : 0
    • Joined: 2005/05/12 12:25:46
    • Location: Germany
    • Status: offline
    RE: dsPic audio player ? 2006/06/28 06:20:45 (permalink)
    0
    Hi Sasian,
    a question about the "best" solution is always hard to answer. What is the most important thing for you? Price, effort, signal-quality, ...?
    For voice-messages, pwm would be a possible solution, too. MP3 looks a little bit like using cannons for catching flies, it would be only suitable, if you have a very long text message. Another possible solution would be the isd-chips from winbond. They allow simple record and playback up to 120 seconds.
    Greetings,
    Stefan
    #10
    lewispaul
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2003/11/07 12:48:58
    • Status: offline
    RE: dsPic audio player ? 2006/06/28 11:22:31 (permalink)
    0
    Adaptive Differential Pulse Code Modulation using PICmicro™ Microcontrollers (Application note 643 by Microchip) produces excellent audio compression and is applicable to any of their microcontrollers.
    #11
    sasian
    Starting Member
    • Total Posts : 69
    • Reward points : 0
    • Joined: 2006/04/03 05:28:18
    • Location: Puerto Real, Spain
    • Status: offline
    RE: dsPic audio player ? 2006/06/29 00:15:49 (permalink)
    0
    Yes Lewispaul, its a very nice AN. I work about it. my problem (as Stefan comment) it than i need a way to play a short voice message, no more than 5-10 seconds but i need to use a standard format like WAV or MP3 and not special chips to store voice. I have a SDcard on my board for store configs and images so i´m not sure (not experience) to use a mp3 chip decoder, a si3000 codec or just a pwm out because space for data it´s not my problem.
     
    thanks
    #12
    Neiwiertz
    Super Member
    • Total Posts : 2027
    • Reward points : 0
    • Joined: 2004/09/01 02:58:52
    • Status: offline
    RE: dsPic audio player ? 2007/06/16 06:27:57 (permalink)
    0
    Hello
    I was wondering if it is possible to decode a mp3 file stored on a sdcard using only a dspic as hardware.
    Today i'd noticed the open sourceMAD: MPEG Audio Decoder http://www.underbit.com/products/mad/

    Would a dspic been capable todo this using the madlib[8|]

    Regards

    #13
    Oznog
    Super Member
    • Total Posts : 1011
    • Reward points : 0
    • Joined: 2004/10/14 21:54:10
    • Status: offline
    RE: dsPic audio player ? 2007/06/18 00:40:30 (permalink)
    0
    I haven't seen anyone make an MP3 decoder in software on the dsPIC.  There are plenty of projects making an MP3 player even with an 18F or 16F, but with an expensive decoder chip doing all the actual work.

    I did see one company offered a software mp3 decoder for the TMS320C5000 that took only 18MIPs at most.  However that- and the MAD project- uses 32 bit integer math.  Well the dsPIC has a 40-bit accumulator which can do some 32 bit math.  Still when it comes down to it, if an mp3 decoder requires mostly 32 bit math, I suspect it'll take more than twice as long so there's just not enough MIPs in the dsPIC here, even the 33F.

    You know, I think that report of 18MIPs might be for stereo.  So for a mono channel, who knows?  Maybe it would be possible.
    post edited by Oznog - 2007/06/18 00:43:43
    #14
    DarioG
    Super Member
    • Total Posts : 44774
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Mars
    • Status: offline
    RE: dsPic audio player ? 2007/06/18 02:55:41 (permalink)
    0
    I would have loved to do it, possibly on a PIC18, even with great limitations (mono, 4 bit output samples, low bps MP3s)... just to test the whole thing.
    But I had no time to start "adapting" the MPG123 code I'm using on PCs.

    I downloaded that library suggested above, I'll try to take a look. It could be the right time to start using dsPICs Smile

    Dario Greggio
    --
     
    #15
    Neiwiertz
    Super Member
    • Total Posts : 2027
    • Reward points : 0
    • Joined: 2004/09/01 02:58:52
    • Status: offline
    RE: dsPic audio player ? 2007/06/18 11:13:37 (permalink)
    0
    You know, I think that report of 18MIPs might be for stereo. So for a mono channel, who knows? Maybe it would be possible.
    Ok i see what you are meaning about using one channel takes maby less then 18MIPs.

    I'll try to take a look. It could be the right time to start using dsPICs
    Yeah Dario i started a few weeks ago using the explorer16 and run straight into spi readbyte trouble Smile when pushing spi read byte at max speedgrin.  Would be very nice if someone could make any result using a dspic. Therefore which hardware should be needed to connect a small speaker to a dspic?

    Good idea to try out low bps MP3, Yeah the madlib code is huge, I don't know if mad could read out a WAV file  asuming reading out a wav file takes less MIPS then decode a MP3 file.

    Regards
    #16
    DarioG
    Super Member
    • Total Posts : 44774
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Mars
    • Status: offline
    RE: dsPic audio player ? 2007/06/18 11:18:32 (permalink)
    0
    ORIGINAL: Neiwiertz
    [...] I don't know if mad could read out a WAV file  asuming reading out a wav file takes less MIPS then decode a MP3 file.



    Oh, well, for sure reading a WAV stream is much easier & faster: there's almost no computation needed...
    Or am I misunderstanding your point?


    Dario Greggio
    --
     
    #17
    Neiwiertz
    Super Member
    • Total Posts : 2027
    • Reward points : 0
    • Joined: 2004/09/01 02:58:52
    • Status: offline
    RE: dsPic audio player ? 2007/06/18 11:41:49 (permalink)
    0
    No that's exactly what i am meaning, I was thinking about the elektor explorer16 course recently, Maby it is a starting point to create a sound then try to use the mad. I was refering to Demo4 Guide to creating your own speech/sound files
    http://www.elektor-electronics.co.uk/Default.aspx?tabid=140.
    The course is using the
    Microchip Audio PICtail Plus daughterboard
    But i couldn't find this board on the site

    Regards


    #18
    DarioG
    Super Member
    • Total Posts : 44774
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Mars
    • Status: offline
    RE: dsPic audio player ? 2007/06/18 12:18:35 (permalink)
    0
    I see. I can easily give you code to play WAV files, if you have a FAT Smile

    Dario Greggio
    --
     
    #19
    Neiwiertz
    Super Member
    • Total Posts : 2027
    • Reward points : 0
    • Joined: 2004/09/01 02:58:52
    • Status: offline
    RE: dsPic audio player ? 2007/06/18 13:11:59 (permalink)
    0
    I see. I can easily give you code to play WAV files, if you have a FAT
    A FAT will be no problemwink, very pleasing offer.

    Thanks
    #20
    Page: 12345.. > >> Showing page 1 of 6
    Jump to:
    © 2014 APG vNext Commercial Version 4.5