Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
rf64 audio files
#1
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:
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]

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
Reply


Messages In This Thread
rf64 audio files - by kerzol81 - May-14-2019, 07:41 AM
RE: rf64 audio files - by buran - May-14-2019, 07:51 AM
RE: rf64 audio files - by kerzol81 - May-14-2019, 08:45 AM
RE: rf64 audio files - by buran - May-14-2019, 09:08 AM
RE: rf64 audio files - by kerzol81 - May-14-2019, 11:50 AM
RE: rf64 audio files - by buran - May-14-2019, 12:31 PM
RE: rf64 audio files - by kerzol81 - May-14-2019, 01:11 PM
RE: rf64 audio files - by buran - May-14-2019, 01:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Other modules for reading audio files? jedzz 0 2,009 Mar-25-2020, 11:07 PM
Last Post: jedzz
  Computing correlation in audio files ryanblumenow 0 3,585 Jan-15-2020, 06:11 PM
Last Post: ryanblumenow
  Analyse audio files, not sure where to start floatingshed 1 2,780 Jun-29-2018, 02:58 PM
Last Post: floatingshed

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020