Jump to content

Audio Hotkey and Microphone Input


Recommended Posts

Any idea how to take an audio file (I don't have a preference which kind – mp3, wav, etc.) and play it by means of a hotkey in such a way that the sound is heard by the user, and, at the same time, the sound is sent into the microphone input as though a microphone heard the sound?

Context: At work, I answer VoIP calls all day long with the same greeting. I want to poke a button and have the greeting done automatically in a way that I know it was done.

Link to comment
Share on other sites

I've done something similar when I needed to record a new greeting by playing a text-to-voice audio file, over VoIP, to one of my phone numbers.  I dial the number, go to the option to record a new greeting, and play the audio file when prompted, with the "Stereo Mix" device enabled.  The audio could be heard by me as well as over the VoIP call.  My VoIP app allows me to use the Stereo Mix device as input.  There are too many unknowns about your set up to know if it will work for you. 

Don't know what the Stereo Mix recording device is or how to use it?  Then google it, this is an AutoIt forum not an audio forum.  As for how to launch an audio file using a hotkey, you can look at the HotKeySet() example and adapt it to your needs.

Edited by TheXman
Link to comment
Share on other sites

Just want to make sure I'm following your idea. Are you thinking something like this?

#include <GUIConstants.au3>

AutoItSetOption("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)

Global $Main_GUI = GUICreate("", 162, 100)
   GUISetOnEvent($GUI_EVENT_CLOSE, "Close_Function")
   GUISetOnEvent($GUI_EVENT_MINIMIZE, "Close_Function")
   GUISetOnEvent($GUI_EVENT_RESTORE, "Close_Function")
HotKeySet("{F1}", "F1_Hotkey")
GUISetState(@SW_SHOW, $Main_GUI)

While 1
   Sleep(10)
WEnd

Func Close_Function()
   Select
      Case @GUI_CtrlId = $GUI_EVENT_CLOSE
         Exit
      Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
      Case @GUI_CtrlId = $GUI_EVENT_RESTORE
   EndSelect
EndFunc

Func F1_Hotkey()
;Something involving stereo mix
SoundPlay("Greeting.mp3")
;Something involving stereo mix
EndFunc

 

Edited by baconaise
Commented the lines out properly
Link to comment
Share on other sites

From your description, there's no need for a GUI. 

F1 is the commonly accepted function key for Help.  I would certainly NOT use F1. 

The "Stereo Mix" device has nothing to do with AutoIt.  It is an audio device that, if it exists, can be found under audio recording devices.  You obviously did not google  what it is and how to use it. 

Link to comment
Share on other sites

I don't use the F1 button at work, so it seemed a convenient choice.

My primary concern with what I understand your idea to be is that it would backfeed any sound the caller makes back to the caller, which I would prefer to avoid.

Link to comment
Share on other sites

17 minutes ago, baconaise said:

I don't use the F1 button at work, so it seemed a convenient choice.

It doesn't matter whether you use F1 or not.  Other running apps most likely do, including Windows itself.  So that statement shows a total lack of understanding of hotkeys.

 

17 minutes ago, baconaise said:

My primary concern with what I understand your idea to be is that it would backfeed any sound the caller makes back to the caller, which I would prefer to avoid.

You have obviously misunderstood what I said and described.

 

Have a good day or night, whichever the case may be.  :bye:

Edited by TheXman
Link to comment
Share on other sites

What I've been able to glean from the conversation up to this point is that TheXman thinks the best way for me to answer my soft phone at work with a recorded greeting is by using Stereo Mix as an input device, which would allow the audio played by my computer to be sent as a microphone input. That plan sounds to me like it would send feedback to the caller if they talked during the greeting, which I would prefer to avoid.

Is that a reasonable concern?

If so, does anyone have another method of playing a file so that only that sound (and not all computer sounds) output goes into the microphone?

If not, what do you think would be the best way to implement the switch between microphone and stereo mix?

Link to comment
Share on other sites

1 hour ago, baconaise said:

What I've been able to glean from the conversation up to this point is that TheXman thinks the best way for me to answer my soft phone at work with a recorded greeting is by using Stereo Mix as an input device, which would allow the audio played by my computer to be sent as a microphone input.

Please don't mischaracterize what I said.  I told you that I've done something similar that works for me and suggested that it might work for you too.  I didn't say anything about it being the "best way" for you.  As a matter of fact, I explicitly stated that there are too many unknowns to know if it will work for you.  :idiot:

:ranting:

 

Edited by TheXman
Link to comment
Share on other sites

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...