Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mh sound master volume #257

Merged
merged 4 commits into from
Nov 6, 2013
Merged

Mh sound master volume #257

merged 4 commits into from
Nov 6, 2013

Conversation

pmatis
Copy link
Contributor

@pmatis pmatis commented Sep 23, 2013

I have several voice notifications that play all day long at various volume levels. However, later in the evening I want all volumes of each notification to be slightly lower than during the day. So, I wrote this modification to handle that.

I added the following to my mh.private.ini file:

volume_master_get_cmd=amixer get Master | grep % | sed -e 's/%\].*$//' -e 's/^.*\[//'
volume_master_set_cmd=amixer -q set Master $volume%
volume_wav_get_cmd=amixer get PCM | grep % | sed -e 's/%\].*$//' -e 's/^.*\[//'
volume_wav_set_cmd=amixer -q set PCM $volume%
volume_wav_default_volume=70

I then added my own user code to handle the various volume levels:

if($state = state_now $mh_volume) {
  print_log "mh_volume set to: $mh_volume";
}

##### Auto Volume Control ######
if($Reload) {set $mh_volume 80 unless $mh_volume;}
if($New_Minute) {
    my $desired_volume=80;
    if(time_greater_than '8:30 am') {$desired_volume = 88;}
    if(time_greater_than '9:30 am') {$desired_volume = 95;}
    if(time_greater_than '11:00 am') {$desired_volume = 100;}
    if(time_greater_than '8:00 pm') {$desired_volume = 95;}
    if(time_greater_than '10:30 pm') {$desired_volume = 80;}
    set $mh_volume $desired_volume unless state $mh_volume == $desired_volume;
}

Now, I have various speak events that speak at different levels. The main volume level of MH can be overridden on a per-event basis by using mhvolume=xx as well:

speak "volume=100 mhvolume=100 WARNING! You have triggered the security system. The authorities are being notified.";

The above speaks with both "sliders" of the mixer at full volume.

I hope others have some use for this! :)

@krkeegan
Copy link
Collaborator

Steve, these commits are too much for me to review by eye. Plus I don't use audio. Are you any anyone else able to confirm that these commits don't break anything?

@pmatis
Copy link
Contributor Author

pmatis commented Oct 20, 2013

How well does this play with what others are doing? Does this make sense on Windows?

@pmatis
Copy link
Contributor Author

pmatis commented Oct 20, 2013

Oh, just saw your comment. I'm not sure if it breaks Windows or Mac audio control, I have only tested Linux. However, I have not PERSONALLY found anything that breaks, and I've had this merged into my running branch since I created this commit.

krkeegan added a commit that referenced this pull request Nov 6, 2013
@krkeegan krkeegan merged commit 77bab53 into hollie:master Nov 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants