PDA

View Full Version : Reading/Writing to a Wav file in C++?



Stochastic
November 19th, 2008, 08:01 AM
Hi I'm just curious the easiest method to read from and write to a wav file (no need for playback) in C++? I'm kinda new to libraries and such so is a C library like libsndfile useable in C++ code?

StOoZ
November 19th, 2008, 10:46 AM
yes you can use C libraries in C++ code.

Cracauer
November 19th, 2008, 03:02 PM
People use libsndfile, available in Ubuntu.

The API kinda sucks, but it's not rocket science, I think a sucky API won't kill anyone.

This only reads and writes static files, it won't do in-stream real time filtering.

sshuber
November 19th, 2008, 04:51 PM
If you aren't worried about playback in ubuntu, check out mpg123. They have an API written in C and examples for wav conversion and such. They don't have API function for ALSA right now though. I'm working on my own project that plays mp3's and their API doesn't work in ubuntu. It has to be coded using the ALSA API.

Anyways visit www.mpg123.de