Search code examples
audiowindows-runtimewavfile-format

AudioGraph created files works in VLC but not elsewhere


I've written a program that produces wav files using the WinRT AudioGraph API.

VLC plays the files fine, and displays the correct length.

But when trying to load the files in python

  • torchaudio, librosa, scipy.io all say the file has no samples
  • wave says "not a WAVE file"

I understand that AudioGraph probably uses a newer wav metadata format designed for streams. Is there same easy work around? like using ffmpeg.

I think maybe the best thing to do is to load raw bytes into pytorch tensor and slice of the metadata.


Solution

  • The AudioGraph API has an AudioFileOutputNode.FinalizeAsync method which solved this problem.

    Previously I was just calling AudioGraph.Close a synchronous method and apparently this wasn't good enough.