[Media_api] portsoundfile?

Roger Dannenberg rbd at cs.cmu.edu
Wed Jun 20 11:18:02 PDT 2007


I haven't made much progress toward a portable sound file system, but I 
want to revisit this problem. I'm still using my own library in Nyquist 
and Aura, but I would like to use something with a wider base of users 
and developers. I can put some resources into this, and I'm curious 
about other people's opinions on the state of the art and what if 
anything should be done.

Recently, a student and I re-examined libsndfile and libaudiofile, and I 
was disappointed by both. Libsndfile uses a different scale factor on 
input and output. This seems to stem from a view that audio data is 
basically an analog approximation and a little distortion is OK. My view 
is that the implementation should follow a precise specification and the 
relationship between float and int samples should be fixed (e.g. ints 
can be viewed as binary fractions, making the scale factor 2^N). 
Libsndfile does not support Ogg Vorbis, mp3, or SDIF, although it does 
support a lot of formats and at least one that would allow files longer 
than 2^32 bytes. Libaudiofile reads data with a scale factor of 1/(2^N - 
1) which seems wrong, but I think this can be changed through the API. 
Worse, it rounds floats toward zero rather than rounding to the nearest 
value, introducing a nonlinearity on output. In spite of the features 
and support, I think both libsndfile and libaudiofile have some 
fundamental (although easily fixed) problems.

My sense is that writing a new sound file library is a waste of effort 
and would not serve many users. I could modify libsndfile, but Erik de 
Castro Lopo (creator of libsndfile) would consider a fork of the project 
to be "hostile". (Is that important? Audacity already keeps a private 
copy of libsndfile, but probably more for source control than anything 
else.) I could also work on libaudiofile, but adding a lot of new file 
formats there seems like duplication of effort. There's also the 
legality question for mp3 support -- I don't understand this, but it 
seems to me that dynamically linking to Lame as does Audacity would be 
relatively easy.

Meanwhile, the portmedia project is up at SourceForge. I'm slowly 
getting things set up there. If anyone would like to 
adapt/recreate/update the PortMusic web pages on SourceForge, let me know.






More information about the media_api mailing list