sox-users@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
* 32 Bit Float Problem
@ 2017-01-16 20:36 Thomas Foerster
  2017-01-17 12:48 ` Måns Rullgård
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Foerster @ 2017-01-16 20:36 UTC (permalink / raw)
  To: sox-users


[-- Attachment #1.1: Type: text/plain, Size: 1157 bytes --]

Hi,

I am a little bit confused about the following procedure (Windows). What 
is wrong?

1. Take a usual 2ch/16 Bit/44,1 kHz WAV-File (CD)
2. To get a 32 Bit FLOAT 88200 Hz File:
sox input_16_44100.wav" -b 32 -e float output_88200_32F.wav rate -s -a 
-v -L 88200
3. sox output_88200_32F.wav output_88200_32F.raw

The *.raw file has 58 bytes less-> the Wav-Float-Header has a size of 58 
bytes. My own codecannot read this header in Audio format 3 (only 
wav-PCM and Extensible like 24 Bit Wav and 32 Bit Wav). I looked inside 
with Hex-Editor:

-4 byte fact-chunk is beginning at byte 38
-4 byte data-chunk is beginning at byte 50 ("usually" before fact-chunk)

I could not read the size of the raw-data-chunk (raw data length). 
Theses bytes are at the end of the header. Here(hex): 00 00 D8 0E -> 
55310 bytes, what is wrong!
It should be (dec:) 249036800bytes! This would be 0E D8 00 00 -> most 
significant bit!

Then I tried this:
sox.exe -r 88200 -e float -b 24 -c 2output_88200_32F.raw out.wav
Error!
This would be working (but makes no sense...):
sox.exe -r 88200 -e signed-integer -b 24 -c 2output_88200_32F.raw out.wav

Any idea?

Regards
Thomas

[-- Attachment #1.2: Type: text/html, Size: 18093 bytes --]

[-- Attachment #2: Type: text/plain, Size: 202 bytes --]

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 32 Bit Float Problem
  2017-01-16 20:36 32 Bit Float Problem Thomas Foerster
@ 2017-01-17 12:48 ` Måns Rullgård
  2017-01-17 17:02   ` Måns Rullgård
  0 siblings, 1 reply; 4+ messages in thread
From: Måns Rullgård @ 2017-01-17 12:48 UTC (permalink / raw)
  To: Thomas Foerster; +Cc: sox-users

Thomas Foerster <tjfoerster@web.de> writes:

> Hi,
>
> I am a little bit confused about the following procedure
> (Windows). What is wrong?
>
> 1. Take a usual 2ch/16 Bit/44,1 kHz WAV-File (CD)
> 2. To get a 32 Bit FLOAT 88200 Hz File:
> sox input_16_44100.wav" -b 32 -e float output_88200_32F.wav rate -s -a 
> -v -L 88200
> 3. sox output_88200_32F.wav output_88200_32F.raw
>
> The *.raw file has 58 bytes less-> the Wav-Float-Header has a size of
> 58 bytes. My own codecannot read this header in Audio format 3 (only
> wav-PCM and Extensible like 24 Bit Wav and 32 Bit Wav). I looked
> inside with Hex-Editor:
>
> -4 byte fact-chunk is beginning at byte 38
> -4 byte data-chunk is beginning at byte 50 ("usually" before fact-chunk)
>
> I could not read the size of the raw-data-chunk (raw data
> length). Theses bytes are at the end of the header. Here(hex): 00 00
> D8 0E -> 
> 55310 bytes, what is wrong!
> It should be (dec:) 249036800bytes! This would be 0E D8 00 00 -> most
> significant bit!
>
> Then I tried this:
> sox.exe -r 88200 -e float -b 24 -c 2output_88200_32F.raw out.wav
> Error!
> This would be working (but makes no sense...):
> sox.exe -r 88200 -e signed-integer -b 24 -c 2output_88200_32F.raw out.wav
>
> Any idea?

Can you post a hex dump of the full header?

-- 
Måns Rullgård

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 32 Bit Float Problem
  2017-01-17 12:48 ` Måns Rullgård
@ 2017-01-17 17:02   ` Måns Rullgård
  2017-01-17 18:10     ` Thomas Foerster
  0 siblings, 1 reply; 4+ messages in thread
From: Måns Rullgård @ 2017-01-17 17:02 UTC (permalink / raw)
  To: Thomas Foerster; +Cc: sox-users

Måns Rullgård <mans@mansr.com> writes:

> Thomas Foerster <tjfoerster@web.de> writes:
>
>> Hi,
>>
>> I am a little bit confused about the following procedure
>> (Windows). What is wrong?
>>
>> 1. Take a usual 2ch/16 Bit/44,1 kHz WAV-File (CD)
>> 2. To get a 32 Bit FLOAT 88200 Hz File:
>> sox input_16_44100.wav" -b 32 -e float output_88200_32F.wav rate -s -a 
>> -v -L 88200
>> 3. sox output_88200_32F.wav output_88200_32F.raw
>>
>> The *.raw file has 58 bytes less-> the Wav-Float-Header has a size of
>> 58 bytes. My own codecannot read this header in Audio format 3 (only
>> wav-PCM and Extensible like 24 Bit Wav and 32 Bit Wav). I looked
>> inside with Hex-Editor:
>>
>> -4 byte fact-chunk is beginning at byte 38
>> -4 byte data-chunk is beginning at byte 50 ("usually" before fact-chunk)
>>
>> I could not read the size of the raw-data-chunk (raw data
>> length). Theses bytes are at the end of the header. Here(hex): 00 00
>> D8 0E -> 
>> 55310 bytes, what is wrong!
>> It should be (dec:) 249036800bytes! This would be 0E D8 00 00 -> most
>> significant bit!
>>
>> Then I tried this:
>> sox.exe -r 88200 -e float -b 24 -c 2output_88200_32F.raw out.wav
>> Error!
>> This would be working (but makes no sense...):
>> sox.exe -r 88200 -e signed-integer -b 24 -c 2output_88200_32F.raw out.wav
>>
>> Any idea?
>
> Can you post a hex dump of the full header?

The dump you sent (and please stay on the mailing list) looks fine.

The data chunk size has the bytes 0x00 0x00 0xd8 0x0e, which read as
*little endian* is 0xed80000 or 249036800 in decimal, just like you said
it should be.

All values in wav files are stored as little endian.

-- 
Måns Rullgård

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 32 Bit Float Problem
  2017-01-17 17:02   ` Måns Rullgård
@ 2017-01-17 18:10     ` Thomas Foerster
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Foerster @ 2017-01-17 18:10 UTC (permalink / raw)
  To: Måns Rullgård; +Cc: sox-users

Am 17.01.2017 um 18:02 schrieb Måns Rullgård:
> Måns Rullgård <mans@mansr.com> writes:
>
>> Thomas Foerster <tjfoerster@web.de> writes:
>>
>>> Hi,
>>>
>>> I am a little bit confused about the following procedure
>>> (Windows). What is wrong?
>>>
>>> 1. Take a usual 2ch/16 Bit/44,1 kHz WAV-File (CD)
>>> 2. To get a 32 Bit FLOAT 88200 Hz File:
>>> sox input_16_44100.wav" -b 32 -e float output_88200_32F.wav rate -s -a
>>> -v -L 88200
>>> 3. sox output_88200_32F.wav output_88200_32F.raw
>>>
>>> The *.raw file has 58 bytes less-> the Wav-Float-Header has a size of
>>> 58 bytes. My own codecannot read this header in Audio format 3 (only
>>> wav-PCM and Extensible like 24 Bit Wav and 32 Bit Wav). I looked
>>> inside with Hex-Editor:
>>>
>>> -4 byte fact-chunk is beginning at byte 38
>>> -4 byte data-chunk is beginning at byte 50 ("usually" before fact-chunk)
>>>
>>> I could not read the size of the raw-data-chunk (raw data
>>> length). Theses bytes are at the end of the header. Here(hex): 00 00
>>> D8 0E ->
>>> 55310 bytes, what is wrong!
>>> It should be (dec:) 249036800bytes! This would be 0E D8 00 00 -> most
>>> significant bit!
>>>
>>> Then I tried this:
>>> sox.exe -r 88200 -e float -b 24 -c 2output_88200_32F.raw out.wav
>>> Error!
>>> This would be working (but makes no sense...):
>>> sox.exe -r 88200 -e signed-integer -b 24 -c 2output_88200_32F.raw out.wav
>>>
>>> Any idea?
>> Can you post a hex dump of the full header?
> The dump you sent (and please stay on the mailing list) looks fine.
>
> The data chunk size has the bytes 0x00 0x00 0xd8 0x0e, which read as
> *little endian* is 0xed80000 or 249036800 in decimal, just like you said
> it should be.
>
> All values in wav files are stored as little endian.
>

There is something wrong in my own new code (struct) for this format. I 
wasn't familiar with these ULAW, ALAW formats. My sox-command was also 
wrong. Should be:

sox -r 88200 -b 32 -c 2 -e float output_88200_32F.raw out.wav

Thank you Måns!

Regards
Thomas

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-17 18:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-16 20:36 32 Bit Float Problem Thomas Foerster
2017-01-17 12:48 ` Måns Rullgård
2017-01-17 17:02   ` Måns Rullgård
2017-01-17 18:10     ` Thomas Foerster

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

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).