Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 36 of 36

Thread: Audiolib-MP3

  1. #26
    The conversion went well, though I found a few files with imbedded graphics. I ended up using
    ffmpeg -i i.mp3 -map_metadata -1 -ac 1 -at 44100 -b:a 64k -vn o.mp3

    This is for an old 1937 Zenith radio I gutted and converted to an MP3 player. I'm reading the tunning capacitor and using its value to select a directory on the SD card. The directory's contents are played randomly. I filled up the SD card with old radio broadcasts (Glenn Miller, War-of-the-Worlds, Hindenburg, The Shadow, etc).

    Is there a limit to the bit rate of the MP3 decoder? I tried adding some classical music from CDs I have, using a 160Kbps bit rate. I'm having some problems with those files, a small snippet at the start plays and then silence. It might be that the files are stereo instead of mono, though I use a mixer at 0.5 gain on both channels to combine them.
    Last edited by dundakitty; 04-13-2017 at 11:56 AM. Reason: corrected ffmpeg argument, '-I' should be '-i'

  2. #27
    As a test I tried encoding the files at 64 Kbps, 128 Kbps, 160 Kbps, 192 Kbps, and 256 Kbps. They would play at 64 Kbps and 128 Kbps, but not at any higher bit rate.
    I am using a SanDisk Ultra 32 GB card on a Teensy 3.6.

  3. #28
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Hm, they should work at any bitrate up to 320. But, I must admit, i did not test other bitrates for a very very long time now...
    I'll take a look.. (next weekend)

    "a small snippet at the start plays and then silence."

    ?? Are they VBR ? (variable bitrate?) This does not work. Only fixed bitrates.
    You pull the bad luck ...
    Last edited by Frank B; 04-12-2017 at 11:30 PM.

  4. #29
    I used the same ffmpeg command on all the files, just changing the bit rate specification (-b:a 160k). That should be fixed bit rate. All the old radio broadcasts work at 64Kbps (-b:a 64k). The new clips from CDs work at 64Kbps and 128Kbps, but not at higher bit rates. Not all files played short snippets. Most were silent, as if nothing were playing. As I cycled through the files I came across one that just produced a constant screech, locking up the teensy. It would not respond to any commands, so I had to power-cycle.

  5. #30
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Quote Originally Posted by dundakitty View Post
    I used the same ffmpeg command on all the files, just changing the bit rate specification (-b:a 160k). That should be fixed bit rate. All the old radio broadcasts work at 64Kbps (-b:a 64k). The new clips from CDs work at 64Kbps and 128Kbps, but not at higher bit rates. Not all files played short snippets. Most were silent, as if nothing were playing. As I cycled through the files I came across one that just produced a constant screech, locking up the teensy. It would not respond to any commands, so I had to power-cycle.
    Can you send me one of the files ?

    f dot boesing at gmx dot de

  6. #31
    Files have been sent.
    I instrumented the code to see if I was running out of CPU or SD Card bandwidth.
    On a 128Kbps clip, the audio library reported 9.5% CPU. Only two AudioLib buffers in use, seven was the peak (I allocated 32). The teensy 3.6 was reading the SD card 16 times a second, at 1024 bytes per read. PushData was being called over 300,000 times a second (or was that 3,000,000?), once per loop() call.

    With a 160Kbps clip only one or two 1024-byte blocks were read, then pushData() stopped updating the read length. The read rate dropped to zero.

  7. #32
    I decided to try 4096-byte SD card reads. pushData() is limited to the size of the MP3 frame buffer, which is set to two 961-byte frames (1922 bytes). I bumped up MP3_FRAMEBUFFERS to 9 (8649 bytes) and tried the 4K SD card reads. Now 160 Kbps encoded clips will play, but not 192 Kbps and 256 Kbps.

    I did try setting MP3_FRAMEBUFFERS to 18 (17298 bytes) and tried both 1K and 4K SD card reads. I still couldn't play 192 Kbps and 256 Kbps.

  8. #33
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Hm, please use the old lib. It's very easy to use, and all your example files you sent me work without problems with the older lib.
    Code:
    playMp31.play(filename);
    while (playMp31.isPlaying()) { .... blah .. }
    that's all. Just like the WAV-Player.


    (But please post your sketch (or use eMail), so that i can see what's going on with the queue- lib...)
    Last edited by Frank B; 04-15-2017 at 11:04 AM.

  9. #34
    I've attached the sketch.
    Attached Files Attached Files

  10. #35
    I should say that I'm using Arduino 1.8.1 and teensyduino 1.35. I see that teensyduino 1.36 is out. I might try upgrading, the memcpy fix sounds interesting.

  11. #36
    The zenith radio is buttoned up now. It'll be difficult to make any more changes. The person requesting the radio modification is happy with 160 Kbps MP3 files.
    I've started work on another radio, this one has fewer controls and no visible tubes -- no need for PWM control of LEDs simulating the glowing filaments.
    I'm using the old library on the new radio. A test program played the 192Kbps and 256Kbps samples without issue.

    I did have to make a change to the old library. It's missing a numChannels() function. I stole the one from the new library:
    inline numChannels(void) { return mp3FrameInfo.nChans; }

Posting Permissions

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