That’s right, I change the path (via profile.json) of the Python file (it’s on the desktop). I said “Hello” and nothing happened, I’m doing something wrong?
Note 1: I change the patch manually from the file (profile.json), and also change it from the web (from the web I only change the patch and the file profile.json was automatically changed).
Note 2: With the 2nd code all the commands are executed correctly via websocket, but I guess it is not the right way to do it, right?
If you’re using Docker, make sure that you give the running container access to /path/to/program with a -v /path/to:/path/to in the docker run command.
It does not do anything when I say a phrase, I am waiting for when I call the robot react according to the code (honestly I do not know what the typical operation is).
The code that I put on robot.py was this:
Under “Hello” I add that it reproduces an audio when you recognize it, but nothing happens.
This is what comes out in the log, I assure you that the attempt that registers the log is the same as I place in the code:
Note: When I try the second code and I run the Python with Socket works well, the first code I do not run, I guess the first code I should not execute it.
With “Execute” I mean that in console I run Python3 + Path. The code 1 I do not run it, I suppose that Rhasspy does it and that’s why I must place the path in profile.json
The code 2 (the one you have socket) if I run and when I pronounced a phrase the robot recognizes it and runs the conditional that places in the code.
I say it because I want it to be clear what I do, so you can help me with a better precision. Also, because I do not know what “intent handling” of Rhaspy, so he would appreciate it if you explain me, please.
Please post your log from Rhasspy, your whole log from where the intent is Recognized to the end of the session.
There might be an obvious error in it.
Would it be too much to ask you to show me the example that works for you? Please. So I tell you the exact configuration and I rule out that it is a problem in my environment or not. Please.
Yes, I am using Docker. The problem is that I think I have everything as you tell me. Because I changed the profile.json manually exactly as you told me, and I also tried when the web configurations make the change (there are no errors in this step, because it is programmed by you in Docker).
Above the python file I put what you told me so that it recognizes that it must be run with Python3 (#!/usr/bin/env python3), it has all the permissions (I made sure of that, all the folders before reaching the final path have 777 permissions), and I also made sure of which path is the correct one because it has the same format as the WAV of the wakeword (this works and is in the same path of the profile_dir… ${RHASSPY_PROFILE_DIR}/).
Thanks to that log code I am seeing that it passes behind. I see that if you print the text you indicate, the problem is that it does not play the audio.
I have tried two things, in the first case what I did was to place the direct patch, and in 2nd case place the same as I put on the wakeup.
In the 1st case this comes out:
[DEBUG:2021-04-20 14:47:29,495] rhasspyremote_http_hermes: ['/profiles/es/handle.py']
[DEBUG:2021-04-20 14:47:29,503] rhasspywake_raven_hermes: Receiving audio
[DEBUG:2021-04-20 14:47:29,755] rhasspyremote_http_hermes: /home/pi/.config/rhasspy/profiles/es/wake.wav: No such file or directory
[WARNING:2021-04-20 14:47:29,756] rhasspyremote_http_hermes: Output: b'Hey there!\ntest-test-test\n'
…
cd /home/pi/.config/rhasspy/profiles/es/
ls
deepspeech handle.py profile.json sentences.ini supervisord.log wake.wav
In the 2nd case this comes out:
[DEBUG:2021-04-20 14:42:19,892] rhasspyremote_http_hermes: Traceback (most recent call last):
File "/profiles/es/handle.py", line 16, in <module>
os.system(f"aplay ${RHASSPY_PROFILE_DIR}/wake.wav")
NameError: name 'RHASSPY_PROFILE_DIR' is not defined
[WARNING:2021-04-20 14:42:19,893] rhasspyremote_http_hermes: Output: b'Hi!\n'
[DEBUG:2021-04-20 14:42:21,450] rhasspy-wake-raven: Exiting refractory period
As I said, thanks to that logs command I can see that if it works (I did not know that command, I’m new in this world, so sorry for not seeing it before).
What does not work is the execution of the commands, I do not know why.
ok cool, so handly.py is working
The ${RHASSPY_PROFILE_DIR} is not found in handle.py, because that variable is not known there.
Try it with os.system(f"aplay /home/pi/.config/rhasspy/profiles/es/sounds/wake.wav")
Assuming you have that in your profile, please check the path.
What is it that you want to achieve? The original code: speech(random.choice(replies))
should activate the Text to speech
Does this work in a terminal? aplay /home/pi/.config/rhasspy/profiles/es/sounds/wake.wav
[DEBUG:2021-04-20 14:58:24,629] rhasspyremote_http_hermes: /home/pi/.config/rhasspy/profiles/es/wake.wav: No such file or directory
In Terminal works and reproduces well:
aplay /home/pi/.config/rhasspy/profiles/es/wake.wav
Playing WAVE '/home/pi/.config/rhasspy/profiles/es/wake.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo
Is it honestly rare, there is some other way of playing audio? I will not use TTS.
It works on console, but not in the Python code of handle.py
[DEBUG:2021-04-20 18:05:55,459] rhasspyasr_deepspeech_hermes: Receiving audio
[DEBUG:2021-04-20 18:05:55,488] rhasspyremote_http_hermes: Warning: Couldn't read data from file "/home/pi/Desktop/wake.wav", this makes
Warning: an empty POST.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 85 100 85 0 0 1024 0 --:--:-- --:--:-- --:--:-- 1024
[DEBUG:2021-04-20 21:23:20,467] rhasspyremote_http_hermes: Traceback (most recent call last):
File "/profiles/es/handle.py", line 5, in <module>
from playsound import playsound
ModuleNotFoundError: No module named 'playsound'
The problem is that that comes out with other dependencies, most. I have them installed correctly, in console runs well.
From what I have read in various topics, your biggest problem is not understanding how docker works. I assume you are trying to get the script to run as command script and therefore you are running inside docker and the path “/home/pi/Desktop/demo.wav” does not exist inside docker.
From the way it sounds when you write English is not your native language (it isn’t mine either) and most problems you face come from not recognizing what is available inside docker and what is outside. You should find yourself an introduction into docker in your language somewhere on the internet and visit the script problem after you know how to get files into docker, what is available inside docker and what is on the host system. That is not something, the rhasspy forum does cover naturally and while we try to help you, you seem to run into the same problem over and over when trying out different approaches to how to play sound from rhasspy.
You have stuff installec on the host system, and your commands work there, but the host system is completely different to the system rhasspy runs inside docker, so naturally everything you try in there doesn’t work if you try it the same way you do on the host system. The host system of course finds “/home/pi/Desktop/demo.wav”, but you can think of a docker container as a completely different linux system, and what you install on the host, or what files you have on the host, just is not available naturally in there. So you have to learn about how docker works and how to get stuff inside docker, about how the paths are different between host system and docker in regards to the profile folder ("/profiles/es" inside docker and “/home/pi/.config/rhasspy/profiles/es” on the host system). Without you having that understanding, there is not much we can help you with on this forum.
You could say and only with that would have been enough.
But, all the other you said will appreciate it and take your advice. You’re right, but, up I’ve commented that I’m new on the subject, so I hope it has not been a lot of trouble.