Mute specific audio inputs with Win MMDevice API - c#

I have a very specific requirement where I need to mute the "Auxiliary" input. I am already using the Windows Core Audio APIs like EndpointVolume & MMDevice.
Scenario
I need to mute the auxiliary output volume here in order to achieve the desired effect.
Pictured below is the audio device and it's properties.
Issues
Using MMDeviceEnumerator it doesn't appear that the endpoint depicted above includes any of the "output volume levels" displayed in the second half of that screenshot.
Muting the actual recording device (Auxiliary) does not actually mute what is heard.
This must be as simple as possible with as little human interaction as possible. The environment will be controlled entirely via the application as it is a kiosk. The screenshots below indicates what I am referring to when I say "auxiliary recording device which when muted, does nothing":
Is there a hidden place that the Levels tab's individual "input output levels" exist? I cannot find it anywhere within MMDevice which means I am currently unable to mute this device through code. Thanks for reading.

If you have installed (most likely) the windows SDK. You can have a look at this example:
C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\multimedia\audio\EndpointVolume
Does that enumerate your device that plays the auxiliary input?

Related

How to add a custom Windows audio input?

I have a Bluetooth Low Energy (BLE) device that streams audio through a custom service, and need to be able to use it in any Windows application (e.g. stream the audio to Skype or Google Chrome for example). I believe the only way is to make this audio source appear as a standard Windows audio input, but how to do this ?
I think the most reliable way to interract with a BLE device is through UWP (using Windows.Devices.Bluetooth.BluetoothLEDevice), so I used it to get the audio data. Then, I used the Windows.Media.Audio.AudioGraph to interract with the audio system. I'm able to generate the Windows audio stream from the BLE audio data with the AudioFrameInputNode and output it to my application default output with AudioDeviceOutputNode.
I can't override the default system audio input and audio output (e.g the laptop microphone and speakers) so in order to be able to use the output from my application as an input in other application, I used VB-Audio (https://www.vb-audio.com/) combined with the "App volume and device preferences" Windows feature. This way, I can use the VB-Audio Cable to connect the output of my application to the input of another, without having to set them as default system devices.
In theory, this should do what I need to do, but in fact, this setup isn't reliable.
I don't understand why, but the behavior isn't consistent at all. Most of the time, changing the audio settings (from "App volume and device preferences" and the "Audio devices panel") have no effect. With the same settings, sometimes it works but sometimes it doesn't (audio from my application is played on speaker instead of VB-Cable input, etc.)...
I don't know where the problem comes from, VB-Audio or Windows itself ? Is there a more reliable alternative to this setup ?
Otherwise, is there another way to use a custom audio source from an application like a standard Windows audio input ?
Please let me know if anything is unclear or you need any more information.
EDIT:
I think this post is actually about the same issue that I'm facing.

Using C# WinForms, how do you modify system audio output, ie for equalizing audio?

I would like to write a C# winforms app to control the EQ of my system sound output. I have found ways to manipulate specific sources of audio, such as the microphone or playing a specific mp3 file, but would like the equalizer to be able to modify the system output generally.
How do you access the system audio output and manipulate it before it hits the speakers?
That is dependent on your audio drivers. Only some drivers integrate EQ control into Windows audio settings. Others use a custom control panel (like DTS Sound Control). I don't think there is a reliable solution to directly access the EQ settings.

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.

Change system volume in Windows Phone 8

Up until now I thought that changing the system volume from your app is impossible, until recently a new app called Quite Hours (http://www.windowsphone.com/en-us/store/app/quiet-hours/f347a36b-80c0-430f-8631-e55046ee5a2a) actually did just that in a very neat way.
Does anyone please know how to do that programmatically? I tried using the MediaElement or the xna MediaPlayer and the backgroundAudioPlayer and nothing worked. Any help would be appreciated!
Thank you!
The developers of the apps mentioned in the OP were able to change system volume under WP8.0. Apparently whatever method they used has now been disabled under WP8.1. The following apps now display disclaimers that they no longer work on Windows Phone 8.1: Quiet Hours and Volume Manager
They direct to the following page to vote to allow this functionality: Windows Phone Dev User Voice
Additionally please read the following thread on the MSDN forum: MSDN change system volume Windows Phone 8. This functionality was likely achieved using WASAPI (which I have personally tried, and failed, it does not work, comment if you want my code to try it.), or the developers of the volume apps might have had access to AudioClientRestricted.h. If one had that h file, one would have access to system volume under WP8.1, so I somehow doubt the developers used the h file designated for OEMs because it would work un 8.1.
Talking with James Dailey (who works # MSFT) indicates it is technically possible using WASAPI ISimpleAudioVolume If you read # the bottom of that page there is a comment indicating you must use IAudioEndpointVolume
Added note from James Dailey # MSFT:
AFAIK there is no good way to manipulate the global audio level on
Windows Phone 8.1 (WP8.1). Theoretically you can change the audio
volume of any app that uses the default audio session “zero”. However,
if the app chooses to initialize it’s audio session with a custom
GUID you will not have access to the session volume for its custom
audio session. Again this is theoretical based on my knowledge of the
inner workings of WASAPI. I’ve never actually tried it on the phone.
To manipulate the audio volume of apps using audio session “zero” you
simply initialize your IAudioClient with an AudioSessionGuid parameter
of “{00000000-0000-0000-0000-000000000000}”. You can then use
ISimpleAudioVolume::SetMasterVolume to set the volume for this audio
session. You will need to use C++ / Cx since we do not support
calling WASAPI from managed code.
There currently is no API available for controlling the system volume. You can however control the volume in the elements of your application (via the classes MediaElement, BackgroundAudioAgent).
You can also control the volume on sound effects of your application using XNA API.
See http://msdn.microsoft.com/en-us/library/bb195052%28v=xnagamestudio.30%29.aspx

Change barcode scan beep volume for motorola devices

I am developing some .net applications with c# for various Motorola devices running Windows Mobile and Windows CE. These include the MC9190 and the WT41N0. On these two models, it beeps very loudly when a barcode is scanned. Is there anyway using the Motorola emdk or by changing a registry setting to make the beep quieter without turning the beep off altogether.
I don't know if this works for all Motorola devices, but you could try including Symbol.Audio and:
using Symbol.Audio;
...
using (StandardAudio audio = new StandardAudio(Device.AvailableDevices[0]))
{
audio.BeeperVolume = 1;
}
You can inspect the audio.BeeperVolumeLevels property to see what the maximum volume level is.
In Symbol scanner terminology this is called "feedback", and by default it's the local feedback setting that gets in the way of properly managing the audio.
In your application, after you create the reader, the following settings control it:
_BarcodeReader.Parameters.Feedback.Success.BeepFrequency = 2000
_BarcodeReader.Parameters.Feedback.Success.BeepTime = 20
_BarcodeReader being the reader object. I set it to lower frequency for a shorter time above.
If you need to eliminate the beeping altogether:
_BarcodeReader.Parameters.Feedback.Success.BeepTime = 0
You may want to add your own wave file:
_BarcodeReader.Parameters.Feedback.Success.WaveFile = "decode.wav"
This is also the case with the DataWedge software that ships with MC9xxx and MC3xxx series. If you're using DataWedge, look for "local feedback" under the feedback menu, from Scanner, under Basic configuration.
The scan audio can only be managed from the feedback settings, volume control and other methods have no effect. It seems Zebra (previously Motorola) used high-volume default for loud industrial settings, wish they had considered a better way to configure though.
I put a piece of Scotch tape over the speaker on mine.
The tape dampens most of the noise while I am testing here at my desk, but it is simple to remove so they can hear it out on the floor.
Outside or on our production floor, they need the loud noise.
If that doesn't work for you, in the Settings on our Datalogic Falcons, there is a Decoding application. One of the inputs there is called Audio and enables someone to turn down the volume.
Since I don't have the SDK for the Datalogic Falcon, I can only post a low resolution cell phone clip. Hope this helps.
There is a configuration utility for motorola devices. It is a single exe file you can put on your device and then you can adjust several settings and also the beeper volume. I had a look on support.symbol.com but I didn't found it. I think you can get it from your vendor-support.
In our situation with a Motorola MC9590 device using telnet sessions, the volume control on the left-side of the device needs to be adjusted down prior to signing into the telnet session. The volume level remains at the established setting once the user signs into their telnet session.
The volume can be controlled by pressing the blue function key and then the H or M key. The display brightness can be controlled by pressing the blue function key and then the D or I key.
the way I made it silence was : go to control panel -> All control panel items -> Devices and Printers. find the Symbol bar code and right click and select Keyboard settings, on the speed box you will see a Repeat delay icon just drag that all the way to the left and the sound should go away.

Categories