Flutter -Adding Voice Effects to locally saved audio file(.m4a) - Change Pitch, Add Background Music, Change Voice

1.7k Views Asked by At

I'm building a Flutter mobile application for Android. The User Should be able to add filters to the locally saved recorded audio file(.m4a) & should be able to play it after filters are applied. User Can apply filters like changing pitch, changing Voice, Mixing the audio by adding some background music. I don't find any library that supports these features. Anybody can suggest how to approach this ?

2

There are 2 best solutions below

0
ayinala On BEST ANSWER

This can be achieved by using the Just Audio Library for Flutter
https://pub.dev/packages/just_audio.

Effects:.

This package offers different options to play with voice - Change Pitch, Equalizer, Loudness to add effects to the given local audio file / URL.

Background Music:.

To add background music, you can create another instance of a player & start playing some music of your choice while you are playing the main audio file.

5
Akshit Tyagi On

For the future readers -

Just_audio package only supports Pitch, Equalizer etc. effects in Android as per there documentation, also there effects are pretty limited

To achieve these effects in both you need to use combination of FFmpeg and Just_Audio.

In my usecase where I need to add effects to recordings of singing songs by user, I created two audio player, one for recording and one for the background beat and for effects like reverb pitch, I used ffmpeg flutter kit package to do that - https://pub.dev/packages/ffmpeg_kit_flutter

And here are the ffmpeg commands to add reverb, echo, adjust pitch, denoice and many more effects- https://www.vacing.com/ffmpeg_audio_filters/index.html

With the combination of two you can achieve those functionality