Noxymon
Noxymon

Reputation: 211

Converting WAV to M4A using c# NAudio

I want to convert a WAV file into a M4A file.

I could not find any reference or any example of how to achieve that. Naudio should do the trick i assume, but i havent figured out how to do this yet.

I am writing a WebAPI2 project, and i need to return an m4a audio file to the user upon request. Been using a PushStreamContent in order to provide the user with the file, but using an MP3 as the conversion target, lead to many difficulties with browser support and Seek/Pause/Stop support.

Thanks in advance,
Nokky.

Upvotes: 2

Views: 2448

Answers (1)

Mark Heath
Mark Heath

Reputation: 49482

M4A files simply contain AAC encoded audio. Have a look at the Media Foundation Encoder demo in the NAudio WPF demo application to see an example of using MediaFoundationEncoder to create AAC files. It will let you encode as aac if you have an appropriate Media Foundation Codec on your machine (you should have with Win 7 and above, although note that it doesn't do low bitrates).

Upvotes: 4

Related Questions