How to mute the audio of a application in ubuntu? - bash

i'm working on a project which produces sound alerts whenever a condition is met. But the problem is if the video player is running the alert sound get mixed with the sound of the video. Is there any way to mute the audio of the running application only using terminal so that the warning can be heard.
My operating system is Ubuntu.

Related

is there a way to access desktop audio on windows

im working on a windows app that needs to "hear" the desktop's audio, so the user runs it in the background and plays a game for example, the application would receive the sounds of that game, kind of like a screen recorder, but for audio only

How to keep audio playing when switching users in Windows?

It seems that Windows automatically stops my audio play when switching to another user. Is there any way where I can keep audio playing when windows switch to another user?

Core Audio code running on simulator mutes currently playing audio

Every time I'm working on a Core Audio application, specifically one that utilizes real-time audio via the remoteIO audio unit render callbacks, the moment I start the audio unit engine running whatever music I am playing via youtube or itunes is muted. I must reload the youtube page or reset my system preference audio settings to get sound back. Is there a solution to this?
Set the mix-with-others property on the Simulator's RemoteIO Audio Unit before starting it. Also enable a proper AVAudioSession category.

WP7 background audio resources are no longer available

I'm using BackgroundAudioPlayer for my Windows Phone 7 music & video application. After I play some music, I play video using MediaPlayerLauncher, then press Back to return to my app. There whenever I use BackgroundAudioPlayer.Instance. I receive error "The background audio resources are no longer available".
Someone on MSDN suggests using try/catch, but this is not a good idea, and can slow down the app.
Other suggests call BackgroundAudioPlayer.Instance.Close() before launch MediaPlayer. However, when I play music, the agent load .dll again, which takes very much time.
How to fix this ?
If you play a video after your audio the OS will definitely "terminate" your Background Audio Player. From your question it seems this is reproducible 100% of the time which would confirm this. Your only option is to restart the background audio player again after you have called BackgroundAudioPlayer.Instance.Close(), and then played your video. Which as you said will require reloading your player DLL when you start the BAP.
Update following up from comments
If you aren't implementing a streaming audio agent but only an AudioPlayer agent there isn't a process for you to kill anyway. The OS spins up a process as and when it needs to get you to process an action (e.g.: user action, track ended, shutdown).
BackgroundAudioPlayer.Instance.Close() just makes sure that the OS releases those resources cleanly in a scenario such as the OP has.
To restart background audio, just call BackgroundAudioPlayer.Instance.Play() again.

How to programmatically change Mac's audio output device or invoke the system "dong" sound using Ruby?

I have an app on the iMac written in Ruby, and it would give out alert sound using
puts 7.chr
(or it can play an mp3 file). But the problem is that sometimes the Mac is changed to output the audio in System Preferences to the HDTV instead of the internal speakers, and the HDTV can be turned off sometimes.
So is there a way to either programmatically change the output device to the internal speakers, or play the "Dong" sound which is the one when the iMac boots up -- the sound that comes from the inside of the machine?

Resources