Sound and/or Speech
13 Sep 2018 12:39 - 13 Sep 2018 12:44 #117454
by Askjerry
Sound and/or Speech was created by Askjerry
I was watching a (Mach 3) video where they use what looks like VB script... in this they had a probe routine, and during the routine the computer said, " 3, 2, 1" before a tool movement, and "Tool Complete" when it was done. It also played a beep sound at the end.
Video:
In VB or VBA in Excel I can script that easy... Application.Speech.Speak("Have a nice day") for example...
Now I am wondering if a G-Code can post to an external program? It would be great if I could call a speech program and have it say something like "Insert the tool" or whatever... I've found some software that would probably work...
askubuntu.com/questions/501910/how-to-te...t-using-command-line
Another way would be to play a WAV or MP3... I could make "canned" phrases and call them. I could for example have "countdown.wav" then call it and pause until done.
Got any (simple) ideas??
Jerry
Video:
In VB or VBA in Excel I can script that easy... Application.Speech.Speak("Have a nice day") for example...
Now I am wondering if a G-Code can post to an external program? It would be great if I could call a speech program and have it say something like "Insert the tool" or whatever... I've found some software that would probably work...
askubuntu.com/questions/501910/how-to-te...t-using-command-line
Another way would be to play a WAV or MP3... I could make "canned" phrases and call them. I could for example have "countdown.wav" then call it and pause until done.
Got any (simple) ideas??
Jerry
Last edit: 13 Sep 2018 12:44 by Askjerry.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
13 Sep 2018 14:15 - 13 Sep 2018 14:26 #117460
by Todd Zuercher
Replied by Todd Zuercher on topic Sound and/or Speech
I think you could use a custom M-code (M1xx) to call up a saved sound file
something like:That will not pause the machine while the sound plays. If you delete the & at the end of the command it will pause while the sound plays and then resume.
something like:
#M100
#!/bin/bash
aplay /usr/share/sounds/speech-dispatcher/test.wav &
exit 0
Last edit: 13 Sep 2018 14:26 by Todd Zuercher.
Please Log in or Create an account to join the conversation.
14 Sep 2018 03:56 #117499
by cmorley
Replied by cmorley on topic Sound and/or Speech
In my qtvcp branch, i support speech using espeak libraries.
I like python so my solution would be something like this:
Of course you need the espeak libraries installed:
sudo apt-get install espeak
Should do it.
The voice is not great but is usable.
Chris M
I like python so my solution would be something like this:
import os
cmd = ' Insert Tool 1'
os.system('''espeak -s 160 -v m3 -p 1 "%s" &'''% cmd)
Of course you need the espeak libraries installed:
sudo apt-get install espeak
Should do it.
The voice is not great but is usable.
Chris M
Please Log in or Create an account to join the conversation.
15 Sep 2018 01:54 - 15 Sep 2018 01:58 #117563
by Askjerry
Replied by Askjerry on topic Sound and/or Speech
Ok... I'll start to evaluate these...
Todd Zuercher - Your method looks like it would call up ONE sound per M-Code as written. If I can pass a variable... like M100 P1 for example... that will work great. I'll have to tinker and report back with my findings.Also... stopping the machine while it plays would be undesired... if anything I would have it say "Three" and do a G4 P1, then "Two" G4 P1... etc.
The timing would sound better.
Or... just record 3..2..1.. and a sound... then do a G4 P3 right after it... yeah... I'm digging that idea.
Cmorley - So if I understand you... then I could do something like this in the G-Code...
I'll give that a try as well... but I already installed spd-say... it worked pretty well... so I may try that first.
Ultimately... if the playing of a WAV or MP3 works... likely I'll go that way as the end user won't need to install anything... I already have a folder IMAGES, and another ROUTINES in my configurations... so adding SOUNDS is not a far cry... and I can make some spiffy recorded voices. (I have access to a BUNCH of synthesis options for Windows... so I can create the files and put them in the folder.
Thanks... this will give me something to experiment with.
Jerry
Todd Zuercher - Your method looks like it would call up ONE sound per M-Code as written. If I can pass a variable... like M100 P1 for example... that will work great. I'll have to tinker and report back with my findings.Also... stopping the machine while it plays would be undesired... if anything I would have it say "Three" and do a G4 P1, then "Two" G4 P1... etc.
The timing would sound better.
Or... just record 3..2..1.. and a sound... then do a G4 P3 right after it... yeah... I'm digging that idea.
Cmorley - So if I understand you... then I could do something like this in the G-Code...
G21 M90
import os
cmd = ' Insert Tool 1'
os.system('''espeak -s 160 -v m3 -p 1 "%s" &'''% cmd)
M6 T1
...
...
M2
I'll give that a try as well... but I already installed spd-say... it worked pretty well... so I may try that first.
Ultimately... if the playing of a WAV or MP3 works... likely I'll go that way as the end user won't need to install anything... I already have a folder IMAGES, and another ROUTINES in my configurations... so adding SOUNDS is not a far cry... and I can make some spiffy recorded voices. (I have access to a BUNCH of synthesis options for Windows... so I can create the files and put them in the folder.
Thanks... this will give me something to experiment with.
Jerry
Last edit: 15 Sep 2018 01:58 by Askjerry. Reason: Grammar
Please Log in or Create an account to join the conversation.
15 Sep 2018 02:52 #117564
by cmorley
No the code must be in a user M code unfortunately.
spd-say and espeak sound the same on my system.
Chris M
Replied by cmorley on topic Sound and/or Speech
Ok... I'll start to evaluate these...
Cmorley - So if I understand you... then I could do something like this in the G-Code...
G21 M90 import os cmd = ' Insert Tool 1' os.system('''espeak -s 160 -v m3 -p 1 "%s" &'''% cmd) M6 T1 ... ... M2
I'll give that a try as well... but I already installed spd-say... it worked pretty well... so I may try that first.
Jerry
No the code must be in a user M code unfortunately.
spd-say and espeak sound the same on my system.
Chris M
Please Log in or Create an account to join the conversation.
15 Sep 2018 02:54 #117565
by cmorley
Replied by cmorley on topic Sound and/or Speech
If you remapped the toolchange routine you could have it speak the tool number, while still using regular gcode - but that is not simple like you asked.
Chris M
Chris M
Please Log in or Create an account to join the conversation.
15 Sep 2018 03:02 #117566
by Askjerry
Replied by Askjerry on topic Sound and/or Speech
The whole idea was during a probe routine to basically tell them the probe was going to move, and afterward that it was finished.
Basically... a polite/cool way to say, "Get your fat fingers out of my way!"
... a little "wow" factor for my video series... and I really appreciate the help!
Jerry
Basically... a polite/cool way to say, "Get your fat fingers out of my way!"
... a little "wow" factor for my video series... and I really appreciate the help!
Jerry
Please Log in or Create an account to join the conversation.
15 Sep 2018 03:22 - 15 Sep 2018 03:28 #117567
by Askjerry
Replied by Askjerry on topic Sound and/or Speech
Todd Zuercher - I just tried the play sound method... it crashed with a number parsing error. I think the "#" threw it off.
Here is the G-Code file...
I also tried the other method... also failed...
And with the other speech program... also failed.
Jerry
Here is the G-Code file...
(Sound Test)
G21 G90
(Attempt Sound)
#!/bin/bash
aplay ./SOUND/beep.wav &
exit 0
(Sound complete)
M2
I also tried the other method... also failed...
(Sound Test)
G21 G90
(Attempt Sound)
import os
cmd = ' Insert Tool 1'
os.system('''espeak -s 160 -v m3 -p 1 "%s" &'''% cmd)
(Sound complete)
M2
And with the other speech program... also failed.
(Sound Test)
G21 G90
(Attempt Sound)
import os
cmd = ' Insert Tool 1'
os.system('''spd-say &'''% cmd)
(Sound complete)
M2
Jerry
Last edit: 15 Sep 2018 03:28 by Askjerry.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
15 Sep 2018 11:34 #117572
by Todd Zuercher
Replied by Todd Zuercher on topic Sound and/or Speech
The code I posted worked on a VM test machine. But it has to be in a custom m-code.
Please Log in or Create an account to join the conversation.
16 Sep 2018 14:13 #117604
by andypugh
Create a plain text file called m100.
Put the bash script in that file. Save it in your config folder (or anywhere else in the SUBROUTINE_PATH) and make it executable.
Then M100 in the G-code will run that script.
Replied by andypugh on topic Sound and/or Speech
Todd Zuercher - I just tried the play sound method... it crashed with a number parsing error. I think the "#" threw it off.
Create a plain text file called m100.
Put the bash script in that file. Save it in your config folder (or anywhere else in the SUBROUTINE_PATH) and make it executable.
Then M100 in the G-code will run that script.
Please Log in or Create an account to join the conversation.
Time to create page: 0.161 seconds