Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new audio format #8

Closed
AnthonyKoueik opened this issue Sep 15, 2016 · 9 comments
Closed

new audio format #8

AnthonyKoueik opened this issue Sep 15, 2016 · 9 comments
Labels

Comments

@AnthonyKoueik
Copy link

can this app support other formats, like mp3, AAC ... ?

@adrielcafe
Copy link
Owner

adrielcafe commented Sep 15, 2016

Hi @AnthonyKoueik,

You're lucky! I've made a lib for that yesterday. Please check AndroidAudioConverter.

After the recording finish, you can convert WAV to AAC, MP3, M4A, WMA and FLAC:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == 0) {
        if (resultCode == RESULT_OK) {
            // Great! User has recorded and saved the audio file
            // Now you can convert it
            AndroidAudioConverter.with(MyActivity.this)
                .setFile(myWavFile) 
                .setFormat(AndroidAudioConverter.AudioFormat.MP3)
                .setCallback(callback)
                .convert();
        } else if (resultCode == RESULT_CANCELED) {
            // Oops! User has canceled the recording
        }
    }
}

Please let me know if this solve your problem.

@AnthonyKoueik
Copy link
Author

that's amazing, but i want to ask if this affect the size?
like aac format files a usually small and fine quality.
anyway i will try it out now.
awesome work

@adrielcafe
Copy link
Owner

Yes, the size reduce a lot with AAC, MP3, M4A and WMA formats.
I've made a quick test: an WAV file with 10s has ~500KB, while any format above has less than 60KB.

⚠️ Because I've made AndroidAudioConverter with FFmpeg lib my lib has ~20MB 😞 . I'm looking for alternatives to reduce the lib size.

@AnthonyKoueik
Copy link
Author

I didn't read your Audio Recorder code, can't I change it to aac output ?

@adrielcafe
Copy link
Owner

I'm using OmRecorder lib to record audio. Currently it does't support other formats.

@adrielcafe adrielcafe mentioned this issue Sep 20, 2016
@1sMcGrady
Copy link

i'm stucked with a "FFmpeg not loaded" Exception , can you help me with this? thx ~

@MarsDiplomatToEarth
Copy link

how can i get the time of my audio file

@Mathias8405
Copy link

Mathias8405 commented Mar 21, 2022

The library loads just fine for me, but I can not get it to convert files. All converts failed. I am not sure if it's because of the new scoped storage method for apps with api 29 and up or what the issue is. ActivityForResult is depreciated, and with the new method it still doesn't work. Hey Adrielcafe, will you please give us an update that works with Android 12 api 32, and the new ActivityForResult launcher method, and with the new scoped storage. Thanks!

@Mathias8405
Copy link

If anyone wants to try and fix the project that I started and see if you can get this to work go ahead. Download it here https://file.io/ds6UHOxV4yns

If you get it to work please send the fixed project to my email rockdrummer84@gmail.com Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants