Training rhasspy for MPD (search) use

Hello

First the use case I’m trying to implement:

  1. The user says the wake word
  2. Rhasspy waits for the command
  3. The user says something like “play song X from performer Y” (or some variations of this)
  4. Rhasspy calls a script which searches the local MPD (music player daemon) songs and starts to play the desired one, using pulseaudio (in order to keep accepting rhasspy output).

Ok, since it is not currently possible to have slots for unknown words, I’m aiming for a brute force approach. I’m thinking of generating a list of songs and a list of performers directly from MPD. Then I would train all those as possible values for the slots “song” and “performer”.

Maybe a script could automate all that and generate files that could be read buy the regular rhasspy as some kind of “include files”.

Does it sound reasonable? What about the other components (intent engine, ASR, etc). Are there any recommendations?

Two ways to go here:

1.) Generate a list of songs and a list of artists with one song and one artist in each line and copy them into the rhasspy slots folder.

2.) Write a script that generates those two lists and copy those into the rhasspy slot programs folder, then rhasspy will call the script to generate the list while training.

The 2nd version is the better on as it updates automatically when you add new songs each time you train rhasspy but if you can’t access the files to generate the list from your rhasspy server, then you would need to generate the lists somewhere and copy it over.

A work around for copying the files is to upload them directly to rhasspy via HTTP:

/api/slots

Check the docs for more info: https://rhasspy.readthedocs.io/en/latest/reference/#http-api

I like the second idea. So how does rhasspy know what words belong to each slot? Is it because of the file name?

Each file will be a slot that can be used in the sentences you write. You can read more about it here. Note that it is the 2.4 documentation, I haven’t switched over to 2.5 yet and it might work differently there.

Great, thanks. I hope I get to this part soon.