Re: [LAD] A question about audio file interfaces

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-audio-dev@...>
Date: Sunday, December 1, 2013 - 1:43 am

Fons Adriaensen wrote:

> There are at least three distinct places where this can be

In case you hadn't realised it, file formats are important.

Basically, if libsndfile needs to do any audio data format
conversion (eg int -> float or vice versa, endian swapping
etc) then it reads data from disk into an internal buffer
and then converts the data from the internal buffer to the
buffer you provided. Since the internal buffer is only about
16k, if you read large chunks, the conversion is done in a
loop with lots of smaller reads.

However, if for instance you are reading a file with 32 bit
float data with host endian-ness into a 32 bit float buffer,
then no conversion needs to take place and libsndfile simply
passes your buffer to the read syscall.

Obviously, it you care for performance, the second one is
vastly preferable and gives you a reasonable amount of control
over bufferring.

Hope this helps.

Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAD] A question about audio file interfaces, Fons Adriaensen, (Sat Nov 30, 10:57 pm)
Re: [LAD] A question about audio file interfaces, Fred Gleason, (Sun Dec 1, 3:42 am)
Re: [LAD] A question about audio file interfaces, Erik de Castro Lopo, (Sun Dec 1, 1:43 am)
Re: [LAD] A question about audio file interfaces, Devin Anderson, (Sun Dec 1, 12:32 am)
Re: [LAD] A question about audio file interfaces, Fons Adriaensen, (Sun Dec 1, 11:48 am)
Re: [LAD] A question about audio file interfaces, Paul Davis, (Sun Dec 1, 2:08 pm)
Re: [LAD] A question about audio file interfaces, Fons Adriaensen, (Sun Dec 1, 4:49 pm)
Re: [LAD] A question about audio file interfaces, Paul Davis, (Sun Dec 1, 4:58 pm)
Re: [LAD] A question about audio file interfaces, Fons Adriaensen, (Sun Dec 1, 6:43 pm)
Re: [LAD] A question about audio file interfaces, Paul Davis, (Sat Nov 30, 11:07 pm)