Just_audio: Stereo, Left, or Right channel audio playing

Created on 9 Jul 2020  Â·  10Comments  Â·  Source: ryanheise/just_audio

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Not related to a problem. I would just like to be able to play a specific audio channel. I'd love to be able to set, Left, Right, or Stereo.

Describe the solution you'd like
A clear and concise description of what you want to happen.
I would love the ability to play just one channel of an audio track. That way you could play one track in the left ear and a different track (with a different player instance) in the other ear.
Ex.
_player1.setOutpuChannel(Left);
_player1.play();
_player2.setOutpuChannel(Right);
_player2.play();

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
I can generate audio with just one channel, but it is clunky.

Additional context
Add any other context or screenshots about the feature request here.
For a meditation app, with binaural beats (200Hz in one ear 205Hz in the other ear)

1 backlog enhancement

Most helpful comment

I just talked to Grant and if he has time tomorrow he will illustrate his approach. The iOS version was also implemented for the latest version of just_audio, but I don't know that we tested it thoroughly. The ExoPlayer compiled but never produced audio output. Hopefully one of you other Exo-enthusiasts will see this and run with it. Until tomorrow.

All 10 comments

Hi Ryan, I see 'assigned'... that seems like progress!
I've looked over other people's request, and now I wish that I'd cleaned mine up more. Sorry, just new to this.
At the moment, I only need this (urgently) for Android. iOS maybe later, and Web would be amazing.
If you need any more clarification, I am happy to supply as much as you need, and to test whatever you have.
Thanks again Ryan.
jjb

Hi @jjb182 , thanks for the feature request. FYI, issues are automatically assigned to me and placed into my backlog. When I begin working on a feature, I change the "backlog" label to "fixing" (which I should probably rename since the word "fixing" is more applicable to bug reports than feature requests).

Currently I am working on #36 and #125 which is turning out to be 2-3 weeks of work. Some issues are obviously easier to resolve than others, but if I implement the feature myself, then yes it may take a while for me to get to it due to the large number of issues I have to work through.

However, pull requests are also welcome if you need it done sooner and are willing to contribute.

Hi Ryan, I'm very new to Flutter and Git for that matter, and though I
think that it will be equally fast to wait for you as to try to implement
something myself... perhaps today is the day that I learn about pull
requests. So please tell me what I need to do to get started on a PR.

Thanks
jjb

On Tue, Jul 14, 2020 at 12:04 AM ryanheise notifications@github.com wrote:

Hi @jjb182 https://github.com/jjb182 , thanks for the feature request.
FYI, issues are automatically assigned to me and placed into my backlog.
When I begin working on a feature, I change the "backlog" label to "fixing"
(which I should probably rename since the word "fixing" is more applicable
to bug reports than feature requests).

Currently I am working on #36
https://github.com/ryanheise/just_audio/issues/36 and #125
https://github.com/ryanheise/just_audio/issues/125 which is turning out
to be 2-3 weeks of work. Some issues are obviously easier to resolve than
others, but if I implement the feature myself, then yes it may take a while
for me to get to it due to the large number of issues I have to work
through.

However, pull requests are also welcome if you need it done sooner and are
willing to contribute.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ryanheise/just_audio/issues/126#issuecomment-657953448,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABU3WNY4KWFDTZG5TVTW7PDR3PKL7ANCNFSM4OV2M6VQ
.

Thanks for offering to have a go at it. I may not be able to teach you how to do it, but there are good tutorials online if you try the following Google searches:

  • how to create a pull request on github
  • git tutorial

I imagine that this is a LOW priority, but does anybody out there want to take a shot at this?

I would welcome anyone taking a shot at this. Although just note that all effort is going into the media-source branch at the moment, and so it would be best for anyone making a pull request to make it on the media-source branch.

Copying over some comments from duplicated issue #340 :

Looks like there was some discussion on this here for ExoPlayer: google/ExoPlayer#2659 (it is described as a niche feature so the app must implement it manually, although we can't take that approach with Flutter since audio processing over method channels won't be very efficient).

For iOS, it's a built-in feature of AVAudioPlayer although that's not the API just_audio is based on. Maybe this can be done after the iOS side is reimplemented based on AVAudioEngine.

And a question:

So is the best way for getting this functionality is to use a server power for quick mixing my sounds (to use desired L/R channel volumes) and playing a stream with just_audio? What do you think?

That's not a bad workaround given the feature is not currently implemented in just_audio. If you're dealing with assets, you could also prepare the desired mix ahead of time and bundle that in the assets. If the content is dynamic, you could prepare the mix just in time. It may be possible on device using ffmpeg, except that ffmpeg's license is not compatible with iOS or Android.

Hi Ryan, a friend of mine was able to implement this in just_audio_0.2.2 on
the iOS side. A similar attempt was made for the ExoPlayer but we were
unsuccessful. As fate would have it, one of my projects for the past
couple weeks has been to reach out to anyone who would listen on Upwork in
an attempt to make more progress with this.

I'm happy to share the iOS side and the attempts at the ExoPlayer side if
anyone wants to look at it. The friend that implemented it can speak a lot
more intelligently about the solution. I will ask him if he can put
together an explanation.

/// Sets channel mode of audio based on integer input
/// Stereo: 0 Left-Only: 1 Right-Only: 2

await freq_a_player.setActiveChannels(2);

Here is the pub_cache

https://dictationportal.com:4445/just_audio/just_audio-0.2.2-ios-setActiveChannels.zip

This currently does not contain any of the ExoPlayer stuff. I have to track
that down.

On Sat, Mar 13, 2021 at 8:35 PM ryanheise @.*> wrote:

Copying over some comments from duplicated issue #340
https://github.com/ryanheise/just_audio/issues/340 :

Looks like there was some discussion on this here for ExoPlayer:
google/ExoPlayer#2659 https://github.com/google/ExoPlayer/issues/2659
(it is described as a niche feature so the app must implement it manually,
although we can't take that approach with Flutter since audio processing
over method channels won't be very efficient).

For iOS, it's a built-in feature of AVAudioPlayer although that's not the
API just_audio is based on. Maybe this can be done after the iOS side is
reimplemented based on AVAudioEngine.

And a question:

So is the best way for getting this functionality is to use a server power
for quick mixing my sounds (to use desired L/R channel volumes) and playing
a stream with just_audio? What do you think?

That's not a bad workaround given the feature is not currently implemented
in just_audio. If you're dealing with assets, you could also prepare the
desired mix ahead of time and bundle that in the assets. If the content is
dynamic, you could prepare the mix just in time. It may be possible on
device using ffmpeg, except that ffmpeg's license is not compatible with
iOS or Android.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ryanheise/just_audio/issues/126#issuecomment-798814340,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABU3WN6XJRL3HSAI3TCT463TDQHFXANCNFSM4OV2M6VQ
.

I just talked to Grant and if he has time tomorrow he will illustrate his approach. The iOS version was also implemented for the latest version of just_audio, but I don't know that we tested it thoroughly. The ExoPlayer compiled but never produced audio output. Hopefully one of you other Exo-enthusiasts will see this and run with it. Until tomorrow.

Nice! If the iOS side is sorted, I'd be willing to consider taking a look at the Android side.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

creativecreatorormaybenot picture creativecreatorormaybenot  Â·  7Comments

suragch picture suragch  Â·  9Comments

sigjak picture sigjak  Â·  12Comments

hesham91fci picture hesham91fci  Â·  12Comments

tcerven picture tcerven  Â·  10Comments