Audio Encoding and playback in a PIC


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Rob,

    I studied Roman's idea about a year or so ago. I was planning on using it, but never did get around to it.

    But what I remember is that the "bit-stream" has to be put out at a continuous frequency that is dependant on the encoding of the audio signal.

    If you are trying to send the "Stream" using SHIFTOUT, then it's going to send out 8-bits at an unknown bit-rate, and then there's going to be a big pause while you get the next byte from the EEPROM. I would imagine that your description of "garbled" is probably an understatement.

    From what I see, you're going to have 2 problems to deal with. The first one is fairly easy, the bit-stream needs to be sent out using an ASM interrupt driven by a timer at a fixed frequency. This will give a continuous stream at a fixed bit-rate. It also frees up some time for the rest of the program to fetch data from the EEPROM.

    The second problem may be getting the data from the external EEPROM fast enough to supply to interrupt routine with enough data so it doesn't miss a bit. With a 44khz audio stream, you'll need a new data byte every 181uS. Getting one byte at a time may not be fast enough, but if you created a buffer, and read from the EEPROM in blocks it might just work. If not, you may need to use the Hardware I2C (if your PIC has it).

    Slower Audio encoding will also help if getting the data takes too long. If all you are playing back is speach, you can probably go much lower. But then that means recalculating the "Binary Time constant".

    HTH,
       Darrel
    Last edited by Darrel Taylor; - 23rd March 2005 at 23:44.

  2. #2
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    94


    Did you find this post helpful? Yes | No

    Talking

    Darrel,

    Thanks for that information, that is gonna be really helpful. I should be able to grab the data fast enough as it was encoded at around 8Khz - figured this would be good enough quality for speech (for my application anyway). Now you've mentioned the interrupt, I will look into doing it that way.

    I'll let everyone know if I have any success!

    Thanks again

    Rob

  3. #3
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    I was also interested in this sometime back and did not converge on an answer. For reference, this has been covered here:
    http://www.picbasic.org/forum/showth...ht=roman+sound

    I would also check the following, as it seemed a more elegant approach:
    http://www.picbasic.org/forum/showth...ighlight=ADPCM

    Good luck.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts