问题
I need to write a utility in c# that uses Google Speech Api to convert speech from an audio file into text. As far as I know, Google only accepts .flac format for this api. Unfortunately, I have .wav and .mp3 audio files. So I am trying to find out if there is a way for me to convert mp3 to flac in .NET. I looked at NAudio, but it doesn't seem to be working with flac files.
回答1:
I ended up using Gregory S. Chudov's C# implementation of FLAKE encoder. You can find more information at http://www.hydrogenaudio.org/forums/index.php?showtopic=74242
There is another project on BitBucket that uses CUETools FLAKE in its Google Speech Api wrapper. It is a good starting point for implementing speech to text using Google speech api. You can find it at https://bitbucket.org/josephcooney/cloudspeech
I was able to convert wav to flac without much difficulty using the FLAKE encoder. Hope this helps you.
回答2:
Take a look at http://naudio.codeplex.com/
NAudio is an open source .NET audio and MIDI library, containing dozens of useful audio related classes intended to speed development of audio related utilities in .NET. It has been in development since 2002 and has grown to include a wide variety of features. While some parts of the library are relatively new and incomplete, the more mature features have undergone extensive testing and can be quickly used to add audio capabilities to an existing .NET application. NAudio can be quickly added to your .NET application using NuGet.
Edit Sadly FLAC is not supported there, as i see in the overview. Try it yourself.
来源:https://stackoverflow.com/questions/17636352/net-how-can-i-convert-an-mp3-or-a-wav-file-to-flac