How to mute chrome in c#? - c#

I am writing a program that will play sounds at a certain time. And I need to make it so that when the sound is played, chrome is muted. I need a function that will mute a certain process and also unmute it.

Related

C# Equalizer app for Windows Sound System

I would like to make an Equalizer app for Windows and apply settings for sound system. I've found many sound API like WASAPI, DirectSound but I don't know if I can use there to apply a filter in real time for all sounds. On C# there is CSCore to manipulate Audio sources but I don't know if I can use it for device.
The other solution is to create a virtual sound device on Windows. It get the actual sound output, transform it with a filter in real time and output this sound. But I don't know where to start to do this. This thing suppose to change to C++ but it is possible in C#?

Is there a way to intercept the sound coming out of my speakers so that I can insert a C#.NET software-based audio filter?

I suffer from tinnitus, and there are a number of sound-based therapies that I can use to mitigate the phantom sounds.
I would like to explore the possibility of processing the sound going to my headphones, or even my speakers, from my PC with a software-based filter.
Is there a way using C# to intercept the audio stream, process it (applying a band-pass filter for example), allowing it to continue to external devices?
I would suggest to use virtual audio device to capture the sound and transmit it to the real speakers after processing. I'm not sure if it is possible to create this using c#. But you can use existing drivers like vac. So you set vac as default device. You create a c# program which records from vac, does the processing, and sends it to the speakers.

Play sound when iPhone sound switch is on silent mode in xamarin.iOS

I want to play video with full sound, even i have the sound switch(positioned above volume buttons) set to silent mode. What i did is working on iOS 7.x and 8.1.x but doesn't work on 8.2. It's quite weird, not really sure. How to go about it. Any sample code will be appreciated.
I don't want to change to AVPlayer,at this stage, as i am almost ready for release
Here's what i have already tried and works in 7.x and 8.1.x
//I declare a class level variable
MPMusicPlayerController VolumeRocker;
//initialize it
VolumeRocker = MPMusicPlayerController.ApplicationMusicPlayer;
//Use it. I set this inside the click even of button
//which i use to start playback of video
VolumeRocker.Volume = 1f;
Am i missing something ? This works in following scenarios in 7.x and 8.1.x,(but doesn't work on iOS 8.2, not sure abt 8.3)
1) I switch to silent mode and start playing the video. I get to see the volume popup and i can hear the sound
2) I set the volume to zero with sound switch set to ringer mode, i play the video , i get the volume popup. I can hear the sound, then i switch the sound mode to silent using the switch, i can still hear the sound. Even if i keep toggling the modes using the switch, it doesn't affect the volume of the video(which is what i need).
You need to configure your audio session by setting the Category property:
http://iosapi.xamarin.com/?link=P%3aAudioToolbox.AudioSession.Category
An explanation of the possible values and how to control them are available here:
http://iosapi.xamarin.com/?link=T%3aAudioToolbox.AudioSessionCategory

Playback sound while recording

I want to record sound to a file and at the same time I want to be able to play audio from the same file in C#
For example, play the last 15 seconds but the microphone has to keep on registering and recording while replaying.
Is this possible and in that case, which is the best approach to do this?
The answer is YES, and you should play around with low level audio API, namely WaveIn/Out functions from winmm.dll, through P/Invoke in C#.
In short words, you need to use WaveIn to capture input signal from a input device and store in some structure, then use WaveOut to play back the audio simultaneously, or some delay after.
Here is a project you can start with: a duplex audio player. You can download the project and play around with it and see how it achieves it, then do some modifications upon the project to achieve what you want :)

MediaElement seems to disable lock screen when playing a video

I am working on an application that plays a video using the MediaElement component. Now, I would like that if the user is idle, the lock screen appears, as configured by the user in the Settings of the device.
If I don't play a video, the lock screen indeed appears. But, when a video is playing no lock screen appears. I cannot find any information on this.
Currently I set the idle detection modes like this:
PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Enabled;
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Enabled;
I am a bit lost now. The only solution I can think of is running a timer myself and stop the video playback after a certain time. (but there seems to be no API calls to receive the configured lock timeout.)
Any suggestions are welcome, thanks.
One workaround for you would be to enable running under the lockscreen. Then in the obscured even you could stop the mediaplayer. Not ideal, but it might serve your purposes.

Categories