PDA

View Full Version : Control how loud 100% volume in a certain player is?



ITemplate
2012-06-03, 06:24
Hi,

I have some Squeezebox Radios for the kids. They tend to up the volume to 100% all the time. I'd like define - server side or whatever - how loud 100% is on their players. So that they don't mess up their players and their ears when they play at 100% volume. And yes, I tried to tell them only to go 90%, but that only works for about 5 minutes :)

This has to be "per player" as I dont want to put restrictions on other players...any ideas?

--
Werner

Mnyb
2012-06-03, 10:59
Hi,

I have some Squeezebox Radios for the kids. They tend to up the volume to 100% all the time. I'd like define - server side or whatever - how loud 100% is on their players. So that they don't mess up their players and their ears when they play at 100% volume. And yes, I tried to tell them only to go 90%, but that only works for about 5 minutes :)

This has to be "per player" as I dont want to put restrictions on other players...any ideas?

--
Werner

Ideas , here is one.

If one logs on to the radio itself via SSH (enable remote acess in the settings ) you can find this file Playback.lua .

/usr/share/jive/jive/audio/Playback.lua

This file contains volume maps , I'm not a programmer so I can't tell which one of these 2 that are used .
But here is where I would start to experiment .

If you edit manually with vi or make a new file and copy over with stp .
I would rename the old file so it's still there .
And restart the radio otherwise it wont take the change .

This would be a project for a third party app ?

A code snippet with the volume maps .


-- volumeMap has the correct gain settings for volume settings 1-100. Based on Boom volume curve
--todo when this becomes SP device specific move to service method and make it per-device
local _defaultVolumeToGain = {
16, 18, 22, 26, 31, 36, 43, 51, 61, 72, 85, 101, 120, 142, 168, 200, 237, 281, 333, 395, 468, 555, 658, 781, 926, 980, 1037, 1098, 1162, 1230, 1302, 1378, 1458, 1543, 1634, 1729, 1830, 1937, 2050, 2048, 2304, 2304, 2560, 2816, 2816, 3072, 3328, 3328, 3584, 3840, 4096, 4352, 4608, 4864, 5120, 5376, 5632, 6144, 6400, 6656, 7168, 7680, 7936, 8448, 8960, 9472, 9984, 10752, 11264, 12032, 12544, 13312, 14080, 14848, 15872, 16640, 17664, 18688, 19968, 20992, 22272, 23552, 24832, 26368, 27904, 29696, 31232, 33024, 35072, 37120, 39424, 41728, 44032, 46592, 49408, 52224, 55296, 58624, 61952, 65536,
}

local _serverVolumeToGain = _defaultVolumeToGain -- same since Squeezeplay.pm uses Boom curve

--sb2 curve
--local _serverVolumeToGain = {
--232, 246, 260, 276, 292, 309, 327, 346, 366, 388, 411, 435, 460, 487, 516, 546, 578, 612, 648, 686, 726, 769, 814, 862, 912, 966, 1022, 1082, 1146, 1213, 1284, 1359, 1439, 1523, 1613, 1707, 1807, 1913, 2026, 2048, 2304, 2304, 2560, 2816, 2816, 3072, 3072, 3328, 3584, 3840, 4096, 4352, 4608, 4864, 5120, 5376, 5632, 5888, 6400, 6656, 7168, 7424, 7936, 8448, 8960, 9472, 9984, 10496, 11264, 11776, 12544, 13312, 14080, 14848, 15872, 16640, 17664, 18688, 19712, 20992, 22272, 23552, 24832, 26368, 27904, 29440, 31232, 33024, 35072, 37120, 39168, 41472, 44032, 46592, 49408, 52224, 55296, 58368, 61952, 65536,
--}

--provide hook for applets to modify the gain curve
function overrideDefaultVolumeToGain(self, value)
_defaultVolumeToGain = value
end

function setVolume(self, volume, stateOnly)
log:debug("setVolume: ", volume)

self.volume = volume
if (not stateOnly) then
self:_setGain(self:_getGainFromVolume(volume))
end
end


function getVolume(self)
return self.volume
end


function _getGainFromVolume(self, volume)
return _defaultVolumeToGain[volume]
end


function _setGain(self, gain)
log:debug("_setGain: ", gain)

local data = { gainL = gain, gainR = gain}

self:_audg(data, true)
end

ITemplate
2012-06-03, 14:11
Hi Mnyb,

Thanks for your answer. Very interesting approach, and it should be fairly easy to make appropriate changes. I'll report back my success or failure in case anyone else needs the same functionality...

--
Werner

Mnyb
2012-06-03, 14:20
Hi Mnyb,

Thanks for your answer. Very interesting approach, and it should be fairly easy to make appropriate changes. I'll report back my success or failure in case anyone else needs the same functionality...

--
Werner

Good luck , also you need to reapply any changes if you upgrade the radios firmware .

And if you brick it, a factory reset will bring it back to default condition and all your changes will be undone

paulster
2012-06-03, 18:35
Peter Watkins has a Volume Lock plugin which, I believe, can lock a player to a specific volume or limit its maximum volume.

Maybe take a look at that.

Mnyb
2012-06-03, 21:15
Peter Watkins has a Volume Lock plugin which, I believe, can lock a player to a specific volume or limit its maximum volume.

Maybe take a look at that.

Was searching for It but could not find it, maybe it's only for old players ? How ever if OP suceeds we have a method that works on mysqueezebox.com too .

Besides wonder if 90% is low enough it's really really loud would not get those kids anything with headphones if this is their attitude :-/

I would take a really loud piece of music play it and use my rs meter to measure at what volume I get 85 dB at 1 meter distant

paulster
2012-06-03, 22:17
Was searching for It but could not find it, maybe it's only for old players ?

Add the repository http://www.tux.org/~peterw/slim/slim7/repodata.xml to your plugins screen in the web interface and then you should find it listed.

ITemplate
2012-06-04, 11:39
Thanks all. Well I haven't had the time to fiddle with the scripts yet, however I just tried the plugin and it configured very easily and maximum output on one of my sons Radio is now 90% only. Very nice per player plugin. Only "problem" is, that it is server-side, which means that there is a delay of 1-2 seconds before the output is turned down from 100%-90%. Not a big deal, but enough to look at the scripts later I think...

--
Werner