Microchip

 dsPic audio player ?

Change Page: 123456 > | Showing page 1 of 6, messages 1 to 20 of 106
Author Message
Guest
dsPic audio player ? Sunday, May 28, 2006 1:33 AM (permalink)
0
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
    leon_heller

    • Total Posts : 6265
    • Reward points : 0
    • Joined: 8/17/2004
    • Location: St. Leonards-on-Sea, E. Sussex, UK.
    • Status: online
    RE: dsPic audio player ? Sunday, May 28, 2006 2:16 AM (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

      • Total Posts : 1586
      • Reward points : 0
      • Joined: 5/25/2006
      • Status: offline
      RE: dsPic audio player ? Sunday, May 28, 2006 3:09 AM (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

        • Total Posts : 1011
        • Reward points : 0
        • Joined: 10/14/2004
        • Status: offline
        RE: dsPic audio player ? Sunday, May 28, 2006 11:59 AM (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

          • Total Posts : 36
          • Reward points : 0
          • Joined: 9/12/2005
          • Status: offline
          RE: dsPic audio player ? Wednesday, May 31, 2006 12:54 PM (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

            • Total Posts : 4323
            • Reward points : 0
            • Joined: 5/12/2005
            • Location: Germany
            • Status: offline
            RE: dsPic audio player ? Thursday, June 01, 2006 12:12 PM (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

              • Total Posts : 69
              • Reward points : 0
              • Joined: 4/3/2006
              • Location: Puerto Real, Spain
              • Status: offline
              RE: dsPic audio player ? Monday, June 26, 2006 5:26 AM (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

                • Total Posts : 4323
                • Reward points : 0
                • Joined: 5/12/2005
                • Location: Germany
                • Status: offline
                RE: dsPic audio player ? Monday, June 26, 2006 7:52 AM (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

                  • Total Posts : 69
                  • Reward points : 0
                  • Joined: 4/3/2006
                  • Location: Puerto Real, Spain
                  • Status: offline
                  RE: dsPic audio player ? Tuesday, June 27, 2006 2:41 AM (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

                    • Total Posts : 4323
                    • Reward points : 0
                    • Joined: 5/12/2005
                    • Location: Germany
                    • Status: offline
                    RE: dsPic audio player ? Wednesday, June 28, 2006 6:20 AM (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

                      • Total Posts : 8
                      • Reward points : 0
                      • Joined: 11/7/2003
                      • Status: offline
                      RE: dsPic audio player ? Wednesday, June 28, 2006 11:22 AM (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

                        • Total Posts : 69
                        • Reward points : 0
                        • Joined: 4/3/2006
                        • Location: Puerto Real, Spain
                        • Status: offline
                        RE: dsPic audio player ? Thursday, June 29, 2006 12:15 AM (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

                          • Total Posts : 1996
                          • Reward points : 0
                          • Joined: 9/1/2004
                          • Status: offline
                          RE: dsPic audio player ? Saturday, June 16, 2007 6:27 AM (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

                            • Total Posts : 1011
                            • Reward points : 0
                            • Joined: 10/14/2004
                            • Status: offline
                            RE: dsPic audio player ? Monday, June 18, 2007 12:40 AM (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.
                            <message edited by Oznog on Monday, June 18, 2007 12:43 AM>
                             
                            #14
                              DarioG

                              • Total Posts : 38910
                              • Reward points : 0
                              • Joined: 2/25/2006
                              • Location: Trana (TO), Italy
                              • Status: offline
                              RE: dsPic audio player ? Monday, June 18, 2007 2:55 AM (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

                                • Total Posts : 1996
                                • Reward points : 0
                                • Joined: 9/1/2004
                                • Status: offline
                                RE: dsPic audio player ? Monday, June 18, 2007 11:13 AM (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

                                  • Total Posts : 38910
                                  • Reward points : 0
                                  • Joined: 2/25/2006
                                  • Location: Trana (TO), Italy
                                  • Status: offline
                                  RE: dsPic audio player ? Monday, June 18, 2007 11:18 AM (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

                                    • Total Posts : 1996
                                    • Reward points : 0
                                    • Joined: 9/1/2004
                                    • Status: offline
                                    RE: dsPic audio player ? Monday, June 18, 2007 11:41 AM (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

                                      • Total Posts : 38910
                                      • Reward points : 0
                                      • Joined: 2/25/2006
                                      • Location: Trana (TO), Italy
                                      • Status: offline
                                      RE: dsPic audio player ? Monday, June 18, 2007 12:18 PM (permalink)
                                      0
                                      I see. I can easily give you code to play WAV files, if you have a FAT Smile
                                      Dario Greggio

                                       
                                      #19
                                        Neiwiertz

                                        • Total Posts : 1996
                                        • Reward points : 0
                                        • Joined: 9/1/2004
                                        • Status: offline
                                        RE: dsPic audio player ? Monday, June 18, 2007 1:11 PM (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
                                          Online Bookmarks Sharing: Share/Bookmark
                                          Change Page: 123456 > | Showing page 1 of 6, messages 1 to 20 of 106

                                          Jump to:

                                          Current active users

                                          There are 0 members and 1 guests.

                                          Icon Legend and Permission

                                          • New Messages
                                          • No New Messages
                                          • Hot Topic w/ New Messages
                                          • Hot Topic w/o New Messages
                                          • Locked w/ New Messages
                                          • Locked w/o New Messages
                                          • Read Message
                                          • Post New Thread
                                          • Reply to message
                                          • Post New Poll
                                          • Submit Vote
                                          • Post reward post
                                          • Delete my own posts
                                          • Delete my own threads
                                          • Rate post

                                          2000-2013 ASPPlayground.NET Forum Version 3.9