C# Windows Form App - choose output audio device

0

I'm trying to do some basic app, with System.Speech.Synthesis in c#

It's just a basic form with a text input and after pressing enter it reads the text using ss.SpeakAsync();

The goal is to play that sound on a exact audio output device on Windows but I can't achieve that.

  1. I've tried do it by windows settings, App volume and device preferences, but it doesn't work, not sure why.

enter image description here

I'm setting the correct device, but it plays on the "default" anyways, no matter what I do. It works with any other application correctly (like browser for example) bit with mine it doesn't. It works when I change all system audio to that device, but the main goal is that i want only this app to use "cable input".

  1. I've tried to use some 3rd party software to do this (https://github.com/a-sync/audio-router) but it doesn't work either. I set everything, and when I click "play" in my app, then my app crashes with an exception: „[17132] TrayReader.exe” exited with code -1073741819 (0xc0000005) 'Access violation'.

So maybe I'm able to set in the code the correct audio output device? Or how do I fix those previous errors? maybe I need to add some privileges or something? I'm mainly web developer, this is my first time with windows app.

//edit -> it works, when i change all my system audio to cable input, play some sound, and then go back to my main device. It seems like a windows bug?

c#
windows
audio
text-to-speech
asked on Stack Overflow May 10, 2020 by alanmcknee • edited May 10, 2020 by alanmcknee

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0