Aplay wav do not work

Dear ladies and gentlemen,

i want to play my own .wav file with an example Hello Word app. I edited the Hello World of the app accordingly in the action code on the snips platfrom.

First, I tried to implement the following command via snippets:

from subprocess import call
call ([ “sudo”, “aplay”, “/home/pi/Downloads/button.wav”])

Then I loaded the wizard on the Raspberry pi and also got the following error message:

Running setup.sh & generating virtual environment for snipshelloworld_speak
Setting Error setting up virtualenv, one or more actions might not be able to run. Reason:
DEPRECATION: Python 2.7 wants to reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 will not be maintained after that date. A future version of pip will drop support for Python 2.7.

Unfortunately, testing did not work. The trigger and the ASR is working.

Then I created the one git:


#!/usr/bin/env python2

-- coding: utf-8 --

import ConfigParser
from hermes_python.hermes import Hermes
from hermes_python.ontology import *
import io
from subprocess import call
import os
from builtins import bytearray

CONFIGURATION_ENCODING_FORMAT = “utf-8”
CONFIG_INI = “config.ini”

class SnipsConfigParser(ConfigParser.SafeConfigParser):
def to_dict(self):
return {section : {option_name : option for option_name, option in self.items(section)} for section in self.sections()}

def read_configuration_file(configuration_file):
try:
with io.open(configuration_file, encoding=CONFIGURATION_ENCODING_FORMAT) as f:
conf_parser = SnipsConfigParser()
conf_parser.readfp(f)
return conf_parser.to_dict()
except (IOError, ConfigParser.Error) as e:
return dict()

def subscribe_intent_callback(hermes, intentMessage):
conf = read_configuration_file(CONFIG_INI)
action_wrapper(hermes, intentMessage, conf)

def action_wrapper(hermes, intentMessage, conf):
current_session_id = intentMessage.session_id
hermes.publish_end_session(current_session_id, “Hello Testen zwei”)
call([“sudo”,“aplay”,"/home/pi/Downloads/button.wav"])

if name == “main”:
with Hermes(“localhost:1883”) as h:
h.subscribe_intent(“CrystalMethod:hello”, subscribe_intent_callback)
.start()


The TTS are play by the speaker which I do not want. It should play a .wav file. Means that do not work again.

Do you have an idea what I’m doing wrong here? Is it perhaps synonymous the error message with the Python2.7?

Looking forward to hear from you.

Best Regards

DDMW

I get a new hint.

I write the command sam service log snips-skill-server to the terminal and see this message:

server_lib::runner: [hello][err] ALSA lib pcm_hw.c:1713:(_snd_pcm_hw_open) Invalid value for card
Jun 16 15:49:34 raspberrypi snips-skill-server[4392]: INFO:snips_skill_server_lib::runner: [hello][err] aplay: main:788: Fehler beim Öffnen des Gerätes: Datei oder Verzeichnis nicht gefunden

In general I test the aplay with the audio file on the raspberrypi and it works.

I hope somebody have an idea.

Best Regards

DDMW