Search code examples
c#wavnaudioimovie

Naudio 'NoDriver calling acmFormatSuggest' error on wav exported with imovie


I am trying to convert a .wav to an .mp3 file. My code usually works but now I have gotten a .wav file that was exported with Imovie and I get the error 'NoDriver calling acmFormatSuggest'.

The internet suggest my machine is missing a codec. But if I run the file, my machine is able to play the file with standard windows media player, so I guess it is on my machine.

When I put the file into https://www.metadata2go.com/ I can see that the problematic file has the codec pcm_s24le with a sample rate of 48000.

When I create a file with the same codec pcm_s24le but with a sample rate of 44100 the code does not trigger this error. So the problem seems to lie in the combination codec - sample rate.

Naudio's github page refers to this page with guides to fix the error. it says under option 5 (i'm only playing back a wav file in my example)

What you need to do is search the web for an ACM codec that can decode the format you are using. Unfortunately this is not always a simple process,

It does unfortunately not provide any help on how or where to find these codecs. And, as I'm able to playback the file and the same codec with a different sample rate works fine, I'm also not sure this is the actual problem.

My code runs on a Windows 11 pro v21H2.

The following basic code (this is not my conversion code) throws the error

var outputDevice = new WaveOutEvent();
var audioFile = new AudioFileReader(path);
outputDevice.Init(audioFile);
outputDevice.Play();

Opening up the wav file and saving it with a different sample rate seems to solve the problem, but that is manual labor I would rather do without, since there are potentially a lot of files to convert in my case.

Any ideas would be appreciated.


Solution

  • It looks like Naudio has components to do the resampling of .WAV files, as noted on this page: How to Resample Audio with NAudio.