May-14-2019, 07:41 AM
Hi,
I got tons of rf64 audio files.
I try to parse the meaning of each field from the header with not much success.
here is the header of such file:
and a comparison to a regular wav:
![[Image: rf64-vs-wav.png]](https://samplerateconverter.com/sites/default/files/u1/rf64-vs-wav.png)
And this is how I tried to extract for instance the sample rate:
The documentation says that the sampleRate is an integer, which is 4 bytes, that's why I count from 13-17.
I tried mapping different fields, but it never gives me back a normal sample rate.
DO you guys have any working solution to parse these new type of wav's header?
Thanks
I got tons of rf64 audio files.
I try to parse the meaning of each field from the header with not much success.
here is the header of such file:
Quote: struct FormatChunk5 // declare FormatChunk structure
{
char chunkId[4]; // 'fmt '
unsigned int32 chunkSize; // 4 byte size of the 'fmt ' chunk
unsigned int16 formatType; // WAVE_FORMAT_PCM = 0x0001, etc.
unsigned int16 channelCount; // 1 = mono, 2 = stereo, etc.
unsigned int32 sampleRate; // 32000, 44100, 48000, etc.
unsigned int32 bytesPerSecond; // only important for compressed formats
unsigned int16 blockAlignment; // container size (in bytes) of one set of samples
unsigned int16 bitsPerSample; // valid bits per sample 16, 20 or 24
unsigned int16 cbSize; // extra information (after cbSize) to store
char extraData[22]; // extra data of WAVE_FORMAT_EXTENSIBLE when necessary
};
and a comparison to a regular wav:
![[Image: rf64-vs-wav.png]](https://samplerateconverter.com/sites/default/files/u1/rf64-vs-wav.png)
And this is how I tried to extract for instance the sample rate:
import struct audio_file = open("audio.aac", 'rb') wavHeader = audio_file.read(38) HeaderFields = { 'chunkId': 0, 'sampleRate': 0 } HeaderFields['sampleRate'] = struct.unpack('<i', wavHeader[13:17]) print(wavHeader) print(HeaderFields) audio_file.close()My output is on a sample wav:
Quote:b'\xff\xf9`@\x1f\x7f\xfc\x01.5\xa0\xd6Dq5\n\x01oQ?\x7f\xe2\x7f\xb7\xf5\xdc\xa4\x08\x10A\x02\x008\xbb\xc3\x8a/J'
{'chunkId': 0, 'sampleRate': (17446257,)}
The documentation says that the sampleRate is an integer, which is 4 bytes, that's why I count from 13-17.
I tried mapping different fields, but it never gives me back a normal sample rate.
DO you guys have any working solution to parse these new type of wav's header?
Thanks