I have a bytearray that holds an wav audio stream.
Is there a way on android system to convert the wav file to a flac file?
I found some example code from FlacEncoder library but this library assumes as far as I see the use of some audio classes from javax.
These are not available on android.
Is there some other library or some example code for android?
Thanks!
Related
I have an audio file in WAV format. I suppose to decode the binary data encoded in the file. The data is encoded using Audio Frequency Shift-Keying (AFSK).
The technology is used for communication systems such asĀ garage door opener.
I am beginner in that, so I am not sure which library should I use to decode the file which is encoded using AFSK.
Is there any library available for Android?
You might want to try android-fskmodem or any other FSK library.
I declared the pathname of my mp3 audio file in my code as var pathname: String = "/..../file.mp3" (It's saved correctly, I can listen to it).
Can I convert that file to an Opus audio file? Thank you very much
I don't know about that specific error, but the Supported Media Formats page says Opus is only supported in Android 5.0+, and then only in the matroska container.
Make sure you're testing on newer Android, and you may need to demux manually to feed raw packets to the decoder.
If you need Opus support everywhere you can include the C library in your app and call it directly over JNI.
I am using Lame library to convert pcm file to mp3 in android.
using this link I compiled it and every thing is ok.
but I don't know how to use this library to convert .Pcm file to .Mp3 in android studio.
any sample code or any hint would be appreciated
This is an example: https://github.com/intervigilium/Lame4Android/blob/master/src/com/intervigil/lame/Main.java
It seems that you need to do a Lame object and onActivityResult do the conversion of the file or see this as a possible duplicated question: https://stackoverflow.com/a/34322713/6848782
There seem to be a lot of questions regarding the inverse wav to mp3 conversion, but none to go the other way. My situation is that I can use steganography to embed data in wav files. I can convert these to ogg and back (the steganography is format independent, and can survive format conversion). What I want to do now is build in AudioBoo integration. Uploading to AudioBoo is not a problem, retrieving the files in mp3 format is not a problem, but converting those mp3 files back to wav to perform the steg. extraction is. Does anyone know where I should start?
Check out JLayer. It should run on Android. Beware, some of the calls are synchronized. If this doesn't work, tweak the source code or extract the converter modules from the entire source, since all you need is the mp3 to wav converter, not the mp3 player.
I'm trying to use the AudioRecord class to record a WAV file. The problem is that it only supplies the raw PCM data, and if I write it to a file, there is no header information, so it will not play in any media player. How can I create a WAV file from this raw data?
Or alternatively, is there any other way to record sound in Android to a WAV file (or, alternatively MP3)?
Oh, and I know that MediaRecorder can'y be used because it doesn't support either WAV or MP3 formats.
OK, I've got this figured out. This post was crucial in helping me:
http://computermusicblog.com/blog/2008/08/29/reading-and-writing-wav-files-in-java
Basically, I used ByteArrayOutputStream to write the raw PCM data from AudioRecord, which then lets me get the byte array and its size when the process is done. I can then use that data in conjunction with the SampleRate, BitRate, and Stereo/Mono settings to create the WAV header as per the link above. The resulting file works perfectly!
Check the MediaRecorder.setOutputFormat(), you can set different container formats for your recording; there is MediaRecorder.OutputFormat.MPEG_4 and MediaRecorder.OutputFormat.THREE_GPP; the only allowed format along RAW is setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
Sorry but MP3 is not avail. You really need mp3 for recording?
WAV on the opposite of MP3 is a container, not a format; WAV can be any kind of encoding format.
You are always free to prepend some WAV RIFF header in front of your raw pcm data (as long as you exactly know the format). Check here for how it has to look like:
http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html
You may want to use mediarecord class