www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Audio file read/write?

reply "Daren Scot Wilson" <darenw darenscotwilson.com> writes:
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.
Nov 06 2014
parent reply "ponce" <contact gam3sfrommars.fr> writes:
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
Nov 07 2014
parent "Jeremy DeHaan" <dehaan.jeremiah gmail.com> writes:
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
Nov 08 2014