* 64bit audio read and write
@ 2016-07-06 0:02 Matt Flax
2016-07-06 7:29 ` Eric Wong
2016-09-19 21:20 ` Jan Stary
0 siblings, 2 replies; 7+ messages in thread
From: Matt Flax @ 2016-07-06 0:02 UTC (permalink / raw)
To: sox-devel
Hi there,
I currently use libsox to load and save audio data. I was wanting to
write and read 64bit data, however the generic sox sample type is 32 bit
(from sox.h) :
typedef sox_int32_t sox_sample_t;
The basic format of the read (and write) functions are :
size_t sox_read(
sox_format_t * ft,
sox_sample_t *buf,
size_t len
);
Can anyone tell me the basic methodology for reading/writing 64bit audio ?
thanks
Matt
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 64bit audio read and write
2016-07-06 0:02 64bit audio read and write Matt Flax
@ 2016-07-06 7:29 ` Eric Wong
2016-07-06 9:57 ` Matt Flax
2016-09-19 21:20 ` Jan Stary
1 sibling, 1 reply; 7+ messages in thread
From: Eric Wong @ 2016-07-06 7:29 UTC (permalink / raw)
To: sox-devel
Matt Flax <flatmax@flatmax.org> wrote:
> Hi there,
>
> I currently use libsox to load and save audio data. I was wanting to
> write and read 64bit data, however the generic sox sample type is 32 bit
Correct, sox does some calculations internally in 64-bit double,
but data which flows in between the effects is all 32-bit int.
> (from sox.h) :
> typedef sox_int32_t sox_sample_t;
>
> The basic format of the read (and write) functions are :
> size_t sox_read(
> sox_format_t * ft,
> sox_sample_t *buf,
> size_t len
> );
>
> Can anyone tell me the basic methodology for reading/writing 64bit audio ?
It would probably reworking a lot of sox internals and would
require increased memory bandwidth, hurting performance for
common <= 32-bit processing.
But, where and how are you working with 64-bit audio
and what 64-bit audio formats are there?
I'm not up-to-date with the latest technology, but even 32-bit
is far beyond the range of human hearing; and last I checked;
available ADC/DACs can't even make full use of 24-bit (nor
our ears).
On the other hand, moving to 32-bit float would make sense for
compatibility with 3rd-party plugins (LADSPA for sure, maybe
LV2?). Right now, we're constantly converting between
float/integer in effects chains which hurts performance.
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 64bit audio read and write
2016-07-06 7:29 ` Eric Wong
@ 2016-07-06 9:57 ` Matt Flax
2016-07-06 11:41 ` Måns Rullgård
0 siblings, 1 reply; 7+ messages in thread
From: Matt Flax @ 2016-07-06 9:57 UTC (permalink / raw)
To: sox-devel
On 06/07/16 17:29, Eric Wong wrote:
> Matt Flax <flatmax@flatmax.org> wrote:
>> Hi there,
>>
>> I currently use libsox to load and save audio data. I was wanting to
>> write and read 64bit data, however the generic sox sample type is 32 bit
> Correct, sox does some calculations internally in 64-bit double,
> but data which flows in between the effects is all 32-bit int.
>
>> (from sox.h) :
>> typedef sox_int32_t sox_sample_t;
>>
>> The basic format of the read (and write) functions are :
>> size_t sox_read(
>> sox_format_t * ft,
>> sox_sample_t *buf,
>> size_t len
>> );
>>
>> Can anyone tell me the basic methodology for reading/writing 64bit audio ?
> It would probably reworking a lot of sox internals and would
> require increased memory bandwidth, hurting performance for
> common <= 32-bit processing.
>
> But, where and how are you working with 64-bit audio
> and what 64-bit audio formats are there?
I think there are 64 bit file formats, aiff-c perhaps ? Also matlab file
formats should be supporting 64 bits.
Personally, working with filters and various signal processing
algorithms like that. It is handy being able to save double length
words, possibly which are generated and synthesised in one way or other ...
>
> I'm not up-to-date with the latest technology, but even 32-bit
> is far beyond the range of human hearing; and last I checked;
> available ADC/DACs can't even make full use of 24-bit (nor
> our ears).
120 dB SPL (threshold of discomfort) is around 20 billion times louder
then 20 dB SPL (a whisper). That is approximately 24 bits.
However, we can hear down to 10 dB SPL, or lower for young people ...
that is approximately 40 bits of dynamic range.
Actually, I am not proposing we change the bit depth of sox in its
signal processing system, however perhaps we can introduce functions to
read and write 64 bit audio ?
Something like functions to read64 and write64 perhaps ?
>
> On the other hand, moving to 32-bit float would make sense for
> compatibility with 3rd-party plugins (LADSPA for sure, maybe
> LV2?). Right now, we're constantly converting between
> float/integer in effects chains which hurts performance.
>
> ------------------------------------------------------------------------------
> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> present their vision of the future. This family event has something for
> everyone, including kids. Get more information and register today.
> http://sdm.link/attshape
> _______________________________________________
> SoX-devel mailing list
> SoX-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sox-devel
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 64bit audio read and write
2016-07-06 9:57 ` Matt Flax
@ 2016-07-06 11:41 ` Måns Rullgård
2016-07-06 12:16 ` Matt Flax
0 siblings, 1 reply; 7+ messages in thread
From: Måns Rullgård @ 2016-07-06 11:41 UTC (permalink / raw)
To: Matt Flax; +Cc: sox-devel
Matt Flax <flatmax@flatmax.org> writes:
> On 06/07/16 17:29, Eric Wong wrote:
>> I'm not up-to-date with the latest technology, but even 32-bit
>> is far beyond the range of human hearing; and last I checked;
>> available ADC/DACs can't even make full use of 24-bit (nor
>> our ears).
> 120 dB SPL (threshold of discomfort) is around 20 billion times louder
> then 20 dB SPL (a whisper). That is approximately 24 bits.
> However, we can hear down to 10 dB SPL, or lower for young people ...
> that is approximately 40 bits of dynamic range.
120 dB is outright painful and damages the ears. 100 dB is already
unpleasant.
You should also check your calculations. With your limits, the required
dynamic range would be 110 dB, which comes out to 20 bits with a bit of
margin.
--
Måns Rullgård
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 64bit audio read and write
2016-07-06 11:41 ` Måns Rullgård
@ 2016-07-06 12:16 ` Matt Flax
2016-07-06 12:22 ` Måns Rullgård
0 siblings, 1 reply; 7+ messages in thread
From: Matt Flax @ 2016-07-06 12:16 UTC (permalink / raw)
To: Måns Rullgård; +Cc: sox-devel
On 06/07/16 21:41, Måns Rullgård wrote:
> Matt Flax <flatmax@flatmax.org> writes:
>
>> On 06/07/16 17:29, Eric Wong wrote:
>>> I'm not up-to-date with the latest technology, but even 32-bit
>>> is far beyond the range of human hearing; and last I checked;
>>> available ADC/DACs can't even make full use of 24-bit (nor
>>> our ears).
>> 120 dB SPL (threshold of discomfort) is around 20 billion times louder
>> then 20 dB SPL (a whisper). That is approximately 24 bits.
>> However, we can hear down to 10 dB SPL, or lower for young people ...
>> that is approximately 40 bits of dynamic range.
> 120 dB is outright painful and damages the ears. 100 dB is already
> unpleasant.
>
> You should also check your calculations. With your limits, the required
> dynamic range would be 110 dB, which comes out to 20 bits with a bit of
> margin.
>
http://www.nal.gov.au/images/diagram-of-noise.jpg
Anything above 75 dB SPL has potential to damage your hearing,
depending on exposure time. The fact that we can hear with clarity over
such large dynamic range is extraordinary isn't it !
I think the point I am making is that you can't capture 64 bit words of
data in audio files with only 32 bit word reads/writes from file. I
wasn't aware that sox didn't have any methods for 64 bit audio data file
read and writes. From a pure data perspective, no qualms right ?
Matt
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 64bit audio read and write
2016-07-06 12:16 ` Matt Flax
@ 2016-07-06 12:22 ` Måns Rullgård
0 siblings, 0 replies; 7+ messages in thread
From: Måns Rullgård @ 2016-07-06 12:22 UTC (permalink / raw)
To: Matt Flax; +Cc: sox-devel
Matt Flax <flatmax@flatmax.org> writes:
> On 06/07/16 21:41, Måns Rullgård wrote:
>> Matt Flax <flatmax@flatmax.org> writes:
>>
>>> On 06/07/16 17:29, Eric Wong wrote:
>>>> I'm not up-to-date with the latest technology, but even 32-bit
>>>> is far beyond the range of human hearing; and last I checked;
>>>> available ADC/DACs can't even make full use of 24-bit (nor
>>>> our ears).
>>> 120 dB SPL (threshold of discomfort) is around 20 billion times louder
>>> then 20 dB SPL (a whisper). That is approximately 24 bits.
>>> However, we can hear down to 10 dB SPL, or lower for young people ...
>>> that is approximately 40 bits of dynamic range.
>> 120 dB is outright painful and damages the ears. 100 dB is already
>> unpleasant.
>>
>> You should also check your calculations. With your limits, the required
>> dynamic range would be 110 dB, which comes out to 20 bits with a bit of
>> margin.
>>
> http://www.nal.gov.au/images/diagram-of-noise.jpg
> Anything above 75 dB SPL has potential to damage your hearing,
> depending on exposure time. The fact that we can hear with clarity
> over such large dynamic range is extraordinary isn't it !
I tend to think it's a natural result of evolution in an environment
where those sound levels occur regularly.
> I think the point I am making is that you can't capture 64 bit words
> of data in audio files with only 32 bit word reads/writes from file. I
> wasn't aware that sox didn't have any methods for 64 bit audio data
> file read and writes. From a pure data perspective, no qualms right ?
Adding support for some file format with 64-bit samples is easy if you
accept truncating the values to 32 bits on read and padding on write.
--
Måns Rullgård
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 64bit audio read and write
2016-07-06 0:02 64bit audio read and write Matt Flax
2016-07-06 7:29 ` Eric Wong
@ 2016-09-19 21:20 ` Jan Stary
1 sibling, 0 replies; 7+ messages in thread
From: Jan Stary @ 2016-09-19 21:20 UTC (permalink / raw)
To: sox-devel
On Jul 06 10:02:34, flatmax@flatmax.org wrote:
> I currently use libsox to load and save audio data. I was wanting to
> write and read 64bit data, however the generic sox sample type is 32 bit
> (from sox.h) :
> typedef sox_int32_t sox_sample_t;
If all you need to do is read and write samples,
you might be better off with libsndfile.
http://www.mega-nerd.com/libsndfile/api.html
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-09-19 21:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-06 0:02 64bit audio read and write Matt Flax
2016-07-06 7:29 ` Eric Wong
2016-07-06 9:57 ` Matt Flax
2016-07-06 11:41 ` Måns Rullgård
2016-07-06 12:16 ` Matt Flax
2016-07-06 12:22 ` Måns Rullgård
2016-09-19 21:20 ` Jan Stary
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).