Pause Music and Say Sender and Body

Last Updated:

  1. notyours07

    notyours07 New Member

    I ride a motorcycle daily and listen to music via wired earbuds. I would like for the music to be paused when I receive a new SMS, play the notification sound, read the senders name and message, and finally resume the music.

    I set it up and it works great when tested with the small "Play" button at the bottom of the TASK. When I have my buds in and playing music, it works sometimes and other times it resumes music immediately after saying %SMSRN.

    This is what I have set up so far:

    Context 1: Headset Plugged, Any
    Context 2: Received Text SMS, *,*

    Media Control, Toggle Pause, Sim Media Button
    Sys Volume, Level 15
    Wait, 4seconds (waiting for text notification to finish (BRRAAAAAAINS))
    Say, Text From %SMSRN,Stream w/Media
    Wait, 600milsec (pause between Name and Body)
    Say, %SMSRB, Stream w/Media
    Sys Volume, Level 12
    Wait, 2seconds
    Media Control, Toggle Pause, Sim Media button

  2. RogueOne42

    RogueOne42 New Member

    I'm using roughly the same setup with both a headset and BT (couldn't figure out how to do it in one profile so I made 2). Reads perfectly but if I'm not listening to music when I have my headset/BT on it turns it on when I get an SMS. I'm sure there's an easy way to fix it but I haven't been able to figure it out yet.

    Any suggestions anyone?

    TL/DR: How do I get tasker to decide if music is playing before deciding to toggle pause.
  3. tatootie67

    tatootie67 Well-Known Member

    One way should be to set a variable after your media play command like:

    Variable set:MUSICPLAYING to on.

    Then on your read SMS profile task include an if statement with your say command like:
    Say bla bla bla: if MUSICPLAYING is on.

    Just make sure to add in your exit task to variable set the MUSICPLAYING to off.

    Or you could use the same variable to turn the entire SMS profile off if music isn't playing. Then turn it back on when the play button is pressed again.

    OP, I think you need a longer pause than 2 sec.
    RogueOne42 likes this.
  4. rubeast

    rubeast New Member

    I want the exact same thing as RogueOne42.
    But I can't figure it out.

    How can I set the variable when the music starts playing when I control it by car?
    I can't find an option to set a var as soon as media is playing.

    If I had that option I would just make 2 profiles:
    1. Connected to Bluetooth + receive text = read sms
    2. Connected to Bluetooth + receive text + music is playing = pause music, read sms, unpause music.

    Edit: Found a solution

    Make 2 profiles.

    Profile 1 - "SMS + Bluetooth"
    * Bluetooth connected
    * Received Text Any
    * Variable Value %MTRACK, Isn't Set

    * Wait 1sec
    * Say, Text: BlaBla %SMSRN BlaBla %SMSRB, Stream: Ringer

    Profile 2 - "SMS + Bluetooth + Music"
    * Bluetooth connected
    * Received Text Any
    * Variable Value %MTRACK, Is Set

    * Media Control, Pause, Sim Media Button On
    * Wait 1sec
    * Say, Text: BlaBla %SMSRN BlaBla %SMSRB, Stream: Ringer
    * Media Control, Play, Sim Media Button On
    RogueOne42 likes this.
  5. RogueOne42

    RogueOne42 New Member

    I couldn't figure it out so I swapped the Say stream to Call and have it drop the media volume down when it reads the text. When it's finished reading it sets the media volume back.
  6. 330D

    330D From My Cold Dead Hands VIP Member

    I bought tasker for this specific action, and I am having a hell of a time understanding what to do... I have a Motorola Droid RAZR, and with smart actions alone I can get it to announce the sender of a received text while my headphones are plugged in, but I would like the text read to me. I am very very new to tasker and don't fully understand what I need to do to get there. Anyone want to lend a hand getting me there I would really appreciate it!
  7. tatootie67

    tatootie67 Well-Known Member

    %SMSRF is the sender.
    %SMSRB is the message.
    All you have to do is use the say command with those variables to read out loud the last text received.
    Use received SMS as your context

    Profile: read SMS headphones
    Context: headphones plugged
    Context: received SMS

    Task: read SMS
    Say %SMSRF sent you the following text message. %SMSRB

Share This Page