dupa

Author Topic: Tell Hal to stop listening?  (Read 429 times)

knight2000

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Tell Hal to stop listening?
« on: February 27, 2019, 10:58:53 am »
Hi Guys,

Is there a command like <MICON> to have Hal stop listening? When I have speech recognition on and i tell Hal to play a song, i'd like him to stop listening, otherwise he responds to the song lyrics haha. If i turn the mic off then i cant turn it back on unless i type it in. I was hoping for some kind of command (function) to execute when i tell Hal to play a song then when the song is done i can say "start listening". Im pretty sure there is something like this already but i'm not sure what it was  :-\

Checker57

  • Newbie
  • *
  • Posts: 49
    • View Profile
Re: Tell Hal to stop listening?
« Reply #1 on: February 27, 2019, 05:00:49 pm »
((poof!)) Genie:   At Your command vocally or in text "Microphone On" OR "Microphone Off" HAL will obey.  Let it be done!

knight2000

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Re: Tell Hal to stop listening?
« Reply #2 on: February 28, 2019, 10:22:28 am »
Thanks for the response! I was hoping there was also a programmatic way of having Hal stop listening but I assume <MICON> and <MICOFF> would work.

onthecuttingedge2019

  • Jr. Member
  • **
  • Posts: 67
  • What sets you free...
    • View Profile
Re: Tell Hal to stop listening?
« Reply #3 on: February 28, 2019, 11:15:38 pm »
:)
G

knight2000

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Re: Tell Hal to stop listening?
« Reply #4 on: March 25, 2019, 06:28:47 pm »
Thats a good plugin but i need to be able to control Hal's mic externally.  Example would be if I tell Hal to play a song i would want Hal to turn off his mic while the song is playing then when the song is over turn his mic back on. I have a python script that will get song's length, i want to be able to use python to execute "Ultrahal.exe <SHOWHAL><MICON>" using the command prompt after the song ends. The problem is if Hal is already open, calling Ultrahal.exe <SHOWHAL><MICON> will only show Hal and not enable his mic :(

Any idea's on how to make something like this work?


onthecuttingedge2019

  • Jr. Member
  • **
  • Posts: 67
  • What sets you free...
    • View Profile
Re: Tell Hal to stop listening?
« Reply #5 on: March 25, 2019, 08:37:42 pm »
Thats a good plugin but i need to be able to control Hal's mic externally.  Example would be if I tell Hal to play a song i would want Hal to turn off his mic while the song is playing then when the song is over turn his mic back on. I have a python script that will get song's length, i want to be able to use python to execute "Ultrahal.exe <SHOWHAL><MICON>" using the command prompt after the song ends. The problem is if Hal is already open, calling Ultrahal.exe <SHOWHAL><MICON> will only show Hal and not enable his mic :(

Any idea's on how to make something like this work?

can you post the code you are using to play the music?
G

knight2000

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Re: Tell Hal to stop listening?
« Reply #6 on: March 26, 2019, 10:22:15 am »
Im using the vrMP3 plugin but i altered the code to grab the length of the song. See below

Code: [Select]
If vrToPlay <> "" Then
   If HalBrain.CheckTableExistence("vrMp3") = False Then
        GetResponse = "I dont have that song on file. "
   Else
     vrNameToPlay = HalBrain.QABrain(vrToPlay, "vrMp3", 0)
     If vrNameToPlay <> "" Then
        GetResponse = "Here you go! "
'HalCommands = HalCommands & "<MICOFF>"
Set objWSHShell = CreateObject("WScript.Shell")
    objWSHShell.Run(""""& vrNameToPlay &"""")
pos = InStrRev(vrNameToPlay, "\") +1
file = Mid(vrNameToPlay, pos)
Const LENGTH = 27
Dim oShell  : Set oShell  = CreateObject("Shell.Application")
Dim oFolder : Set oFolder = oShell.Namespace("C:\Users\vyaco\Desktop\Hal\music")
Dim oFile : Set oFile = oFolder.ParseName(file)
Dim strLength : strLength = oFolder.GetDetailsOf(oFile, LENGTH)
param1 = "music"
param2 = strLength
objWSHShell.Run hal_commands & param1 & " " & param2
     End If
   End If
   HalBrain.ReadOnlyMode = True
End If

The last line runs the python script and sends params.
Code: [Select]
objWSHShell.Run hal_commands & param1 & " " & param2
This is my python snippet for toggling Hal's mic
Code: [Select]
##PLAY A SONG
if command == "music":
command2 = sys.argv[2]
##Mbox('debug', command + " " + command2, 1)
subprocess.Popen([r'C:\Program Files (x86)\Zabaware\Ultra Hal 7\UltraHal7.exe', '<SHOWHAL><MICOFF>'])
t = command2
h,m,s = re.split(':',t)
print int(datetime.timedelta(hours=int(h),minutes=int(m),seconds=int(s)).total_seconds())
duration = int(datetime.timedelta(hours=int(h),minutes=int(m),seconds=int(s)).total_seconds())
##print command2
voice = open(voice_modulator,"w")
voice.writelines("turnoff")
voice.close()
##Mbox('duration', str(duration), 0)
time.sleep(duration)
voice = open(voice_modulator,"w")
voice.writelines("turnon")
voice.close()
subprocess.Popen([r'C:\Program Files (x86)\Zabaware\Ultra Hal 7\UltraHal7.exe', '<SHOWHAL><MICON>'])

So i need to be able to control Hal's mic via python

onthecuttingedge2019

  • Jr. Member
  • **
  • Posts: 67
  • What sets you free...
    • View Profile
Re: Tell Hal to stop listening?
« Reply #7 on: March 26, 2019, 08:57:49 pm »
Hi Knight.
I have done some research but because of microphone functions from system to system I would install a proggy called NirCMD.
from there you can get the function inside your code so it does what you want it to do  ;D

watch out for click bait.

Jerry 8)
G

knight2000

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Re: Tell Hal to stop listening?
« Reply #8 on: March 27, 2019, 10:08:12 am »
Thats a cool utility, but my problem is that once Hal is running, the command line args do not work. If i exit hal then run my python program, Hal starts up with the mic enabled. Sorry, i probably should have said that before. So even if i pull up a command prompt and execute C:\Program Files (x86)\Zabaware\Ultra Hal 7\UltraHal7.exe <SHOWHAL><MICON> while Hal is already running, his mic doesn't come on. I have to exit Hal completely in order for that command to work.