baconaise Posted January 6, 2021 Share Posted January 6, 2021 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 More sharing options...
TheXman Posted January 6, 2021 Share Posted January 6, 2021 (edited) 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 January 6, 2021 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
baconaise Posted January 7, 2021 Author Share Posted January 7, 2021 (edited) 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 January 7, 2021 by baconaise Commented the lines out properly Link to comment Share on other sites More sharing options...
TheXman Posted January 7, 2021 Share Posted January 7, 2021 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. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
baconaise Posted January 7, 2021 Author Share Posted January 7, 2021 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 More sharing options...
TheXman Posted January 7, 2021 Share Posted January 7, 2021 (edited) 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. Edited January 7, 2021 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
baconaise Posted January 7, 2021 Author Share Posted January 7, 2021 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 More sharing options...
TheXman Posted January 7, 2021 Share Posted January 7, 2021 (edited) 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. Edited January 7, 2021 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Nine Posted January 7, 2021 Share Posted January 7, 2021 If you want to create your own environment without the use of external apps, then your choice should go with the following interface : https://docs.microsoft.com/en-us/windows/win32/coreaudio/wasapi Search the forum for examples and UDF using the interfaces IMMDevice and WASApi. baconaise 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now