|
Chrispy
High-performance multichannel ADC sampling and audio recording.
|
Header of a standard PCM WAV file. More...
#include <WavHeader.h>
Public Member Functions | |
| void | fill (BitResolution res, uint32_t file_size, uint32_t sample_rate) |
| Fill in WAV header fields once all details are known. | |
Data Fields | |
| const char | chunk_id [4] = {'R', 'I', 'F', 'F'} |
| RIFF chunk identifier ("RIFF"). | |
| uint32_t | chunk_size = 36 |
| Size of (entire file in bytes - 8 bytes) or (data size + 36) Gets rewritten after data is fully written to file. | |
| const char | format [4] = {'W', 'A', 'V', 'E'} |
| Format identifier (always "WAVE"). | |
| const char | subchunk_id [4] = {'f', 'm', 't', ' '} |
| Subchunk ID (always "fmt "). | |
| const uint32_t | subchunk_size = 16 |
| Size of the "fmt " subchunk (always 16). | |
| const uint16_t | audio_format = 1 |
| Audio format code (PCM = 1). | |
| const uint16_t | num_channels = 1 |
| Number of channels. | |
| uint32_t | sample_rate = 0 |
| Sampling rate in hertz (samples per second). | |
| uint32_t | byte_rate = 0 |
| Byte rate. | |
| uint16_t | block_align = 2 |
| Byte alignment of each sample. | |
| uint16_t | bits_per_sample |
| Number of bits per sample. | |
| const char | sub_chunk_2_id [4] = {'d', 'a', 't', 'a'} |
| Subchunk 2 ID. | |
| uint32_t | sub_chunk_2_size = 0 |
| Size of data chunk. | |
Header of a standard PCM WAV file.
Struct contains the metadata in a WAV header in the order it must appear. Must be filled with information specific to a given recording instance before being written.
| void WavHeader::fill | ( | BitResolution | res, |
| uint32_t | file_size, | ||
| uint32_t | sample_rate | ||
| ) |
Fill in WAV header fields once all details are known.
| res | Bit resolution of samples. |
| file_size | Size in bytes of the recording file. |
| sample_rate | Sample rate in hertz of audio recording. |
| const uint16_t WavHeader::audio_format = 1 |
Audio format code (PCM = 1).
| uint16_t WavHeader::bits_per_sample |
Number of bits per sample.
Rounded to next byte-increment, so 10-bit or 12-bit audio would both become 16-bit.
| uint16_t WavHeader::block_align = 2 |
Byte alignment of each sample.
NumChannels * BitsPerSample / 8
| uint32_t WavHeader::byte_rate = 0 |
Byte rate.
SampleRate * NumChannels * BitsPerSample / 8.
| const char WavHeader::chunk_id[4] = {'R', 'I', 'F', 'F'} |
RIFF chunk identifier ("RIFF").
| uint32_t WavHeader::chunk_size = 36 |
Size of (entire file in bytes - 8 bytes) or (data size + 36) Gets rewritten after data is fully written to file.
| const char WavHeader::format[4] = {'W', 'A', 'V', 'E'} |
Format identifier (always "WAVE").
| const uint16_t WavHeader::num_channels = 1 |
Number of channels.
1 = Mono, 2 = Stereo With the current implementation, each recording gets its own file and thus makes this mono.
| uint32_t WavHeader::sample_rate = 0 |
Sampling rate in hertz (samples per second).
Filled in later.
| const char WavHeader::sub_chunk_2_id[4] = {'d', 'a', 't', 'a'} |
Subchunk 2 ID.
Always "data".
| uint32_t WavHeader::sub_chunk_2_size = 0 |
Size of data chunk.
NumSamples * NumChannels * BitsPerSample/8
| const char WavHeader::subchunk_id[4] = {'f', 'm', 't', ' '} |
Subchunk ID (always "fmt ").
| const uint32_t WavHeader::subchunk_size = 16 |
Size of the "fmt " subchunk (always 16).