Skip to content

Support for foreign metadata RIFF chunks #49

@kmturley

Description

@kmturley

Wave files can contain unofficial metadata, such as Sampler Chunk - "smpl":
https://sites.google.com/site/musicgapi/technical-documents/wav-file-format#smpl

These are used for audio looping players and samplers avoiding to loading multiple samples.

I have one such file here:
https://github.com/studiorack/basic-harmonica/blob/bf42d5bab7470cc201e3c4b6dee7925b19db6bff/samples/harmonica_1.wav

and a flac file converted using the official flac command line tool:
flac harmonica_1.wav --keep-foreign-metadata

When inspecting with exiftool it shows the RIFF metadata was copied:

$ exiftool harmonica_1.flac -G1

[RIFF]          Encoding                        : Microsoft PCM
[RIFF]          Num Channels                    : 1
[RIFF]          Sample Rate                     : 48000
[RIFF]          Avg Bytes Per Sec               : 96000
[RIFF]          Bits Per Sample                 : 16
[RIFF]          Manufacturer                    : 0
[RIFF]          Product                         : 0
[RIFF]          Sample Period                   : 20833
[RIFF]          MIDI Unity Note                 : 64
[RIFF]          MIDI Pitch Fraction             : 0
[RIFF]          SMPTE Format                    : none
[RIFF]          SMPTE Offset                    : 00:00:00:00
[RIFF]          Num Sample Loops                : 1
[RIFF]          Sampler Data Len                : 0
[RIFF]          Sampler Data                    : (Binary data 20 bytes, use -b option to extract)
[RIFF]          Unshifted Note                  : 64
[RIFF]          Fine Tune                       : 0
[RIFF]          Gain                            : 0
[RIFF]          Low Note                        : 0
[RIFF]          High Note                       : 127
[RIFF]          Low Velocity                    : 0
[RIFF]          High Velocity                   : 127
[RIFF]          Acidizer Flags                  : One shot
[RIFF]          Root Note                       : High C
[RIFF]          Beats                           : 2
[RIFF]          Meter                           : 4/4
[RIFF]          Tempo                           : 0
[RIFF]          Comment                         : Recorded on 7/10/2022 in Edison.
[RIFF]          Software                        : FL Studio 20
[Composite]     Duration                        : 0.87 s

I have tried all the metadata types in your bindings, but none appear to support the RIFF chunks:

new flac.FileEncoder({
  file: output || 'out.flac',
  compressionLevel: 9,
  metadata: [new metadata.ApplicationMetadata(), new metadata.PaddingMetadata(), new metadata.SeekTableMetadata(), new metadata.UnknownMetadata(), new metadata.VorbisCommentMetadata()]
})

How can I get this to work? Happy to submit a PR

Using flac-bindings v2.7.2 as I want my library to have backwards compatibility for CommonJS.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions