[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSound

From: Stefan Bidigaray
Subject: Re: NSSound
Date: Fri, 5 Jun 2009 08:43:08 -0500

On Fri, Jun 5, 2009 at 3:29 AM, Xavier Glattard <address@hidden> wrote:
24-bits audio becomes very common. Anyway, as Fred said, the format of the data has not to be handle by NSSound : libsndfile do it fine. Just put the audio in a NSData and sndfile will convert it for you.
If you use jack (do you ?), i think you only have to call sf_read_float and send the result to jack, that will convert it (again) to a format supported by the hardware.
Well, that's the beauty of libsndfile, I just read everything as short, and store it as such.  I've been running some tests with JACK and I'm not really sure I like it.  It has a really powerful API, but therein lies the problem, we don't need that much power.  Something like PulseAudio would give me more of what I need without the extra bloat JACK brings with it.  The fact remains that most, uncompressed audio formats come in 16-bit PCM (uLaw and aLaw have a direct convertion path to 16-bit too, no calculations needed).  Reading this files is extremely fast if you're going to other integer formats, but really slow when going to Float types (you need to multiply a convertion factor to everything, which is slow).  Also, after JACK reads it in float, it has to convert it back to 16-bit PCM so that it can run it through the sound card, after all that's the native format.
As I said, I agree with Fred : NSSound has nothing to do with audio format. And I agree with David : this method might be usefull ;)
A GSSoundKit might be the right place for it.
I would really like to go into something like this, I'm actually trying my best to write NSSound in a way that this can be more easily accomplished.
On debian lenny i386 is less than 360Kio while is near 4Mio.
If you think it is realy important, what about a reduced libsndfile ? One may probably build sndfile with a reduced set of codecs (the LGPL ones).
Lenny doesn't have the OGG and FLAC decoding portions, though.  Only Sid current has libsndfile built with support for those formats and it depends on libogg, libvorbis and libflac.  These libraries aren't that big.  The question is, what to do if someone doesn't have libsndfile?  Should we still have basic playback on those systems?
I was hoping to keep the backend/playing code separate from the frontend/reading, but it looks like this might not be possible (the previous post on streaming audio).  I've also been having doubt on OpenAL.  I really like the API, but I'm not sure it lends itself to NSSound's architecture.  So far, I've thought of the following: OpenAL (obviously), JACK, PulseAudio and NAS.
PS: let me know if you need help understanding what I'm saying, I'm a bit of a scatter-brain.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]