It decodes these encoded mp3s with no problems.Įncoding wav files with different sample rates and mono wav files generally produces the expected encoded mp3, but trying to decode that mp3 tends to fail, read on.ĭecoding mp3s that have been encoded with a different encoder produces very unpredictable results. It encodes stereo 44100Hz 16 bit wav files to mp3 with no problems. ![]() Now you can compare the original wav file with the new wav file. The code copies a non-existent wav file from assets to external memory, to keep the attachment size down i have not included any wav file for you to test with.Ĭlick the Encode button and wait while the wav file is encoded to mp3, you can then click the Decode button and wait while that mp3 file is decoded back to wav format. Sub LameEncoder_EncodeComplete(Success As Boolean) Sub LameDecoder_DecodeComplete(Success As Boolean) Log("An error occurred while calling LameEncoder.SetFiles") ' LameEncoder.SetQuality(LameEncoder.LAME_PRESET_STANDARD) ' adjust to suit If LameEncoder.SetFiles(File.Combine(File.DirRootExternal, "file_to_encode.wav"), File.Combine(File.DirRootExternal, "encoded_file.mp3")) Then Log("An error occurred while calling LameDecoder.SetFiles") If LameDecoder.SetFiles(File.Combine(File.DirRootExternal, "encoded_file.mp3"), File.Combine(File.DirRootExternal, "decoded_file.wav")) Then Sub Activity_Pause (UserClosed As Boolean) If File.Exists(File.DirRootExternal, "file_to_encode.wav")=False Thenįile.Copy(File.DirAssets, "file_to_encode.wav", File.DirRootExternal, "file_to_encode.wav")Īctivity.AddView(DecodeButton, 0, 0, 100%x, 75dip)Īctivity.AddView(EncodeButton, 0, 75dip, 100%x, 75dip) ' ** the example project does NOT contain file_to_encode.wav ** Sub Activity_Create(FirstTime As Boolean) The Encoder will default to Quality of Encoder.LAME_PRESET_DEFAULT. ![]() Set the source wav and destination mp3 file names. Initialize the Encoder with an event name. The event EncodeComplete(Success As Boolean) will be raised on completion. Set the source mp3 and destination wav file names. SetFiles (InputFilename As String, OutputFilename As String) As Boolean. ![]() Initialize the Decoder with an event name. The event DecodeComplete(Success As Boolean) will be raised on completion. The library is pretty simple to use, it adds a liblameDecoder object and a liblameEncoder object to your project:
0 Comments
Leave a Reply. |