ryanheise / just_audio

Audio Player
1.06k stars 678 forks source link

Feature request: recording, pitch shifting on android and ios #799

Closed CodingRox82 closed 2 years ago

CodingRox82 commented 2 years ago

Is your feature request related to a problem? Please describe. I love this repo, it's been fantastic so far. No problems, just requests for new features.

Describe the solution you'd like I like that there is a branch for pitch shifting for android and I know that this repo is only for playing audio, but I would love it if this repo could:

-record audio -change the pitch for immediate playback, i.e. record a file and play it back right after recording finishes with the pitch shifted so that the user can see if they like how it sounds, if not they can select a different pitch and re-record. No need to save to disk for this. -permanently alter the audio file with the new pitch and save it to disk (for playing back the audio file at some point in the future with the new pitch) -have this all work on both android and ios.

I know this is probably a massive amount of work, but I'd be willing to pay a large bounty to get this done.

Describe alternatives you've considered Right now I have to use flutter_sound to record the audio/do temporary pitch shifting (for immediate playback), FFMpegKit to permanently alter the pitch of the file, and then just_audio for playback (for future playback). However, it's really hard to match the pitch shifting of flutter_sound with FFMpegKit. I'm also not sure if most of my users' phones will be able to run the ffmpeg command in an appropriate time. And on top of all that, the sound quality of the output file from FFMpegKit seems to be lower quality than that of flutter_sound.

Additional context

ryanheise commented 2 years ago

I know this is probably a massive amount of work, but I'd be willing to pay a large bounty to get this done.

Hi @CodingRox82 , thanks for your feature request. As mentioned in the README, this plugin follows a design philosophy of implementing a single responsibility, which in this case is rendering audio. Single responsibility plugins are better for the ecosystem since they allow the user to mix and match different audio plugins in the same app. People ought to be able to mix their favourite audio recorder with their preferred audio player with their preferred background audio service, with their favourite text-to-speech plugin etc. As an example of the problems monolithic plugins can lead to, flutter_sound has probably among the best audio recorder components available, however because the plugin has also bundled in a player and a background service, it has historically not been possible to use flutter_sound in the same app as audio_service, even if one just wanted to use the recorder component which itself shouldn't conflict with audio_service. In short, the more broadly a plugin extends its API, the more likely it is to conflict with other plugins in the ecosystem and the less good it is at interoperating.

When people make feature requests like this, my usual response is to say that audio recording should be a separate plugin. There are already several audio recorder plugins out there, and the best way forward would be to support them so that they get better, rather than to make one monolithic plugin that does everything.

CodingRox82 commented 2 years ago

Fair enough. Thank you for the quick response!

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with just_audio.