Jump to content

Recommended Posts

Posted

So I'm trying to modify a certain Mycroft skill (python) to be able to play local news. Here is the commit: https://github.com/marksev1/mycroft-core/commit/164c7207374131ece23a8ddf40c7a7981f3c7084

 

And this python script uses mpg123 to play the mp3 from the url.

 

1.) If I play the mp3 in the url from the terminal normally it plays every time.

 

2.) If I'd try to play it from that python script it only randomly plays and in the meantime i get errors regarding jack. See here, first time it succeeded then it failed multiple times: 

2016-09-05 14:11:02,437 - Skills - DEBUG - {"message_type": "speak", "context": null, "metadata": {"utterance": "Here is the top of the morning news from Slovenia."}}
2016-09-05 14:11:04,005 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_end", "context": null, "metadata": {}}
2016-09-05 14:11:04,008 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_start", "context": null, "metadata": {}}
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
        version 1.20.1; written and copyright by Michael Hipp and others
        free software (LGPL) without any warranty but with best wishes

Directory: http://videoweb.rtvslo.si/podcast/ava_archive03/2016/09/05/
Playing MPEG stream 1 of 1: Drugajutranjakronika38b3bdd8.mp3 ...

MPEG 1.0 layer III, 128 kbit/s, 48000 Hz joint-stereo
2016-09-05 14:11:06,860 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_end", "context": null, "metadata": {}}
2016-09-05 14:11:16,490 - Skills - DEBUG - {"message_type": "recognizer_loop:utterance", "context": null, "metadata": {"utterances": ["stop"]}}
2016-09-05 14:11:16,501 - Skills - DEBUG - {"message_type": "StopIntent", "context": {"target": null}, "metadata": {"StopKeyword": "stop", "intent_type": "StopIntent", "utterance": "stop", "confidence": 1.0, "target": null}}
2016-09-05 14:11:16,506 - Skills - DEBUG - {"message_type": "mycroft.stop", "context": null, "metadata": {}}
2016-09-05 14:11:16,514 - Skills - DEBUG - {"message_type": "speak", "context": null, "metadata": {"utterance": "news playback ended"}}
2016-09-05 14:11:16,567 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_start", "context": null, "metadata": {}}
2016-09-05 14:11:20,427 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_end", "context": null, "metadata": {}}
2016-09-05 14:11:21,025 - Skills - DEBUG - {"message_type": "recognizer_loop:utterance", "context": null, "metadata": {"utterances": ["news"]}}
2016-09-05 14:11:21,033 - Skills - DEBUG - {"message_type": "SLONewsIntent", "context": {"target": null}, "metadata": {"SLONewsKeyword": "news", "intent_type": "SLONewsIntent", "utterance": "news", "confidence": 1.0, "target": null}}
2016-09-05 14:11:22,330 - Skills - DEBUG - {"message_type": "speak", "context": null, "metadata": {"utterance": "Here is this morning's news from Slovenia."}}
2016-09-05 14:11:22,391 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_start", "context": null, "metadata": {}}

[jack.c:252] error: Failed to open jack client: 0x1
[jack.c:58] warning: FIXME: One needs to wait or write some silence here to prevent the last bits of audio to vanish out of the ringbuffer.
2016-09-05 14:11:28,094 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_end", "context": null, "metadata": {}}
2016-09-05 14:11:49,225 - Skills - DEBUG - {"message_type": "recognizer_loop:utterance", "context": null, "metadata": {"utterances": ["stop"]}}
2016-09-05 14:11:49,236 - Skills - DEBUG - {"message_type": "StopIntent", "context": {"target": null}, "metadata": {"StopKeyword": "stop", "intent_type": "StopIntent", "utterance": "stop", "confidence": 1.0, "target": null}}
2016-09-05 14:11:49,241 - Skills - DEBUG - {"message_type": "mycroft.stop", "context": null, "metadata": {}}
2016-09-05 14:11:56,488 - Skills - DEBUG - {"message_type": "recognizer_loop:utterance", "context": null, "metadata": {"utterances": ["news"]}}
2016-09-05 14:11:56,498 - Skills - DEBUG - {"message_type": "SLONewsIntent", "context": {"target": null}, "metadata": {"SLONewsKeyword": "news", "intent_type": "SLONewsIntent", "utterance": "news", "confidence": 1.0, "target": null}}
2016-09-05 14:11:57,787 - Skills - DEBUG - {"message_type": "speak", "context": null, "metadata": {"utterance": "Here is the top of the morning news from Slovenia."}}
2016-09-05 14:11:57,929 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_start", "context": null, "metadata": {}}

[jack.c:252] error: Failed to open jack client: 0x1
[jack.c:58] warning: FIXME: One needs to wait or write some silence here to prevent the last bits of audio to vanish out of the ringbuffer.
2016-09-05 14:12:04,471 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_end", "context": null, "metadata": {}}
2016-09-05 14:12:11,712 - Skills - DEBUG - {"message_type": "recognizer_loop:utterance", "context": null, "metadata": {"utterances": ["stop"]}}
2016-09-05 14:12:11,721 - Skills - DEBUG - {"message_type": "StopIntent", "context": {"target": null}, "metadata": {"StopKeyword": "stop", "intent_type": "StopIntent", "utterance": "stop", "confidence": 1.0, "target": null}}
2016-09-05 14:12:11,728 - Skills - DEBUG - {"message_type": "mycroft.stop", "context": null, "metadata": {}}
2016-09-05 14:12:14,560 - Skills - DEBUG - {"message_type": "recognizer_loop:utterance", "context": null, "metadata": {"utterances": ["news"]}}
2016-09-05 14:12:14,570 - Skills - DEBUG - {"message_type": "SLONewsIntent", "context": {"target": null}, "metadata": {"SLONewsKeyword": "news", "intent_type": "SLONewsIntent", "utterance": "news", "confidence": 1.0, "target": null}}
2016-09-05 14:12:15,866 - Skills - DEBUG - {"message_type": "speak", "context": null, "metadata": {"utterance": "Here is the top of the morning news from Slovenia."}}
2016-09-05 14:12:15,871 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_start", "context": null, "metadata": {}}

[jack.c:252] error: Failed to open jack client: 0x1
[jack.c:58] warning: FIXME: One needs to wait or write some silence here to prevent the last bits of audio to vanish out of the ringbuffer.
2016-09-05 14:12:23,311 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_end", "context": null, "metadata": {}}
2016-09-05 14:12:28,055 - Skills - DEBUG - {"message_type": "recognizer_loop:utterance", "context": null, "metadata": {"utterances": ["stop"]}}
2016-09-05 14:12:28,064 - Skills - DEBUG - {"message_type": "StopIntent", "context": {"target": null}, "metadata": {"StopKeyword": "stop", "intent_type": "StopIntent", "utterance": "stop", "confidence": 1.0, "target": null}}
2016-09-05 14:12:28,069 - Skills - DEBUG - {"message_type": "mycroft.stop", "context": null, "metadata": {}}
2016-09-05 14:12:29,447 - Skills - DEBUG - {"message_type": "recognizer_loop:utterance", "context": null, "metadata": {"utterances": ["news"]}}
2016-09-05 14:12:29,455 - Skills - DEBUG - {"message_type": "SLONewsIntent", "context": {"target": null}, "metadata": {"SLONewsKeyword": "news", "intent_type": "SLONewsIntent", "utterance": "news", "confidence": 1.0, "target": null}}
2016-09-05 14:12:30,784 - Skills - DEBUG - {"message_type": "speak", "context": null, "metadata": {"utterance": "Here is the top of the morning news from Slovenia."}}
2016-09-05 14:12:30,905 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_start", "context": null, "metadata": {}}

[jack.c:252] error: Failed to open jack client: 0x1
[jack.c:58] warning: FIXME: One needs to wait or write some silence here to prevent the last bits of audio to vanish out of the ringbuffer.
2016-09-05 14:12:38,300 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_end", "context": null, "metadata": {}}
2016-09-05 14:12:40,936 - Skills - DEBUG - {"message_type": "recognizer_loop:utterance", "context": null, "metadata": {"utterances": ["stop"]}}
2016-09-05 14:12:40,946 - Skills - DEBUG - {"message_type": "StopIntent", "context": {"target": null}, "metadata": {"StopKeyword": "stop", "intent_type": "StopIntent", "utterance": "stop", "confidence": 1.0, "target": null}}
2016-09-05 14:12:40,951 - Skills - DEBUG - {"message_type": "mycroft.stop", "context": null, "metadata": {}}

Can someone please help me debug I don't even know to which "jack" package this error is reffering, since I think I'm even not using this jack package...

Posted

I figured out that i can't run two terminals with mpg123 i get the same error (i'm running alsa not pulseaudio):

msev@orangepipc:~$ mpg123 http://videoweb.rtvslo.si/podcast/ava_archive03/2016/09/05/Drugajutranjakronika38b3bdd8.mp3

[jack.c:252] error: Failed to open jack client: 0x1
[jack.c:58] warning: FIXME: One needs to wait or write some silence here to prevent the last bits of audio to vanish out of the ringbuffer.
Segmentation fault

Regarding python. Still doesn't work. Now we have different errors 

2016-09-06 11:35:57,296 - Skills - DEBUG - {"message_type": "speak", "context": null, "metadata": {"utterance": "Sorry, I don't understand the phrase "}}
2016-09-06 11:35:57,347 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_start", "context": null, "metadata": {}}
2016-09-06 11:36:02,506 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_end", "context": null, "metadata": {}}
2016-09-06 11:36:02,806 - Skills - DEBUG - {"message_type": "recognizer_loop:utterance", "context": null, "metadata": {"utterances": ["news"]}}
2016-09-06 11:36:02,821 - Skills - DEBUG - {"message_type": "SLONewsIntent", "context": {"target": null}, "metadata": {"SLONewsKeyword": "news", "intent_type": "SLONewsIntent", "utterance": "news", "confidence": 1.0, "target": null}}
2016-09-06 11:36:04,177 - Skills - DEBUG - {"message_type": "speak", "context": null, "metadata": {"utterance": "Here is the top of the morning news from Slovenia."}}
2016-09-06 11:36:04,183 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_start", "context": null, "metadata": {}}

[alsa.c:170] error: cannot open device default

[audio.c:643] error: failed to open audio device

[audio.c:180] error: Unable to find a working output module in this list: alsa

[audio.c:545] error: Failed to open audio output module

[mpg123.c:913] error: Failed to initialize output, goodbye.
2016-09-06 11:36:11,617 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_end", "context": null, "metadata": {}}
2016-09-06 11:36:35,483 - Skills - DEBUG - {"message_type": "recognizer_loop:utterance", "context": null, "metadata": {"utterances": ["news"]}}
2016-09-06 11:36:35,492 - Skills - DEBUG - {"message_type": "SLONewsIntent", "context": {"target": null}, "metadata": {"SLONewsKeyword": "news", "intent_type": "SLONewsIntent", "utterance": "news", "confidence": 1.0, "target": null}}
2016-09-06 11:36:36,701 - Skills - DEBUG - {"message_type": "speak", "context": null, "metadata": {"utterance": "Here is the top of the morning news from Slovenia."}}
2016-09-06 11:36:36,706 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_start", "context": null, "metadata": {}}

[alsa.c:170] error: cannot open device default

[audio.c:643] error: failed to open audio device

[audio.c:180] error: Unable to find a working output module in this list: alsa

[audio.c:545] error: Failed to open audio output module

[mpg123.c:913] error: Failed to initialize output, goodbye.
2016-09-06 11:36:44,143 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_end", "context": null, "metadata": {}}
2016-09-06 11:36:54,091 - Skills - DEBUG - {"message_type": "recognizer_loop:utterance", "context": null, "metadata": {"utterances": ["news"]}}
2016-09-06 11:36:54,101 - Skills - DEBUG - {"message_type": "SLONewsIntent", "context": {"target": null}, "metadata": {"SLONewsKeyword": "news", "intent_type": "SLONewsIntent", "utterance": "news", "confidence": 1.0, "target": null}}
2016-09-06 11:36:55,358 - Skills - DEBUG - {"message_type": "speak", "context": null, "metadata": {"utterance": "Here is this morning's news from Slovenia."}}
2016-09-06 11:36:55,363 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_start", "context": null, "metadata": {}}

[alsa.c:170] error: cannot open device default

[audio.c:643] error: failed to open audio device

[audio.c:180] error: Unable to find a working output module in this list: alsa

[audio.c:545] error: Failed to open audio output module

[mpg123.c:913] error: Failed to initialize output, goodbye.
2016-09-06 11:37:01,066 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_end", "context": null, "metadata": {}}
2016-09-06 11:37:04,891 - Skills - DEBUG - {"message_type": "recognizer_loop:utterance", "context": null, "metadata": {"utterances": ["news"]}}
2016-09-06 11:37:04,900 - Skills - DEBUG - {"message_type": "SLONewsIntent", "context": {"target": null}, "metadata": {"SLONewsKeyword": "news", "intent_type": "SLONewsIntent", "utterance": "news", "confidence": 1.0, "target": null}}
2016-09-06 11:37:06,118 - Skills - DEBUG - {"message_type": "speak", "context": null, "metadata": {"utterance": "Here is this morning's news from Slovenia."}}
2016-09-06 11:37:06,154 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_start", "context": null, "metadata": {}}

[alsa.c:170] error: cannot open device default

[audio.c:643] error: failed to open audio device

[audio.c:180] error: Unable to find a working output module in this list: alsa

[audio.c:545] error: Failed to open audio output module

[mpg123.c:913] error: Failed to initialize output, goodbye.
2016-09-06 11:37:11,871 - Skills - DEBUG - {"message_type": "recognizer_loop:audio_output_end", "context": null, "metadata": {}}
2016-09-06 11:37:18,887 - mycroft.messagebus.client.ws - ERROR - Exception("Uncaught 'error' event.",)
2016-09-06 11:37:18,888 - mycroft.messagebus.client.ws - WARNING - Disconnecting on error, reconnecting in 1 seconds.
Posted

You may need to specify output device explicitly like this

def play_mp3(file_path):
    return subprocess.Popen(["mpg123", "-a hw:0", file_path])

or

def play_mp3(file_path):
    return subprocess.Popen(["mpg123", "-a hw:1", file_path]) 

In case this applications tries to run second instance of mpg123 while previous one didn't close yet, this will cause problems with default configuration for ALSA. You'll have to either set up dmix configuration for ALSA (explained here in the middle of the page) or install and configure Pulseaudio.

Posted

Yeah its probably that since if I do    #self.speak_dialog('slo.news')

It then plays the mp3 everytime from the script.

 

Also if i do it like this everything works:

 

    def handle_intent(self, message):
        try:
            self.speak_dialog('slo.news')
            time.sleep(2)
            data = feedparser.parse(self.url_rss)
            time.sleep(5)
            self.process = play_mp3(data['entries'][0]['links'][0]['href'])
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines