Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Route audio to specific device?

Is there any decent way to route audio emitted from my application to a specific audio output device without having said device set as the default output device?

I am aware of software like CheVolume but I'm trying to rely as little as possible on other programs.
This would be difficult to accomplish without a library or something to help you out.
try out naudio, there is good documentation apparently, i see what you mean tho it is hard to find some answers on google.
"You can pick your friends, you can pick your nose, but you can't pick your friend's nose, because they usually get mad, butt we all know there hiding secrets in there" -James Bond
(Apr 3, 2018 02:43 AM)SlowMehMo Wrote:  This would be difficult to accomplish without a library or something to help you out.
try out naudio, there is good documentation apparently, i see what you mean tho it is hard to find some answers on google.

I'll have a look. It can obviously be done, I just lack knowledge about the subject. One would think there were already functions for this somewhere.


For anyone having similar issues you should be able to play sound files with specific audio devices with both NAudio(not looked up how) and Irrklang.
Example for Irrklang:
Code
'Get the list of installed sound devices.
dim sdl = new IrrKlang.ISoundDeviceList(IrrKlang.SoundDeviceListType.PlaybackDevice)

'Add each device to a combo box.
For i As Integer = 0 to sdl.DeviceCount
    comboBox1.Items.Add(sdl.getDeviceDescription(i) + "\n")
Next

'Place this code in your play sound event handler.
'Create a sound engine for the selected device (uses the ComboBox index to get device ID).
irrKlangEngine = new IrrKlang.ISoundEngine(IrrKlang.SoundOutputDriver.AutoDetect, _
                IrrKlang.SoundEngineOptionFlag.DefaultOptions, _
                sdl.getDeviceID(comboBox1.SelectedIndex))

'Play the selected file
playSelectedFile(fileName)

Now my new problem is figuring out how to use this with the SAPI speechLib...
(Apr 3, 2018 03:56 PM)PolarisGang Wrote:  I'll have a look. It can obviously be done, I just lack knowledge about the subject. One would think there were already functions for this somewhere.


For anyone having similar issues you should be able to play sound files with specific audio devices with both NAudio(not looked up how) and Irrklang.
Example for Irrklang:
Code
'Get the list of installed sound devices.
dim sdl = new IrrKlang.ISoundDeviceList(IrrKlang.SoundDeviceListType.PlaybackDevice)

'Add each device to a combo box.
For i As Integer = 0 to sdl.DeviceCount
   comboBox1.Items.Add(sdl.getDeviceDescription(i) + "\n")
Next

'Place this code in your play sound event handler.
'Create a sound engine for the selected device (uses the ComboBox index to get device ID).
irrKlangEngine = new IrrKlang.ISoundEngine(IrrKlang.SoundOutputDriver.AutoDetect, _
               IrrKlang.SoundEngineOptionFlag.DefaultOptions, _
               sdl.getDeviceID(comboBox1.SelectedIndex))

'Play the selected file
playSelectedFile(fileName)

Now my new problem is figuring out how to use this with the SAPI speechLib...

Are you doing the Text to speech thing or the voice recognition? I researched this for a little while a few months ago wanting to make mic spammer but then stopped now you got me interested again.
it also popped into my mind you could use CaffeineAU TTSAutomate to save text as a MP3 and then play it,
but there has to be a better method that doesnt drop to disk. Maybe still worth taking a look at how they handled the speech 😧
"You can pick your friends, you can pick your nose, but you can't pick your friend's nose, because they usually get mad, butt we all know there hiding secrets in there" -James Bond
(Apr 4, 2018 11:43 PM)SlowMehMo Wrote:  Are you doing the Text to speech thing or the voice recognition? I researched this for a little while a few months ago wanting to make mic spammer but then stopped now you got me interested again.
it also popped into my mind you could use CaffeineAU TTSAutomate to save text as a MP3 and then play it,
but there has to be a better method that doesnt drop to disk. Maybe still worth taking a look at how they handled the speech  😧

TTS ye. I'll take a look whenever I have free time.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by mutateMar 7, 2022 04:55 PM 3 118 Mar 7, 2022 04:55 PM
Last Post: foxegado
[Java] by jpaperJan 17, 2017 02:30 AM 0 123 Jan 17, 2017 02:30 AM
Last Post: jpaper
[C#] by ‌‌‌‌‌Thr‌‌‌‌‌Apr 27, 2014 12:29 PM 8 800 Apr 27, 2014 12:29 PM
Last Post: ‌‌‌‌‌Thr‌‌‌‌‌