Sign in to follow this  
Followers 0
Diana (Cda)

SoundSetWaveVolume(x) for wav, anything for master?

11 posts in this topic

SoundSetWaveVolume(x) works well. It affects the volume control labelled WAVE. What command is there for the "Master" volume control, the one labelled "Volume Control", pls?

I thought I had everything fixed in a script. It worked great until this morning. My PC talking alarm clock that plays MP3 music was way too loud. When I checked, the WAV control was where it should (as set in the opening script) but the "Volume Control" slider had moved. Either I changed it at some point since yesterday morning or something affected it.

I have one way for the wave volume, syntax at beginning of this message; but is there something for the master volume? I looked in the help file and there was nothing there. A search in these archives yielded a few messages but the script examples were long and complicated and I couldn't make heads or tails of the 2 that I found. They looked like they might even be GUIs, I think you all call them. I certainly don't need anything complicated, just an easy way to get the "master" volume controlled as well since, as I found, just setting the wave one didn't do the trick.

Thanks. :)

Share this post


Link to post
Share on other sites



Try this maybe it's what you want.

Hi, thanks! Tell me, though, should I have modified the code in any way? I have WinXP and when I saved the code on that page to an au3 then invoked it, nothing happened to the sliders in either the VOLUME or WAVE part of the volume control. The script on that page, btw, is this:

;===============================================================================
;
; Function Name:   _SoundSetVolume
; Description::    Set the Volume and Bass / Treble for a soundfile
; Parameter(s):    $sSnd_id     - Sound ID returned by _SoundOpen
;               $iVol     - the volume for the file 0-100
;               $sName = "" : (default) set both channel
;                     LEFT   :  set left channel
;                     RIGHT  :  set right channel
;                     BASS   :  set BASS 0 - 100
;                     TREBLE     :  set TREBLE 0 - 100
;
; Requirement(s):  AutoIt 3.2 ++
; Author(s):       Nobbe
;
;===============================================================================
Func _SoundSetVolume($sSnd_id, $iVol, $sName = "")
   
    ;Declare variables
    Local $iRet

    If $iVol >= 0 And $iVol <= 100 Then
        $iVol *= 10 ; vol goes here from 0 - 1000
    EndIf

    Switch $sName
        Case "LEFT"
            $iRet = mciSendString("setaudio " & $sSnd_id & " left volume to " & $iVol & " wait")

        Case "RIGHT"
            $iRet = mciSendString("setaudio " & $sSnd_id & " right volume to " & $iVol & " wait")

        Case "BASS"
            $iRet = mciSendString("setaudio " & $sSnd_id & " bass to " & $iVol & " wait")

        Case "TREBLE"
            $iRet = mciSendString("setaudio " & $sSnd_id & " treble to " & $iVol & " wait")

        Case Else ; default 0 ""
            $iRet = mciSendString("setaudio " & $sSnd_id & " volume to " & $iVol & " wait")
    EndSwitch

    ;return
    If $iRet = 0 Then
        Return 1
    Else
        Return SetError(1, 0, 0)
    EndIf
EndFunc   ;==>_SoundSetVolume

Thanks! :)

Share this post


Link to post
Share on other sites

Anyone? Is there a way to easily affect the "Master" volume, as easily as the "Wave" volume? SoundSetWaveVolume(x) is so very easy to implement.

Thanks! :)

Share this post


Link to post
Share on other sites

Look here

Yes, thanks. I found that post, and many others, when I did my usual fairly extensive search that I do before posting to a board. I couldn't make heads or tails of it all even after studying the code; it's way too complicated for me. I again tested some of the AU3 files provided but they again seemed to do nothing and I just don't know what to do to them to fix them. They seem overkill to begin with anyway. Master volume would ideally have one line of code not dozens! <g> Something like "SoundSetWaveVolume(x)" for master volume just doesn't seem to exist otherwise it would have been mentioned long before now and nothing else seems at all easy to use.

I'm hoping that this is something easy enough to address in a future release of AI (?). I'm sure I'm not the only one that found this to be true, but changing the wave volume has little effect if something in the interim has changed the master volume. I had a script to start an alarm and the first couple of days I used it, the wav set was effective and the alarm music came on at a nice volume. However, on the third day, I was rudely woken up with the whole wake-up-and-sit-up-in-a-rush, heart beating 100 mph since the master volume had been affected by something else and the volume was horrendously loud! I wouldn't have been surprised if that day the alarm had woken up my next door neighbour! <g> Yet the wav volume was exactly where it was supposed to be. My great subwoofer needs to have both items controlled ... <g>

Until the time that AI has an easy line of code to deal with master volume, I'll just have to see if there are any third party utilities that might work with AI to do this <sigh>. I absolutely hate using outside apps and much prefer to keep everything contained in one script, but it ain't happening, so no choice.

Thanks for everyone's help. Appreciate it! :)

Share this post


Link to post
Share on other sites

I found a solution. I hope it's alright to post this here but right now AI doesn't have the ability to easily control the playback volume in all its aspects, and I know there were others here as desperate as I was for a solution. I use my computer as an alarm clock and I have a great "clock radio" player that even has a DJ-style commentary between songs. It says the time and gives the weather (we just point app to a weather URL) and so it's perfect for me. But in between songs the volume can fluctuate and if I played anything at any other time and didn't change the master volume back to reasonable levels, I get the wake-up-with-the-pounding-heart effect in the morning <lol>.

The solution is an AutoHotKey one and I'll respectfully post it here so that it can be seen how easy it is to use. I hope that AI has this ability in the near future. I only have AHK for this volume purpose esp. since the last thing I need to do is to mess around with _more_ code. I have enough with trying to figure out VB and AI syntax! <g>

But I have a bunch of scripts based on these, with variations in the percentages (though I'm posting in AI brackets, not AI obviously. Doing this for clarity's sake):

; AHK script - VOLUME TO A SET PERCENTAGE
; the number after the soundset is the percentage of volume to change to (the first without description is master volume, the default when nothing designated)
SoundSet, 25
SoundSet, 25, WAVE
SoundSet, 25, SYNTH
SoundSet, 25, CD
SoundSet, 25, MICROPHONE
SoundSet, 25, LINEoÝ÷ Û^­í¹Í¹jwpyƧr§ëhj|§ºfÞ¯;ç®^µÀ'uú+w+zg§µ©eÉÈZ§ú%ºg¬k+©jw]£    ß®ººÞÙ^½éljëh×6; AHK script - SOUND SET + OR - FROM NUMBER INDICATED (i.e., +25 = volume up 25% from its current position)
; the number after the soundset is the percentage of volume to change to (the first without description is master volume, the default when nothing designated)
SoundSet, +25
SoundSet, +25, WAVE
SoundSet, +25, SYNTH
SoundSet, +25, CD
SoundSet, +25, MICROPHONE
SoundSet, +25, LINE

Again, you can use any amount you want, in the positive or negative.

Thanks for all the help. I posted this to an ng and I was advised re AutoHotKey. I respectfully post this here in a spirit of helping out and just until AI has the same type of functionality. I don't mean to upset anyone with this, but my mornings have been made easier with this so hopefully it helps others out, too.

Cheers! :)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I found a solution. I hope it's alright to post this here but right now AI doesn't have the ability to easily control the playback volume in all its aspects, and I know there were others here as desperate as I was for a solution. I use my computer as an alarm clock and I have a great "clock radio" player that even has a DJ-style commentary between songs. It says the time and gives the weather (we just point app to a weather URL) and so it's perfect for me. But in between songs the volume can fluctuate and if I played anything at any other time and didn't change the master volume back to reasonable levels, I get the wake-up-with-the-pounding-heart effect in the morning <lol>.

The solution is an AutoHotKey one and I'll respectfully post it here so that it can be seen how easy it is to use. I hope that AI has this ability in the near future. I only have AHK for this volume purpose esp. since the last thing I need to do is to mess around with _more_ code. I have enough with trying to figure out VB and AI syntax! <g>

But I have a bunch of scripts based on these, with variations in the percentages (though I'm posting in AI brackets, not AI obviously. Doing this for clarity's sake):

; AHK script - VOLUME TO A SET PERCENTAGE
; the number after the soundset is the percentage of volume to change to (the first without description is master volume, the default when nothing designated)
SoundSet, 25
SoundSet, 25, WAVE
SoundSet, 25, SYNTH
SoundSet, 25, CD
SoundSet, 25, MICROPHONE
SoundSet, 25, LINEoÝ÷ Û^­í¹Í¹jwpyƧr§ëhj|§ºfÞ¯;ç®^µÀ'uú+w+zg§µ©eÉÈZ§ú%ºg¬k+©jw]£    ß®ººÞÙ^½éljëh×6 ; AHK script - SOUND SET + OR - FROM NUMBER INDICATED (i.e., +25 = volume up 25% from its current position)
; the number after the soundset is the percentage of volume to change to (the first without description is master volume, the default when nothing designated)
SoundSet, +25
SoundSet, +25, WAVE
SoundSet, +25, SYNTH
SoundSet, +25, CD
SoundSet, +25, MICROPHONE
SoundSet, +25, LINE

Again, you can use any amount you want, in the positive or negative.

Thanks for all the help. I posted this to an ng and I was advised re AutoHotKey. I respectfully post this here in a spirit of helping out and just until AI has the same type of functionality. I don't mean to upset anyone with this, but my mornings have been made easier with this so hopefully it helps others out, too.

Cheers! :)

Thanks for info Diana.

I like this AHK very simple syntax too.

Maybe this should be in AutoIt Feature Requests forum.

Edited by Zedna

Share this post


Link to post
Share on other sites

Thanks for info Diana.

I like this AHK very simple syntax too.

Maybe this should be in AutoIt Feature Requests forum.

I agree that it would make a great addition to have something so easy in AI. I'll request it.

Thanks.

Share this post


Link to post
Share on other sites

I agree that it would make a great addition to have something so easy in AI. I'll request it.

Thanks.

Done. I put it in the requests forum. Never saw that we had that forum there. Anyway, I hope this feature addition is considered. No way am I going with another scripting program, AI is enough for me -- except in this one case. So hopefully this can be implemented soon. I'll will keep a lookout for it, at any rate. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0