2

I'm new to audio programming and I'm using NAudio to convert an mp3 file on my web application backend. The NAudio conversion is handled within an ApiController. When I run my application locally the file converts as it should, however when I publish the website to Azure I get an error. I debugged the site and saw that the error was being thrown when reading in the file.

Mp3FileReader reader = new Mp3FileReader(filePath);

I get the error NoDriver calling acmFormatSuggest. This is just with reading in the file even before the conversion.

I have searched online for the error but none of the answers solve my problem. I tried the solution provided here amongst others but none seem to work for my issue.

Can anyone provide me with a reason as to why this would work on my local IIS website but not on my azure website? And how can I fix this issue?

Community
  • 1
  • 1
Keisha W
  • 686
  • 6
  • 17

2 Answers2

1

For future readers, the NAudio conversion did not work for me on both the Azure website and the Azure web role. I ended up using the CloudConvert api and a .NET Wrapper to do the audio conversions. This worked great!

There is however an increased cost for uploading a greater number of files.

Keisha W
  • 686
  • 6
  • 17
0

According to that post

WaveFormatConversionStream makes use of the ACM codecs installed on your machine. It starts by asking if there is any ACM codec installed that can convert from the source to the target format. It would seem that you are missing an MP3 codec on the target machine.

That answers the question right there. There are no ACM codecs installed in your Azure Web App by default. Azure Web App is not running on a full version of Windows like you are running locally.

Your other option according to this post is to deploy using an Azure Web Role and custom startup script.

Automatically (Azure deployments):

Add these commands to a Startup.cmd startup task in Azure for your role:

> echo Begin Install Desktop Experience Feature (for sound codec) >>
> startup.log ServerManagerCMD.exe -install Desktop-Experience -restart
> -resultPath     desktopexperience_results.xml REM This return code indicates the feature is already installed. Reset the errorlevel to
> zero using the verify command. IF %ERRORLEVEL% EQU 1003 (
>     echo Windows feature is already installed >> startup.log
>     VERIFY > NUL ) echo End Install Desktop Experience Feature >> startup.log 

Note that it is important this script returns a result

code (%ERRORLEVEL%) of zero (which the above will do, bar any actual problems).

The ServerManagerCMD will return a non-zero error code when it does not need to install the feature (perhaps because it was already installed from a previous Startup.cmd run), so we explicitly need to check for that code (1003) and silence it using VERIFY >

Community
  • 1
  • 1
Joe Raio
  • 1,795
  • 1
  • 12
  • 17
  • Where would I do this deployment on an Azure website? I am not using an Azure Web Role, I am using an Azure website which is different? – Keisha W Aug 24 '15 at 23:37
  • Hi, Create a cloud service using Visual Studio and then add a web role to that cloud service. Instructions below https://msdn.microsoft.com/en-us/library/azure/ee405487.aspx – Joe Raio Aug 25 '15 at 16:40
  • Just confirming, you're saying my only option is to change to a web role? A website can't be used? – Keisha W Aug 25 '15 at 16:44
  • Based on the information you provided and the what I found as well, an azure web app will not work. A web role is required at minimum but I cannot guarantee that will work but you may have success. Let me know if it works. I'm curious to findout. – Joe Raio Aug 25 '15 at 17:01
  • Did you get a chance to try using the web role? If so did it work out for you? – Joe Raio Aug 28 '15 at 14:41
  • I only got a chance to try it today and the web role still did not work for me. – Keisha W Aug 29 '15 at 00:06