Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Audio through HMDI and Alexa stops in mid-sentence #614

Closed
sescapa opened this issue Apr 11, 2018 · 5 comments
Closed

Audio through HMDI and Alexa stops in mid-sentence #614

sescapa opened this issue Apr 11, 2018 · 5 comments

Comments

@sescapa
Copy link

sescapa commented Apr 11, 2018

I am currently using Raspberry Pi 3 (Raspbian Stretch).
I couldn't get the JAVA SDK to work (npm not existing and mvn giving me very weird errors). I am currently using the C++ SDK that was mentioned in the build.

I've run into two issues:

The first, despite having a 3.5 mm speaker attached, the Alexa output voice comes out from my monitor (has a speaker attached to it). I've tested the speaker, and it works. I can play YouTube from the browser of my Raspberry Pi and it will come out from the speaker.

The second is that Alexa stops mid-response. I don't know if it's related to the audio going through the HMDI. Alexa never finishes her response.

@BennyAvramson
Copy link
Contributor

Hi @sescapa,

For the first issue:
Could you try running gst-launch-1.0 -m audiotestsrc ! autoaudiosink and see if you hear the sound through the 3.5mm speaker. As part of the output you should see a message regarding the actual sink used, please paste it here when responding.

Also please try if playing with aplay is routing the music to the 3.5mm speaker.

For the second issue, could you rung the SampleApp with DEBUG9 and attach the logs here?

Thanks,
Benny

@sescapa
Copy link
Author

sescapa commented Apr 11, 2018

Hi @BennyAvramson,

Using gst-launch-1.0 -m audiotestsrc ! autoaudiosink, it comes out through the HDMI. The message is the following:

gst-launch-1.0 -m audiotestsrc ! autoaudiosink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Got message #7 from element "autoaudiosink0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #8 from element "audiotestsrc0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #9 from element "pipeline0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY, pending-state=(GstState)GST_STATE_PAUSED;
Got message #15 from pad "audiotestsrc0:src" (stream-status): GstMessageStreamStatus, type=(GstStreamStatusType)GST_STREAM_STATUS_TYPE_CREATE, owner=(GstElement)"(GstAudioTestSrc)\ audiotestsrc0", object=(GstTask)"(GstTask)\ audiotestsrc0:src";
Got message #16 from element "audiotestsrc0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_READY, new-state=(GstState)GST_STATE_PAUSED, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #17 from pad "audiotestsrc0:src" (stream-status): GstMessageStreamStatus, type=(GstStreamStatusType)GST_STREAM_STATUS_TYPE_ENTER, owner=(GstElement)"(GstAudioTestSrc)\ audiotestsrc0", object=(GstTask)"(GstTask)\ audiotestsrc0:src";
Got message #18 from element "pipeline0" (stream-start): GstMessageStreamStart, group-id=(uint)0;
Got message #23 from element "autoaudiosink0-actual-sink-omxhdmiaudio" (latency): no message details
Redistribute latency...
Got message #29 from element "autoaudiosink0-actual-sink-omxhdmiaudio" (tag): GstMessageTag, taglist=(taglist)"taglist,\ description=(string)"audiotest\\ wave";";
Got message #28 from object "audiosinkringbuffer0" (stream-status): GstMessageStreamStatus, type=(GstStreamStatusType)GST_STREAM_STATUS_TYPE_ENTER, owner=(GstElement)"(GstOMXHdmiAudioSink-omxhdmiaudiosink)\ autoaudiosink0-actual-sink-omxhdmiaudio", object=(GThread)NULL;
Got message #30 from element "autoaudiosink0-actual-sink-omxhdmiaudio" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_READY, new-state=(GstState)GST_STATE_PAUSED, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #33 from element "autoaudiosink0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_READY, new-state=(GstState)GST_STATE_PAUSED, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #35 from element "pipeline0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_READY, new-state=(GstState)GST_STATE_PAUSED, pending-state=(GstState)GST_STATE_VOID_PENDING;
Pipeline is PREROLLED ...
Got message #34 from element "pipeline0" (async-done): GstMessageAsyncDone, running-time=(guint64)18446744073709551615;
Setting pipeline to PLAYING ...
Got message #36 from element "pipeline0" (new-clock): GstMessageNewClock, clock=(GstClock)"(GstAudioClock)\ GstAudioSinkClock";
New clock: GstAudioSinkClock
Got message #38 from element "autoaudiosink0-actual-sink-omxhdmiaudio" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_PAUSED, new-state=(GstState)GST_STATE_PLAYING, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #39 from element "autoaudiosink0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_PAUSED, new-state=(GstState)GST_STATE_PLAYING, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #40 from element "audiotestsrc0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_PAUSED, new-state=(GstState)GST_STATE_PLAYING, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #41 from element "pipeline0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_PAUSED, new-state=(GstState)GST_STATE_PLAYING, pending-state=(GstState)GST_STATE_VOID_PENDING;

^Chandling interrupt.
Got message #42 from element "pipeline0" (application): GstLaunchInterrupt, message=(string)"Pipeline\ interrupted";
Interrupt: Stopping pipeline ...
Execution ended after 0:00:14.081601509
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
pi@raspberrypi:~ $ gst-launch-1.0 -m audiotestsrc ! autoaudiosink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Got message #7 from element "autoaudiosink0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #8 from element "audiotestsrc0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #9 from element "pipeline0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY, pending-state=(GstState)GST_STATE_PAUSED;
Got message #15 from pad "audiotestsrc0:src" (stream-status): GstMessageStreamStatus, type=(GstStreamStatusType)GST_STREAM_STATUS_TYPE_CREATE, owner=(GstElement)"(GstAudioTestSrc)\ audiotestsrc0", object=(GstTask)"(GstTask)\ audiotestsrc0:src";
Got message #16 from element "audiotestsrc0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_READY, new-state=(GstState)GST_STATE_PAUSED, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #17 from pad "audiotestsrc0:src" (stream-status): GstMessageStreamStatus, type=(GstStreamStatusType)GST_STREAM_STATUS_TYPE_ENTER, owner=(GstElement)"(GstAudioTestSrc)\ audiotestsrc0", object=(GstTask)"(GstTask)\ audiotestsrc0:src";
Got message #18 from element "pipeline0" (stream-start): GstMessageStreamStart, group-id=(uint)0;
Got message #23 from element "autoaudiosink0-actual-sink-omxhdmiaudio" (latency): no message details
Redistribute latency...
Got message #25 from object "audiosinkringbuffer0" (stream-status): GstMessageStreamStatus, type=(GstStreamStatusType)GST_STREAM_STATUS_TYPE_ENTER, owner=(GstElement)"(GstOMXHdmiAudioSink-omxhdmiaudiosink)\ autoaudiosink0-actual-sink-omxhdmiaudio", object=(GThread)NULL;
Got message #29 from element "autoaudiosink0-actual-sink-omxhdmiaudio" (tag): GstMessageTag, taglist=(taglist)"taglist,\ description=(string)"audiotest\\ wave";";
Got message #30 from element "autoaudiosink0-actual-sink-omxhdmiaudio" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_READY, new-state=(GstState)GST_STATE_PAUSED, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #33 from element "autoaudiosink0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_READY, new-state=(GstState)GST_STATE_PAUSED, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #35 from element "pipeline0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_READY, new-state=(GstState)GST_STATE_PAUSED, pending-state=(GstState)GST_STATE_VOID_PENDING;
Pipeline is PREROLLED ...
Got message #34 from element "pipeline0" (async-done): GstMessageAsyncDone, running-time=(guint64)18446744073709551615;
Setting pipeline to PLAYING ...
Got message #36 from element "pipeline0" (new-clock): GstMessageNewClock, clock=(GstClock)"(GstAudioClock)\ GstAudioSinkClock";
New clock: GstAudioSinkClock
Got message #38 from element "autoaudiosink0-actual-sink-omxhdmiaudio" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_PAUSED, new-state=(GstState)GST_STATE_PLAYING, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #39 from element "autoaudiosink0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_PAUSED, new-state=(GstState)GST_STATE_PLAYING, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #40 from element "audiotestsrc0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_PAUSED, new-state=(GstState)GST_STATE_PLAYING, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #41 from element "pipeline0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_PAUSED, new-state=(GstState)GST_STATE_PLAYING, pending-state=(GstState)GST_STATE_VOID_PENDING;
^Chandling interrupt.
Got message #42 from element "pipeline0" (application): GstLaunchInterrupt, message=(string)"Pipeline\ interrupted";
Interrupt: Stopping pipeline ...
Execution ended after 0:00:05.760939645
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

I've done a arecord and a aplay. It comes out from the speakers.

As for the DEBUG9:

############################

Listening...

############################

2018-04-11 18:34:15.702 [ 2] W Logger:debugLogLevelSpecifiedWhenDebugLogsCompiledOut:level=DEBUG9:

WARNING: By default DEBUG logs are compiled out of RELEASE builds.
Rebuild with the cmake parameter -DCMAKE_BUILD_TYPE=DEBUG to enable debug logs.

2018-04-11 18:34:15.703 [ 2] I DirectiveProcessor:setDialogRequestIdLocked:oldValue=,newValue=1424b6de-3abf-4947-9fab-5f2c7dda12b4
2018-04-11 18:34:19.482 [ 3] I DirectiveSequencer:onDirective:directive={"namespace:"SpeechRecognizer",name:"StopCapture",messageId:"b6b67074-8f0c-4ca8-b67d-8b5af2dcbba0",dialogRequestId:""}
2018-04-11 18:34:19.482 [ 4] I DirectiveRouter:preHandleDirective:messageId=b6b67074-8f0c-4ca8-b67d-8b5af2dcbba0,action=calling
2018-04-11 18:34:19.483 [ 5] I DirectiveRouter:handleDirective:messageId=b6b67074-8f0c-4ca8-b67d-8b5af2dcbba0,action=calling
###########################

Thinking...

###########################

2018-04-11 18:34:19.492 [ 6] W Logger:debugLogLevelSpecifiedWhenDebugLogsCompiledOut:level=DEBUG9:

WARNING: By default DEBUG logs are compiled out of RELEASE builds.
Rebuild with the cmake parameter -DCMAKE_BUILD_TYPE=DEBUG to enable debug logs.

2018-04-11 18:34:19.492 [ 6] I InProcessAttachmentReader:readFailed:reason=SDS is closed
2018-04-11 18:34:20.310 [ 3] I DirectiveSequencer:onDirective:directive={"namespace:"SpeechSynthesizer",name:"Speak",messageId:"3df7cbbf-be4d-4de4-a8ef-3a8166ea5e0e",dialogRequestId:"1424b6de-3abf-4947-9fab-5f2c7dda12b4"}
2018-04-11 18:34:20.310 [ 4] I DirectiveRouter:preHandleDirective:messageId=3df7cbbf-be4d-4de4-a8ef-3a8166ea5e0e,action=calling
2018-04-11 18:34:20.310 [ 3] I DirectiveSequencer:onDirective:directive={"namespace:"SpeechSynthesizer",name:"Speak",messageId:"e6c8b618-57c8-4e92-a565-c91929ebf983",dialogRequestId:"1424b6de-3abf-4947-9fab-5f2c7dda12b4"}
2018-04-11 18:34:20.310 [ 4] I DirectiveRouter:preHandleDirective:messageId=e6c8b618-57c8-4e92-a565-c91929ebf983,action=calling
2018-04-11 18:34:20.311 [ 3] I DirectiveSequencer:onDirective:directive={"namespace:"SpeechSynthesizer",name:"Speak",messageId:"c9479426-ca26-444f-9f4d-8de917abd042",dialogRequestId:"1424b6de-3abf-4947-9fab-5f2c7dda12b4"}
2018-04-11 18:34:20.311 [ 3] I DirectiveSequencer:onDirective:directive={"namespace:"SpeechSynthesizer",name:"Speak",messageId:"fa63da8c-7018-4552-a691-b0facc873ae3",dialogRequestId:"1424b6de-3abf-4947-9fab-5f2c7dda12b4"}
2018-04-11 18:34:20.311 [ 3] I DirectiveSequencer:onDirective:directive={"namespace:"SpeechSynthesizer",name:"Speak",messageId:"32f179dc-ab48-49db-b9a5-f0f278241098",dialogRequestId:"1424b6de-3abf-4947-9fab-5f2c7dda12b4"}
2018-04-11 18:34:20.311 [ 5] I DirectiveRouter:handleDirective:messageId=3df7cbbf-be4d-4de4-a8ef-3a8166ea5e0e,action=calling
2018-04-11 18:34:20.311 [ 3] I DirectiveSequencer:onDirective:directive={"namespace:"SpeechSynthesizer",name:"Speak",messageId:"be65cde4-21e4-474a-b368-f2fd71b1f6a3",dialogRequestId:"1424b6de-3abf-4947-9fab-5f2c7dda12b4"}
2018-04-11 18:34:20.311 [ 3] I DirectiveSequencer:onDirective:directive={"namespace:"SpeechSynthesizer",name:"Speak",messageId:"693219c1-6d9c-45cc-8c11-b59c5899fcdd",dialogRequestId:"1424b6de-3abf-4947-9fab-5f2c7dda12b4"}
2018-04-11 18:34:20.311 [ 4] I DirectiveRouter:preHandleDirective:messageId=c9479426-ca26-444f-9f4d-8de917abd042,action=calling
2018-04-11 18:34:20.312 [ 4] I DirectiveRouter:preHandleDirective:messageId=fa63da8c-7018-4552-a691-b0facc873ae3,action=calling
2018-04-11 18:34:20.312 [ 4] I DirectiveRouter:preHandleDirective:messageId=32f179dc-ab48-49db-b9a5-f0f278241098,action=calling
2018-04-11 18:34:20.312 [ 4] I DirectiveRouter:preHandleDirective:messageId=be65cde4-21e4-474a-b368-f2fd71b1f6a3,action=calling
2018-04-11 18:34:20.312 [ 4] I DirectiveRouter:preHandleDirective:messageId=693219c1-6d9c-45cc-8c11-b59c5899fcdd,action=calling
2018-04-11 18:34:20.326 [ 7] W Logger:debugLogLevelSpecifiedWhenDebugLogsCompiledOut:level=DEBUG9:

WARNING: By default DEBUG logs are compiled out of RELEASE builds.
Rebuild with the cmake parameter -DCMAKE_BUILD_TYPE=DEBUG to enable debug logs.

2018-04-11 18:34:20.326 [ 7] E MediaPlayer:saveOffsetBeforeTeardown - gst_element_query_position failed
2018-04-11 18:34:20.448 [ 7] I InProcessAttachmentReader:readFailed:reason=SDS is closed
2018-04-11 18:34:20.479 [ 7] I InProcessAttachmentReader:readFailed:reason=SDS is closed
###########################

Speaking...

###########################

2018-04-11 18:34:20.876 [ 7] E MediaPlayer:saveOffsetBeforeTeardown - gst_element_query_position failed
2018-04-11 18:34:20.876 [ 5] I DirectiveRouter:handleDirective:messageId=e6c8b618-57c8-4e92-a565-c91929ebf983,action=calling
2018-04-11 18:34:20.877 [ 7] E MediaPlayer:saveOffsetBeforeTeardown - gst_element_query_position failed
2018-04-11 18:34:20.884 [ 7] I InProcessAttachmentReader:readFailed:reason=SDS is closed
2018-04-11 18:34:20.936 [ 7] I InProcessAttachmentReader:readFailed:reason=SDS is closed
2018-04-11 18:34:22.051 [ 7] E MediaPlayer:saveOffsetBeforeTeardown - gst_element_query_position failed
2018-04-11 18:34:22.052 [ 5] I DirectiveRouter:handleDirective:messageId=c9479426-ca26-444f-9f4d-8de917abd042,action=calling
2018-04-11 18:34:22.053 [ 7] E MediaPlayer:saveOffsetBeforeTeardown - gst_element_query_position failed
2018-04-11 18:34:22.075 [ 7] I InProcessAttachmentReader:readFailed:reason=SDS is closed
2018-04-11 18:34:22.097 [ 7] I InProcessAttachmentReader:readFailed:reason=SDS is closed
2018-04-11 18:34:22.589 [ 5] I DirectiveRouter:handleDirective:messageId=fa63da8c-7018-4552-a691-b0facc873ae3,action=calling
2018-04-11 18:34:22.589 [ 7] E MediaPlayer:saveOffsetBeforeTeardown - gst_element_query_position failed
2018-04-11 18:34:22.590 [ 7] E MediaPlayer:saveOffsetBeforeTeardown - gst_element_query_position failed
2018-04-11 18:34:22.599 [ 7] I InProcessAttachmentReader:readFailed:reason=SDS is closed
2018-04-11 18:34:22.653 [ 7] I InProcessAttachmentReader:readFailed:reason=SDS is closed
2018-04-11 18:34:23.895 [ 7] E MediaPlayer:saveOffsetBeforeTeardown - gst_element_query_position failed
2018-04-11 18:34:23.896 [ 5] I DirectiveRouter:handleDirective:messageId=32f179dc-ab48-49db-b9a5-f0f278241098,action=calling
2018-04-11 18:34:23.896 [ 7] E MediaPlayer:saveOffsetBeforeTeardown - gst_element_query_position failed
2018-04-11 18:34:23.913 [ 7] I InProcessAttachmentReader:readFailed:reason=SDS is closed
2018-04-11 18:34:25.017 [ 7] I InProcessAttachmentReader:readFailed:reason=SDS is closed
2018-04-11 18:34:26.414 [ 7] E MediaPlayer:saveOffsetBeforeTeardown - gst_element_query_position failed
2018-04-11 18:34:26.414 [ 5] I DirectiveRouter:handleDirective:messageId=be65cde4-21e4-474a-b368-f2fd71b1f6a3,action=calling
2018-04-11 18:34:26.415 [ 7] E MediaPlayer:saveOffsetBeforeTeardown - gst_element_query_position failed
2018-04-11 18:34:26.431 [ 7] I InProcessAttachmentReader:readFailed:reason=SDS is closed
2018-04-11 18:34:48.505 [ 7] I InProcessAttachmentReader:readFailed:reason=SDS is closed
2018-04-11 18:34:49.881 [ 7] E MediaPlayer:saveOffsetBeforeTeardown - gst_element_query_position failed
2018-04-11 18:34:49.882 [ 5] I DirectiveRouter:handleDirective:messageId=693219c1-6d9c-45cc-8c11-b59c5899fcdd,action=calling
2018-04-11 18:34:49.882 [ 7] E MediaPlayer:saveOffsetBeforeTeardown - gst_element_query_position failed
2018-04-11 18:34:49.903 [ 7] I InProcessAttachmentReader:readFailed:reason=SDS is closed
2018-04-11 18:34:49.925 [ 7] I InProcessAttachmentReader:readFailed:reason=SDS is closed
2018-04-11 18:34:50.500 [ 7] E MediaPlayer:saveOffsetBeforeTeardown - gst_element_query_position failed
########################################

Alexa is currently idle!

########################################

@BennyAvramson
Copy link
Contributor

Hi @sescapa,

Seems like #479 could solve your issue.
Please let me know if it did.

Thanks,
Benny

@sescapa
Copy link
Author

sescapa commented Apr 11, 2018

It works! Thank you very much.

For any references for anyone who has used the step-by-step configuration:

  1. Change the MediaPlayer.cpp folder
    cd sdk-folder/sdk-source/avs-device-sdk/MediaPlayer/src
    sudo nano MediaPlayer.cpp or open in TextEditor (easier)
    Change

m_pipeline.audioSink = gst_element_factory_make("autoaudiosink", "audio_sink");

to

m_pipeline.audioSink = gst_element_factory_make("alsasink", "audio_sink");

  1. cd ~
    make SampleApp && TZ=UTC ./SampleApp "/home/pi/sdk-folder/sdk-buiild/Integration/AlexaClientSDKConfig.json" "/home/pi/sdk-folder/third-party/alexa-rpi/models" DEBUG9

  2. cd ~

  3. cd /home/pi/sdk-folder/sdk-build/SampleApp/src
    ./SampleApp /home/pi/sdk-folder/sdk-build/Integration/AlexaClientSDKConfig.json /home/pi/sdk-folder/third-party/alexa-rpi/models

Thank you @BennyAvramson

@BennyAvramson
Copy link
Contributor

Hi @sescapa,

I'm happy it worked for you and thanks for detailing the solution.

I'm closing the issue now, but feel free to reopen it if it's happening again.

Thanks,
Benny

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants