alexa / avs-device-sdk

An SDK for commercial device makers to integrate Alexa directly into connected products.
https://developer.amazon.com/alexa/alexa-voice-service
Apache License 2.0
1.26k stars 604 forks source link

Solved: Speech synthesizer starts playing, playback. error=Could not open audio device for playback. source=audiosink #1118

Closed ghost closed 5 years ago

ghost commented 5 years ago
                                                                                                                                                     MEDIA_ERROR_INTERNAL_DEVICE_ERROR,error=reason\=gstElementSetStateFailure

Briefly summarize your issue:

Alexa reacts to wake word. Speech synthetizer starts playing, playback. error=Could not open audio device for playback. /GstPipeline\:audio-pipeline/GstAlsaSink\:audio_sink\: Playback open error on device 'default'\: No such file or directory

What is the expected behavior?

My soundcard is installed correctly. Edited MediaPlayer.cpp changing autoaudiosing to alsasink, as suggested in the Troubleshooting guide. Edited config.txt, disabling hdmi, forcing to use ext. soundcard. Should work now, since wake word is received.

What behavior are you observing?

I use external soundcard. Configured and tested properly. Wake word is received, playback not possible because of error message (see attachment). In the MediaPlayer.cpp the entry autoaudiosink was not on line 589, I found it a few lines later. It looks different from the code shown in the Troubleshooting guide. Related posts refer to avs-device-sdk/MediaPlayer/src/MediaPlayer.cpp, where I could not find the MediaPlayer.cpp file at that place. In my build I found it under avs-device-sdk/MediaPlayer/GStreamerMediaPlayer/src/MediaPlayer.cpp

So in the suggested line 589 there are differently coded entities, not exactly what is refered to in the troubleshooting guide.

std::string audioSinkElement; ConfigurationNode::getRoot()[MEDIAPLAYER_CONFIGURATION_ROOT_KEY].getString( MEDIAPLAYER_AUDIO_SINK_KEY, &audioSinkElement, "autoaudiosink"); m_pipeline.audioSink = gst_element_factory_make(audioSinkElement.c_str(), "$ if (!m_pipeline.audioSink) { ACSDK_ERROR(LX("setupPipelineFailed") .d("reason", "createAudioSinkElementFailed") .d("audioSinkElement", audioSinkElement)); return false; }

see also extract of error message I receive in the avs-app:

2018-12-06 12:39:31.428 [ 16] 9 MediaPlayer:playCalled 2018-12-06 12:39:31.429 [ 4] 0 MediaPlayer:handlePlayCalled:idPassed=1,currentI d=1 2018-12-06 12:39:31.431 [ 4] 0 MediaPlayer:handlePlay:startingState=PAUSED,stat eReturn=FAILURE 2018-12-06 12:39:31.431 [ 4] E MediaPlayer:handlePlayFailed::reason=gstElementS etStateFailure 2018-12-06 12:39:31.432 [ 4] 0 MediaPlayer:callingOnPlaybackError:type=MEDIA_ER ROR_INTERNAL_DEVICE_ERROR,error=reason\=gstElementSetStateFailure,currentId=1 2018-12-06 12:39:31.432 [ 4] 9 SpeechSynthesizer:onPlaybackError:callbackSource Id=1 2018-12-06 12:39:31.432 [ 16] 0 SpeechSynthesizer:executePlaybackError:type=MEDI A_ERROR_INTERNAL_DEVICE_ERROR,error=reason\=gstElementSetStateFailure

I ran test.sh. At the end it says: 99% tests passed, 1 tests failed out of 1073

Total Test time (real) = 336.37 sec

The following tests FAILED: 857 - NotificationRendererTest.testPlayDefaultStream (Failed) Errors while running CTest

Provide the steps to reproduce the issue, if applicable:

See attached textfile from opened session with wake word received ans aking a question to Alexa. At the end there is an error. Help me please interpreting the error message. See above where I pasted error message in.

Tell us about your environment:

Raspi 3B+ with fresh stretch with desktop Kernel 4.14

What version of the AVS Device SDK are you using?

Installed today

Tell us what hardware you're using:

Tell us about your OS (Type & version):

ghost commented 5 years ago

I left MediaPlayer.cpp unchanged; When I uncommented the last line from boot/config.txt again, it suddenly worked. But: Although I installed an external usb soundcard, I had to connect the external amplifier/speaker to the audio jack on the Raspi board. Connecting the audio output to the external soundcard does not work. The sound from that analog output is very good.

visayamv commented 5 years ago

Hi @ciptsrc , can you check if adding a dsnoop and dmix plugins will help? Please refer to https://github.com/alexa/avs-device-sdk/wiki/Troubleshooting-Guide under the RaspberryPi section for more details. Thanks.

ghost commented 5 years ago

@visayamv I thought on doing so - however the avs is now functioning very well, I had my first conversations with alexa, and the configuration as it is now is fine with me. The soundcard is a simple external usb adapter for the microphone because I have only a microphone with 3,5 mm audio jack. I learned a lot about the sdk and audio configuration. Thanks.

visayamv commented 5 years ago

Hi @ciptsrc , I'm glad everything is working now for you. I am closing this issue, but feel free to reopen if I closed it in error.