jneilliii / OctoPrint-M117SpeechSynthesis

5 stars 1 forks source link

Audio doesn’t play when “use speaker connected to pi directly” is checked #20

Closed Bluedragon2039 closed 6 months ago

Bluedragon2039 commented 7 months ago

Connected speaker does not start speaking when reading a m117 or @speak command.

jneilliii commented 7 months ago

How did you connect the speaker? Was it set as default audio output device? I've only tested this a long time ago and not sure if it's still compatible.

Bluedragon2039 commented 7 months ago

It was connected via USB, I’m a bit of a new user when it comes to audio though and I also tried to listen over the 3.5mm jack but couldn’t get any output.

I hadn’t set a default audio source but if you can run me through the setup I could give that a test and see if the problem stays. Ideally I’d like to change it over the web ui or config file since the setup I’m running lacks a screen.

jneilliii commented 7 months ago

it would be done over SSH if anything. I'm not really sure how to configure these things, but I guess the first step would be verifying that the speaker is working at all. Quick search on the process led me to this guide: https://gist.github.com/rnagarajanmca/63badce0fe0e2ad126041c7c139970ea

Bluedragon2039 commented 7 months ago

After changing defaults and trying a few speakers going from usb to the 3.5mm jack I haven’t been able to get any audio to play. I’ve also verified my gcode does have m117 commands in it. I have also done the ssh audio test and the speaker does work and play the test audio.

jneilliii commented 7 months ago

One thing you can double check is that the following system packages are installed (found from the python modules readme https://github.com/nateshmbhat/pyttsx3#linux-installation-requirements-)

sudo apt update
sudo apt install espeak libespeak1

Do you happen to see any errors in octoprint.log relative to the plugin? Feel free to upload the log here and I can take a look too if anything stands out.

If you can't get any audio to work from the underlying operating system (outside of what the plugin is doing), then I'm afraid the plugin will never be able to work.

Bluedragon2039 commented 6 months ago

Seems to work after installing and i can get it to run over the speaker too.

it’s only using the male voice over speaker though. Weird considering I changed that in settings.

jneilliii commented 6 months ago

After setting the voice and restarting OctoPrint it might pick up the different setting. Not 100% sure if all the ones available from the browser's options are available from the system side.

Bluedragon2039 commented 6 months ago

Tried restarting but the voice change didn’t seem to work. Would It be plausible to install new voices directly to the system side using something like ssh?

jneilliii commented 6 months ago

Looking at the python module I'm using it might be possible to change the voice, but I'm not 100% sure what's available. Could probably connect SSH and run these commands to see what it reports (you may need to copy/paste line by line).

source ~/oprint/bin/activate
python
import pyttsx3
engine = pyttsx3.init()
voices = engine.getProperty('voices')
for voice in voices:
   engine.setProperty('voice', voice.id)
   print(f"{voice.id}: {voice.name}")
   engine.say('The quick brown fox jumped over the lazy dog.')
   engine.runAndWait()

based on what I'm seeing I may need to add a separate list of available voices to choose from as these look to be language based, but the simple examples show that voices[0].id is male and voices[1].id should be female.

jneilliii commented 6 months ago

oh...and ctrl+z to exit python....

Bluedragon2039 commented 6 months ago

Here’s the list it put out. Also octoprint decided it wanted to audibly read every single one aloud lmao.

afrikaans: afrikaans aragonese: aragonese bulgarian: bulgarian bengali: bengali bosnian: bosnian catalan: catalan czech: czech welsh: welsh danish: danish german: german greek: greek default: default english: english en-scottish: en-scottish english-north: english-north english_rp: english_rp english_wmids: english_wmids english-us: english-us en-westindies: en-westindies esperanto: esperanto spanish: spanish spanish-latin-am: spanish-latin-am estonian: estonian basque-test: basque-test Persian+English-UK: Persian+English-UK Persian+English-US: Persian+English-US persian-pinglish: persian-pinglish finnish: finnish french-Belgium: french-Belgium french: french irish-gaeilge: irish-gaeilge greek-ancient: greek-ancient gujarati-test: gujarati-test hindi: hindi croatian: croatian hungarian: hungarian armenian: armenian armenian-west: armenian-west interlingua: interlingua indonesian: indonesian icelandic: icelandic italian: italian lojban: lojban georgian: georgian kannada: kannada kurdish: kurdish latin: latin lingua_franca_nova: lingua_franca_nova lithuanian: lithuanian latvian: latvian macedonian: macedonian malayalam: malayalam malay: malay nepali: nepali dutch: dutch norwegian: norwegian punjabi: punjabi polish: polish brazil: brazil portugal: portugal romanian: romanian russian: russian Full dictionary is not installed for 'ru' slovak: slovak albanian: albanian serbian: serbian swedish: swedish swahili-test: swahili-test tamil: tamil telugu-test: telugu-test turkish: turkish vietnam: vietnam vietnam_hue: vietnam_hue vietnam_sgn: vietnam_sgn Mandarin: Mandarin cantonese: cantonese Full dictionary is not installed for 'zhy'

jneilliii commented 6 months ago

It speaking it was actually expected, idea being you could here the difference.

Bluedragon2039 commented 6 months ago

Huh weird. They all sounded the same for some odd reason.