How to add metadata to a wav file?

I am looking for sample code to show me how to add metadata to the wav files we create. Is anyone

+6
metadata wav
source share
4 answers

One option is to add your own piece with a unique identifier. Most WAV players ignore this.

Another idea is to use the labl fragment associated with the que set at the beginning or end of the file. You will also need a piece of que . See link here

How to write data is simple

  • Write "RIFF" .
  • save file position.
  • Write 4 bytes 0
  • Write all existing pieces. Keep the number of bytes written.
  • Add your piece. Do not forget to get right. Keep the number of bytes written.
  • rewind to the saved position. Write the new size (as a 32-bit number).
  • Close the file.

This is a little trickier if you add things to an existing list fragment, but the same principle applies.

+1
source share

Try the code below

 private void WaveTag() { string fileName = "in.wav"; WaveReadWriter wrw = new WaveReadWriter(File.Open(fileName, FileMode.Open, FileAccess.ReadWrite)); //removes INFO tags from audio stream wrw.WriteInfoTag(null); //writes INFO tags into audio stream Dictionary<WaveInfo, string> tag = new Dictionary<WaveInfo, string>(); tag[WaveInfo.Comments] = "Comments..."; wrw.WriteInfoTag(tag); wrw.Close(); //reads INFO tags from audio stream WaveReader wr = new WaveReader(File.OpenRead(fileName)); Dictionary<WaveInfo, string> dir = wr.ReadInfoTag(); wr.Close(); if (dir.Count > 0) { foreach (string val in dir.Values) { Console.WriteLine(val); } } } 

from http://alvas.net/alvas.audio,articles.aspx#id3-tags-for-wave-files

+1
source share

If you look at the specification of the wave file , you will see that there is no room for annotations of any type. The option would be to wrap the wave file in your own format that contains custom information, but you will actually create a completely new format that will not be readable to users who do not have your application. But you can be fine.

0
source share

Perhaps the nist file format will give you what you want: NIST

Here is a lib that might help, but I'm afraid it looks old. Nist lib

I can’t find more useful information right now, how exactly to use it, and I'm afraid that the information documents from my company should remain there. L /

0
source share

All Articles