How do you change the audio device in using System.Speech.Synthesis - c#

I'm trying to use System.Speech.Synthesis to play text that is then output over a tapi modem.
SetOutputToDefaultAudioDevice() is easy enough to figure out, but I don't want the sound to come out of the speakers.
I think i need to use SetOutputToAudioStream, but I'm not sure how to use it and I can't find any examples ...
I tried changing the default device in the control panel, but that didn't work either :(
Insight anyone?
Thanks

Have you looked at the answers here? It has a brief example.
Also - if your modem supports TAPI, you should review the samples in the Windows SDK, in particular, the Simple Telephony sample in %windowssdkdir%\Samples\winui\speech\simpletelephony. This is written in C++, but it demonstrates how to get the audio device ID for the modem and to set the device ID for SAPI's audio stream.

You can change output of text to speech in control panel->speech recognition->text to speech->advanced. Then select "Use this audio output device" and select audio device to output text to speech.

Related

Handle microphone inputs in c #

I searched on Google, but I did not find much information about it. I was wondering if anyone had experience so that they knew a proper way to get data input from a microphone and also know how to play it. What I would like to do is a typical streaming app in C#, which takes audio from the microphone and sends it on the client application. I await advice, thank you.
There're many source codes available if you can use google and bing... If you want to build this application with C# programming language, then you need to know some basics of Network Programming in C#.
If you want build a program like voice chat. You will need grab the audio from the microphone using some technalogies like DirectSound, UDP packets and etc.
If you want build a video streaming application you can use several ways to get video streaming/conferencing with .net easily.
Use of plain Windows Media Encoder components, RTC Clients, voice/SIP, Sockets and etc.
So you have wide choice of managed technologies here. Another thing is Live Meeting at which you had no chance to take good look yet.
For those still interested I found the NAudio library really interesting: https://github.com/naudio/NAudio

Getting the input level of microphone in windows IOT Core UWP

I'm trying to get the actual input volume of a microphone while not recording.
My point is to start recording when sound go up some limit for a while.
I've found the NAudio nuget but it seems that's the wavein class dont exist in UWP.
How can i get the actual input volume of a microphone in c# whitout recording ?
I was looking for the same thing. Did you find anything?
If not, you can check this link
Windows IoT Core : Sensing Sound Levels
https://blog.falafel.com/windows-iot-core-sensing-sound/
It uses following components
1) Electret Microphone Amplifier – MAX9814 with Auto Gain Control
2) MCP3008 – 8 Channel 10-Bit ADC with SPI Interface
3) Pi Cobbler Plus
4) Your existing Raspberry Pi – Windows IoT Core Setup
In case if the above doesn't work try this Youtube URL and it might give you some hint to find the actual code: https://www.youtube.com/watch?v=f3Wt4xpkBYk
I have tried and tested the code as is in my project and it worked. Although there is hardware dependency such as you may need amplifiers to make it accurate otherwise small sounds doesn't work But then amplifiers need to be handled well otherwise smallest sounds make huge difference on the bar. I am trying to modify this to work with any USB microphone or computer so that I don't have to rely on mentioned hardware.

How to use system audio output to draw spectrum in my C# application

I want to display the spectrum of output audio of my windows C# application. Currently i am using NAudio Library to calculate information through PCM data of input file. But it seems that this process is taking a lot of time and processing in older systems configurations. So i was wondering if i can use the windows audio output data to do so. I meant this.
As you can see windows is generating green bar of current sound output. And it does recognize multiple outputs in MIXER. So is there any way to get this data and use in my application to escape extra calculation? And i haven't posted any code or my work as i am not sure how to do that and if that is even possible so kindly bear with me.
Thank. You.
Take a look at Stereomix which echos the computer's output as an input device. Listening to this input will be the probably easiest way to detect sounds playing. Also take a look at Loopback Recording.

Windows 8 Metro record audio (filter noise, change pitch)

Is it possible to record audio only when there is someone talking? I want to listen to the microphone and only start recording when the "volume" is greater than some noise level (meaning someone is talking) I also need to change the pitch of the recorded audio.
I tried MediaCapture class in C# but StartRecordToStorageFileAsync from a sample is not useable in my scenario. In Windows Phone I use XNA but I cannot find a similiar API in Windows 8.
Check this thread on MSDN forums: How to get the decibel with C#?
It seems like there is and probably will not be APIs for doing that in C#, Visual Basic or JavaScript and you need to do it in a native component.
The Core Audio/WASAPI APIs from the article mentioned in that thread should have what you need: Win32 and COM for Metro style apps (multimedia)
I think this document has a description of a sample for capturing audio from a Kinect sensor that might have relevant code samples showing how you would use GetBuffer() calls to get the buffer of raw audio samples that you could process to get the information you need.

Control sound line-in

How Can I control (tune up or down) the level of the line-in or microphone channel? and how can I visualize the spec (as a graph or something)?
Also see Alvas.Audio RecordPlay example http://alvas.net/alvas.audio.aspx
you can try using the mixer APIs to find the line in volume control. I've found it is very tricky to pick out the right one (especially if you want it to work in both XP and Vista/Win7). Have a look at .NET Voice Recorder for an example of how to use NAudio to do this.

Categories