Audacity Wav File

Where in the open-source code is the main portion regarding the creation of the Wav file. I want to optimize the wav file format.


See here for information about the format specification:

Is there a simple way to add my own customizable WAV chunk? I want to add it between the header and the data.

What do you want to add?
Does it have to be a WAV file?

I’m trying to add some embedded information that is read from a device. It does need to be a WAV file, unfortunately :frowning:

Audacity is able to embed some text data using the Metadata editor:
That’s as far as it goes in Audacity.
Beyond that, you could use a “hex editor” to manually edit the file, but that is definitely not “simple”.

I think this will need to go in src\export\ExportPCM.cpp. Look at the history of that file on GitHub and at what changes to other files (if any) were made in those commits.

That should give you the idea.


Just so you know:

The chunk will have the following format:
CAL1 is the chunk identifier per the WAV specification. It is a 4 byte item
LLLL is the chunk length per the WAV specification. It is a 4 byte integer and defines the
length of the rest of the chunk.
MMMMMM is the model number. It will be set to 333D01 for this sensor. A decoding
application should confirm the model number data is ‘333D01’ because the
chunk identifiers are uncontrolled. As far as we are aware, ‘CAL1’ is unused but
this is an important cross check to avoid invalid data.
s Spaces to pad the model number to an even multiple of 4 bytes.
formatted as defined above. Note: This format
can also be created from the Model number information with some slight
rearranging of the data if that is the most convenient to implement.
Add the necessary spaces so the chunk is a multiple of 4 bytes in

This is what I plan on doing.

Thank you for all of your help, in advance :smiley:

You can add what you like as long as you retain the open source licensing, but no developers hang out here, so you are asking in the wrong place for detailed help.

If the question is not about how to modify the Audacity code but about how to write your chunk in the correct way, perhaps try the Hydrogenaudio forum.