Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 12 of 12

Thread: how to play raw audio file in PC .

  1. #1
    Junior Member
    Join Date
    Apr 2015
    Posts
    2

    how to play raw audio file in PC .

    Dear pjrc team ,

    first , thanks you for your effort in teensy module and it shiled as it save time for development and how easy it is .

    I have audio shield for teensy 3.1 , it work fine and great .. but now if I wanna to play RAW file in the pc ? what possible way to do it , I am not interest to play it from module it self .

    thanks in advance and regards

  2. #2
    Junior Member
    Join Date
    Mar 2015
    Posts
    15
    They're .WAV files, should be able to play them with most normal audio progs. VLC, Windows Media Player...

  3. #3
    They are not.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,654
    I believe you can open/import raw binary data into Audacity, which can play the sound or do all sorts of editing stuff.

    The sox utility can convert between almost any formats, including raw data. That's what I usually use, since it's quicker than having to fiddle with a graphical program. But if you're not used to command line stuff, especially on Windows, Audacity is probably easier to learn.

    I'm sure there are many other programs, but those are the 2 I've personally used. Both work great.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,654
    When you import raw audio data, any program will need you to specify details, like the data width, sample rate, number of channels, and byte order.

    If you get the data width or byte order wrong, the result is usually terrible noise. RAW files from the Teensy Audio Library should be 16 bit, LSB first (little endian) format.

  6. #6
    Quote Originally Posted by PaulStoffregen View Post
    When you import raw audio data, any program will need you to specify details, like the data width, sample rate, number of channels, and byte order.

    If you get the data width or byte order wrong, the result is usually terrible noise. RAW files from the Teensy Audio Library should be 16 bit, LSB first (little endian) format.
    so is monoaural PCM 16 bit 44.1khz little endian? thanks Paul and i should be able to import it with audacity ? thanks.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,654
    Monoaural PCM 16 bit 44.1khz data could be either little endian or big endian. It all depends on the byte order used by the software that wrote the file.

    The Teensy Audio Library uses little endian. Many other program also use little endian by default, but I can't comment on any specific software other than what I've written.

  8. #8
    Quote Originally Posted by PaulStoffregen View Post
    I believe you can open/import raw binary data into Audacity, which can play the sound or do all sorts of editing stuff.

    The sox utility can convert between almost any formats, including raw data. That's what I usually use, since it's quicker than having to fiddle with a graphical program. But if you're not used to command line stuff, especially on Windows, Audacity is probably easier to learn.

    I'm sure there are many other programs, but those are the 2 I've personally used. Both work great.
    I've tryed to play with sox but i got lost with all the options, i would love if you could post an example sox commandline to convert teensy's raw files to WAV.
    Thanks, much apreciated.

  9. #9
    Quote Originally Posted by PaulStoffregen View Post
    Monoaural PCM 16 bit 44.1khz data could be either little endian or big endian. It all depends on the byte order used by the software that wrote the file.

    The Teensy Audio Library uses little endian. Many other program also use little endian by default, but I can't comment on any specific software other than what I've written.
    Yep i was taliking about the teensy raw files, thanks.

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,654
    Here's a quick example:

    Code:
      sox -b 16 -c 1 -r 44100 -e signed-integer 001.raw 001.wav
    Because the raw data is just bytes, sox needs you to give it all those details about the format. Then it can output WAV or other formats.

  11. #11
    Junior Member
    Join Date
    Sep 2017
    Posts
    1
    Sorry to bother you guys, but it seems to be a related topic about audio file playback issue. I have a question and do not know whether or not i should post here for some answers. Recently i have a audio file with .au extension. It can not be played on any of my devices or vlc and windows media player. Then I downloaded this software (http://www.videoconverterfactory.com...au-to-mp3.html) to help me change AU to MP3. But you can see from the article that it asks me to preset audio parameters in the course of conversion process. I don't know what bit rate and sample rate value I should preset for the best output? If it is that the higher they are the better the output will be? Or I am wrong? Don’t be mad at me because I am a noob.

  12. #12
    Use Audacity Software. You'll get excellent results. It takes a lot more time to export the file than to import it. You can adjust your mp3 rate, bit rate and more in Audacity's Preferences.

Posting Permissions

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