Thread overview
Audio file read/write?
Nov 07, 2014
Daren Scot Wilson
Nov 07, 2014
ponce
Nov 08, 2014
Jeremy DeHaan
November 07, 2014
What's the current recommended way to read and write audio files?

I don't need to play it on the speakers or deal with anything real time - just read a file's data into an array, fiddle with it, and write it out to a file.

I found some other threads about audio files, but none recent, mentioning SDL and OpenAL.  Are these still the way to go?    I'm thinking I should avoid SDL since it does far more than audio, none of which I care about.  OpenAL also does way more than I care about, but at least is just audio.

For my application, I need to read a few of the common formats, such as .wav, .au, .mp3, .ogg and whatever else is popular.  I only need to write .wav but other audio tinkerers may want to write other formats.
November 07, 2014
COn Friday, 7 November 2014 at 02:58:15 UTC, Daren Scot Wilson wrote:
> What's the current recommended way to read and write audio files?
>
> I don't need to play it on the speakers or deal with anything real time - just read a file's data into an array, fiddle with it, and write it out to a file.
>
> I found some other threads about audio files, but none recent, mentioning SDL and OpenAL.  Are these still the way to go?    I'm thinking I should avoid SDL since it does far more than audio, none of which I care about.  OpenAL also does way more than I care about, but at least is just audio.

SDL vanilla and OpenAL won't help with reading and writing audio files.

>
> For my application, I need to read a few of the common formats, such as .wav, .au, .mp3, .ogg and whatever else is popular.  I only need to write .wav but other audio tinkerers may want to write other formats.

wave-d: read/write .WAV file, all at once
https://github.com/d-gamedev-team/wave-d

Pretty sure libsndfile can read .wav, .au, .ogg but not mp3
No commercial usage unless you pay a licence.
https://github.com/p0nce/DerelictSndFile.git

BASS can do it all:
No commercial usage unless you pay a licence.
https://github.com/p0nce/DerelictBASS

SDL_mixer can read .wav .au .ogg and .mp3
https://github.com/DerelictOrg/DerelictSDL2
November 08, 2014
On Friday, 7 November 2014 at 11:55:16 UTC, ponce wrote:
> Pretty sure libsndfile can read .wav, .au, .ogg but not mp3
> No commercial usage unless you pay a licence.
> https://github.com/p0nce/DerelictSndFile.git


Not sure about the others, but you can use sndfile in a commercial project for free as long as you follow the correct steps for linking/including the licenses.

http://www.mega-nerd.com/libsndfile/FAQ.html#Q021