Page 1 of 1

VLC Volume Help AppleScript

Posted: 28 Jul 2021 13:01
by DJUNQUERA
vol(256)
--R1: volN = 256
--R2: volN = 100 %
--R3: volN2 = 226
--R4: volN2 = 100 %

vol(320)
--R1: volN = 320
--R2: volN = 125 %
--R3: volN2 = 320
--R4: volN2 = 125 %

vol(400)
--R1: volN = 400
--R2: volN = 156 %
--R3: volN2 = 320 ➡︎ (???)
--R4: volN2 = 125 % ➡︎ (???)


on vol(n)
tell application "VLC"
set audio volume to n
set volN to (get audio volume)
say "volN =" & n --R1: volN = ...
say "VolN = " & (n * 100) div 256 & "%" -- R2: volN = ... %
set volN2 to (get audio volume)
say "volN2 = " & volN2 -- R3: volN2 = ...
say "volN2 = " & (volN2 * 100) div 256 & "%" --R4: volN2 = ... %
end tell
end vol


Dictionary VLC:
audio volume (integer) : The volume of the current playlist item from 0 to 512, where 256 is 100%.


Why can't I get a volume value higher than 320 (125%) in VLC?

Thanks so much for any help.

Re: VLC Volume Help AppleScript

Posted: 29 Jul 2021 06:48
by fkuehne
This is due to an implementation detail of the AppleScript bindings that respects the macosx-max-volume preference option that by default is 125%. Trying to set any higher value will be restricted to 125 automatically. You need to raise the limit to set a higher value. This implementation is limited to version 3 (and earlier) of VLC. It will be gone in version 4, which however will change the variable type for volume from integer to float.