StreamAssist icon indicating copy to clipboard operation
StreamAssist copied to clipboard

No TTS audio playing over Sonos media player

Open corpsecallosum opened this issue 1 year ago • 10 comments

I am getting the following error when trying to use a Sonos media player. The beep.wav plays after the wake word and commands are executed but I get no TTS audio through my Sonos AMP / ceiling speakers.

ERROR (SyncWorker_45) [homeassistant.components.sonos.media_player] Sonos does not support media type "audio/mpeg"

Thanks for all you do.

corpsecallosum avatar Mar 12 '24 07:03 corpsecallosum

What TTS service you using? And what content type supported by Sonos?

AlexxIT avatar Mar 12 '24 16:03 AlexxIT

Hi.

Thanks for your quick response. I tried Piper first and when it didn't work I tried google. I didn't try HA Cloud option since I don't have a subscription.

I found this regarding Sonos. Perhaps audio/mp3 is correct one?

https://docs.sonos.com/docs/supported-audio-formats Sonos - Home Assistant (home-assistant.io)https://www.home-assistant.io/integrations/sonos/

Much appreciated! This will be sick if it works.


From: Alex X @.> Sent: Tuesday, March 12, 2024 11:52 AM To: AlexxIT/StreamAssist @.> Cc: corpsecallosum @.>; Author @.> Subject: Re: [AlexxIT/StreamAssist] No TTS audio playing over Sonos media player (Issue #17)

What TTS service you using? And what content type supported by Sonos?

— Reply to this email directly, view it on GitHubhttps://github.com/AlexxIT/StreamAssist/issues/17#issuecomment-1992119636, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AI4GIZJMYJTE6OYK2RSKHA3YX4XDPAVCNFSM6AAAAABERU7Y2WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJSGEYTSNRTGY. You are receiving this because you authored the thread.Message ID: @.***>

corpsecallosum avatar Mar 12 '24 19:03 corpsecallosum

I forgot to mention that this sounds interesting (see below) I found written on the page from the second link. Ducking built into Sonos!!

Playing TTS (text-to-speech) or audio files as alerts (e.g., a doorbell or alarm) is possible by setting the announce argument to true. Using announce will play the provided media URL as an overlay, gently lowering the current music volume and automatically restoring to the original level when finished. An optional volume argument can also be provided in the extra dictionary to play the alert at a specific volume level.


From: Michael Juneau @.> Sent: Tuesday, March 12, 2024 2:57 PM To: AlexxIT/StreamAssist @.>; AlexxIT/StreamAssist @.> Cc: Author @.> Subject: Re: [AlexxIT/StreamAssist] No TTS audio playing over Sonos media player (Issue #17)

Hi.

Thanks for your quick response. I tried Piper first and when it didn't work I tried google. I didn't try HA Cloud option since I don't have a subscription.

I found this regarding Sonos. Perhaps audio/mp3 is correct one?

https://docs.sonos.com/docs/supported-audio-formats Sonos - Home Assistant (home-assistant.io)https://www.home-assistant.io/integrations/sonos/

Much appreciated! This will be sick if it works.


From: Alex X @.> Sent: Tuesday, March 12, 2024 11:52 AM To: AlexxIT/StreamAssist @.> Cc: corpsecallosum @.>; Author @.> Subject: Re: [AlexxIT/StreamAssist] No TTS audio playing over Sonos media player (Issue #17)

What TTS service you using? And what content type supported by Sonos?

— Reply to this email directly, view it on GitHubhttps://github.com/AlexxIT/StreamAssist/issues/17#issuecomment-1992119636, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AI4GIZJMYJTE6OYK2RSKHA3YX4XDPAVCNFSM6AAAAABERU7Y2WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJSGEYTSNRTGY. You are receiving this because you authored the thread.Message ID: @.***>

corpsecallosum avatar Mar 12 '24 20:03 corpsecallosum

@AlexxIT :

I tried to get a Sonos Move 1 up and running. Here my configuration:

image

image

Sometimes (!) the wake word works and I can hear the beep.mp3. Since now I could not find a valid pattern. I think it has to do with turning the Sonos Move Hardware Microphone off and and on again (not the Home Assistant toggle off and on)

image

image


The wake word sometimes works. In case it worked, I never received an answer no matter I asked for.

@corpsecallosum :

Did you get Sonos up and running? Could you please send your configuration?

drueppela avatar Mar 19 '24 21:03 drueppela

I'm having the same issue. TTS isn't played on the sonos system. The beep is played when a wakeword is detected and the command is processed aswell, but the TTS isn't played on the sonos system.

Kamieldehond avatar May 17 '24 07:05 Kamieldehond

Similar issue, only for me, the full process runs but audio is not played, however, I attempted to also cast to Google Display and it activates and shows the media cast player but does not play audio. The audio is correctly generated and stored in the debug route. Only the media players do not play the audio. Browser will play the audio in debug mode.

HA on Docker on Synology DSM (bridge) Sonos Nabu Casa (for temporary SSL work as I setup direct with LetsEncrypt) Google Home Hub Voice Assistant = Home Assist + OpenAI Extended STT and TTS from Home Assistant Cloud (Nabu Casa) OpenWakeWord with custom wake word also on docker on synology

Here's the full debug that does everything as it should, but does not successfully play audible messages on media players:

stage: done
run:
  pipeline: 01hxerdczhgm6hrjrgskk
  language: en
events:
  - type: run-start
    data:
      pipeline: 01hxerdczhgm6hrjrgskk
      language: en
    timestamp: "2024-06-07T14:42:32.596918+00:00"
  - type: wake_word-start
    data:
      entity_id: wake_word.openwakeword
      metadata:
        format: wav
        codec: pcm
        bit_rate: 16
        sample_rate: 16000
        channel: 1
      timeout: 0
    timestamp: "2024-06-07T14:42:32.597112+00:00"
  - type: wake_word-end
    data:
      wake_word_output:
        wake_word_id: yoh_steve
        wake_word_phrase: yoh steve
        timestamp: 242230
    timestamp: "2024-06-07T14:50:37.063517+00:00"
  - type: stt-start
    data:
      engine: stt.home_assistant_cloud
      metadata:
        language: en-US
        format: wav
        codec: pcm
        bit_rate: 16
        sample_rate: 16000
        channel: 1
    timestamp: "2024-06-07T14:50:37.063803+00:00"
  - type: stt-vad-end
    data:
      timestamp: 249770
    timestamp: "2024-06-07T14:50:52.159934+00:00"
  - type: stt-end
    data:
      stt_output:
        text: Who is the 19th president?
    timestamp: "2024-06-07T14:50:52.280523+00:00"
  - type: intent-start
    data:
      engine: 4271e88f353b909b75c0ee302e1d1046
      language: "*"
      intent_input: Who is the 19th president?
      conversation_id: null
      device_id: null
    timestamp: "2024-06-07T14:50:52.280771+00:00"
  - type: intent-end
    data:
      intent_output:
        response:
          speech:
            plain:
              speech: The 19th president of the United States was Rutherford B. Hayes.
              extra_data: null
          card: {}
          language: "*"
          response_type: action_done
          data:
            targets: []
            success: []
            failed: []
        conversation_id: 01HZSJWPGMMSA6WYWM6CD1Z3GX
    timestamp: "2024-06-07T14:50:53.973941+00:00"
  - type: tts-start
    data:
      engine: cloud
      language: en-US
      voice: ChristopherNeural
      tts_input: The 19th president of the United States was Rutherford B. Hayes.
    timestamp: "2024-06-07T14:50:53.974167+00:00"
  - type: tts-end
    data:
      tts_output:
        media_id: >-
          media-source://tts/cloud?message=The+19th+president+of+the+United+States+was+Rutherford+B.+Hayes.&language=en-US&voice=ChristopherNeural
        url: >-
          /api/tts_proxy/d05747f0baa3baf9940ab340f38fa5315da3dac8_en-us_99802492eb_cloud.mp3
        mime_type: audio/mpeg
    timestamp: "2024-06-07T14:50:54.015433+00:00"
  - type: run-end
    data: null
    timestamp: "2024-06-07T14:50:54.016634+00:00"
wake_word:
  entity_id: wake_word.openwakeword
  metadata:
    format: wav
    codec: pcm
    bit_rate: 16
    sample_rate: 16000
    channel: 1
  timeout: 0
  done: true
  wake_word_output:
    wake_word_id: yoh_steve
    wake_word_phrase: yoh steve
    timestamp: 242230
stt:
  engine: stt.home_assistant_cloud
  metadata:
    language: en-US
    format: wav
    codec: pcm
    bit_rate: 16
    sample_rate: 16000
    channel: 1
  done: true
  stt_output:
    text: Who is the 19th president?
intent:
  engine: 4271e88f353b909b75c0ee302e1d1046
  language: "*"
  intent_input: Who is the 19th president?
  conversation_id: null
  device_id: null
  done: true
  intent_output:
    response:
      speech:
        plain:
          speech: The 19th president of the United States was Rutherford B. Hayes.
          extra_data: null
      card: {}
      language: "*"
      response_type: action_done
      data:
        targets: []
        success: []
        failed: []
    conversation_id: 01HZSJWPGMMSA6WYWM6CD1Z3GX
tts:
  engine: cloud
  language: en-US
  voice: ChristopherNeural
  tts_input: The 19th president of the United States was Rutherford B. Hayes.
  done: true
  tts_output:
    media_id: >-
      media-source://tts/cloud?message=The+19th+president+of+the+United+States+was+Rutherford+B.+Hayes.&language=en-US&voice=ChristopherNeural
    url: >-
      /api/tts_proxy/d05747f0baa3baf9940ab340f38fa5315da3dac8_en-us_99802492eb_cloud.mp3
    mime_type: audio/mpeg

dbhurley avatar Jun 07 '24 15:06 dbhurley

I don't see where my media_player.living_room and other targets are set in this debug, the targets [] is empty, perhaps a bug in the code in populating this from the modal?

dbhurley avatar Jun 07 '24 16:06 dbhurley

Have a similar issue with TTS not being played on Sonos speaker, while other parts working ok. Hass logs contain this:

2024-09-12 23:33:13.329 ERROR (SyncWorker_4) [homeassistant.components.sonos.media_player] Sonos does not support a media type of "audio/mpeg"

So i'm wondering if its needed\possible to specify different mime-type?

dmitriy-sqrt avatar Sep 12 '24 20:09 dmitriy-sqrt

Was able to get tts & chime played with changing line custom_components/stream_assist/core/__init__.py:191 from "media_content_type": media_type, to "media_content_type": "music" which is a spike, but it works for me

dmitriy-sqrt avatar Oct 15 '24 19:10 dmitriy-sqrt

I think https://github.com/AlexxIT/StreamAssist/pull/60 might address this

CashWilliams avatar Mar 03 '25 21:03 CashWilliams