Naudio fails to fully read WMA, OGG, and AC3 audio files

274 Views Asked by At

I am unable to fully read the audio contents (all bytes) of a WMA file using NAUDIO.

Here are 2 example WMA audio files that fail...

https://drive.google.com/open?id=1-CxTIOmFCwiPvcoMm_iwl-dybOv680bp https://drive.google.com/open?id=1uirNcYok1BYtL0trgQZHhqHAywW14rOe

My code (simplified)...

Dim myReader As New NAudio.Wave.AudioFileReader(stringAudioFileURL)
Dim myAudioData As Byte(myWaveReader.Length - 1)
myReader.Read(myAudioData, 0, myReader.Length)
If myReader.Position <> myReader.Length Then
    Throw New System.Exception("Failed to read to end of file!")
End If
myReader.Dispose()

With both of the example files provided, the AudioFileReader fails to read to the end (all bytes) of the file (AudioFileReader.Length).

I can open and successfully play both files in the Windows Media Player.

Based on further testing...The same problem occurs in NAUDIO with OGG, and AC3 formatted audio files.

Thanks! Also...Hello and thanks to Mark Heath for NAudio!...A great audio toolset for MS Windows!

0

There are 0 best solutions below