Skip to content

Feature: SDWriter: Add option to write INFO metadata to header of WAV file #88

@eyuan-creare

Description

@eyuan-creare

SDWriter.h, SDWriter.cpp

Goal

Write channel names and input calibration to the WAV header's INFOComment chunk.

Ref

IBM's specification on the RIFF file format that WAV files use. INFO chunk described on pg-23

Existing Class and Methods for Writing an SD WAV file

Based on Main: 453c98c. Though I will update this to reflect the new 32bitquad branch. I've abbreviated this somewhat.

Writes header when starting a recording, with file size 0:

- AudioSDWriter_F32::startRecording()
  - AudioSDWriter_F32::startRecording(fname)
    - AudioSDWriter_F32::openAsWAV(fname)
      - SDWriter::openAsWAV(fname)
        - SDWriter::wavHeaderInt16(0)
          - SDWriter::wavHeaderInt16(WAV_sampleRate_Hz, WAV_nchan, 0)

Stops recording by rewriting the header with the actual file size.

- AudioSDWriter_F32::stopRecording()
  - AudioSDWriter_F32:close() 
    - SDWriter::close()
      - SDWriter::wavHeaderInt16(fileSize)
        - SDWriter::wavHeaderInt16(WAV_sampleRate_Hz, WAV_nchan, fileSize)

Scope

TBD

Notes

  • Per the RIFF format, the LIST chunk can go anywhere after the FMT chunk. But it seems that some WAV readers prefer it before the data chunk, rather than after.
  • Per the RIFF format, LIST chunk should contain the following fields. I am mostly concerned with the Comment subchunk, but I could provide access to the other subchunks.
    IARL IART ICMS ICMT ICOP ICRD ICRP IDIM IDPI IENG IGNR IKEY ILGT IMED INAM IPLT IPRD ISBJ ISFT ISHP ISRC ISRF ITCH.
  • Not actually part of this scope, but I would like to check if the AudioSDPlayer can handle an INFO chunk after the audio data chunk. I've noticed that some WAV header editors do this.
  • Also check whether writing 3-channel data is handled correctly. Currently, Adobe Audition has no trouble with 3-channel WAV files written by the existing library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions