Reroute audio from one channel to another with Tasker

1,206 views
Skip to first unread message

Sergio Velardez

unread,
Jul 1, 2018, 10:02:48 AM7/1/18
to Tasker
Hello Taskers,
I have already managed to reroute audio from a channel to another on Android, and using only Tasker. Therefore, it will no longer be necessary to use the well-known 'SoundAbout' app; at least with the most common channel: Multimedia.

    A1: Java Function [ Return:(AudioManager) temp Class Or Object:CONTEXT Function:getSystemService
{Object} (String) Param:audio Param: Param: Param: Param: Param: Param: ]
   
<Headphones -> Speaker>
    A2
: Anchor
    A3
: Java Function [ Return: Class Or Object:temp Function:setWiredHeadsetOn
{} (boolean) Param:false Param: Param: Param: Param: Param: Param: ]
    A4
: Java Function [ Return: Class Or Object:temp Function:setSpeakerphoneOn
{} (boolean) Param:true Param: Param: Param: Param: Param: Param: ]
    A5
: Java Function [ Return: Class Or Object:temp Function:setMode
{} (int) Param:3 Param: Param: Param: Param: Param: Param: ]
   
<Speaker -> Headphones>
    A6
: Anchor
    A7
: Java Function [ Return: Class Or Object:temp Function:setSpeakerphoneOn
{} (boolean) Param:false Param: Param: Param: Param: Param: Param: ]
    A8
: Java Function [ Return: Class Or Object:temp Function:setWiredHeadsetOn
{} (boolean) Param:true Param: Param: Param: Param: Param: Param: ]
    A9
: Java Function [ Return: Class Or Object:temp Function:setMode
{} (int) Param:0 Param: Param: Param: Param: Param: Param: ]

Now it only remains to find out the following:
- How to redirect to/from other channels: Call (second speaker, not in-call), BT.
- As an option, find out how to do it in the Alarm, System, Notifications, etc. channels. But knowing that these channels use the main speaker, I don't think it's necessary.
- Play the sound by two channels at the same time, that is, Main speaker and Headphones. (another app other than SoundAbout used allow it, so it should be possible, unless external libraries are used)
- And I don't know what else. I leave it to your imagination ...;)

So, if someone can contribute to it, I would be very grateful. WE CAN ;)

Simon

unread,
Jul 2, 2018, 2:56:16 AM7/2/18
to Tasker
This is exactly what I've been looking for as my headphone port on my phone no longer automatically detects my headphones being plugged in.

Please could you export and upload the task. Every time I try enter the details as you have it, I get an error.

I would really appreciate it.

Thanks,

Simon

Sergio Velardez

unread,
Jul 2, 2018, 5:04:01 AM7/2/18
to Tasker

João Dias

unread,
Jul 2, 2018, 8:15:49 AM7/2/18
to tas...@googlegroups.com
Just to confirm, the "Speakerphone" action isn't able to do this?

Sergio Velardez

unread,
Jul 2, 2018, 1:44:34 PM7/2/18
to Tasker
No. You need to redirect the audio by setting the audio mode.

Simon

unread,
Jul 3, 2018, 3:37:05 AM7/3/18
to Tasker
Thanks, I really appreciate it :)

Do you know how to force all audio through wired headphones? Such as YouTube videos.

Thanks again.

Sergio Velardez

unread,
Jul 3, 2018, 4:42:01 AM7/3/18
to Tasker
The task does actually this. It redirects all the audio played on Multimedia channel, and YouTube plays through the same.

João Dias

unread,
Jul 3, 2018, 5:09:00 AM7/3/18
to tas...@googlegroups.com
I see I need to add this to Tasker natively :D It's very interesting

Sergio Velardez

unread,
Jul 3, 2018, 5:19:05 AM7/3/18
to Tasker
Would be a very nice feature to have on feature releases Joao! ;)
You can "take a look" at the SoundAbout app code to learn about the tricks the dev used to route audio to other channels.

Sergio Velardez

unread,
Jul 3, 2018, 5:22:01 AM7/3/18
to Tasker
May I have to register the feature on the race page, Joao?

João Dias

unread,
Jul 3, 2018, 8:44:44 AM7/3/18
to tas...@googlegroups.com

May I have to register the feature on the race page, Joao?

No need thanks. :) Already added to the todo list 

Sergio Velardez

unread,
Jul 3, 2018, 9:09:49 AM7/3/18
to Tasker
Ok ;)

Sergio Velardez

unread,
Jul 8, 2018, 2:23:46 PM7/8/18
to Tasker

Update: BT (A2DP) routing


Bluetooth > Speaker

A1: setSpeakerOn (true)

A2: setMode (3)


Speaker > Bluetooth

A1: setSpeakerOn (false)

A2: setMode (0)

Сергей -

unread,
Oct 6, 2020, 8:02:08 AM10/6/20
to Tasker
Good afternoon. Have you decided how to redirect the interlocutor when making calls?
I would very much like to solve and make an analogue of SoundAbout. Write here or in email

воскресенье, 8 июля 2018 г. в 21:23:46 UTC+3, inf.sergi...@gmail.com:
Reply all
Reply to author
Forward
0 new messages