Soft Volume Adjustment
Posted: Mon Jan 17, 2022 12:39 pm
Thank you for this great utility! I found it very difficult to control the volume under program control directly, and this works very well.
I am using it on a CNC machine to turn up the volume on my system when the machine is running, then turn it back down automatically when the machine stops.
The only issue I have is that the volume change is very sudden, and it would be much better if it took some time to get to the new desired volume level, instead of just slamming it all the way to the target suddenly. This is how the automatic volume adjustment in my car works.. when I stop, it gradually turns the volume down, and when I get going again, it gradually turns it back up.. it's not a sudden change.
I tried to do this on my own, but unfortunately it takes too long for SetVol to return from a volume change, so I can either do a very slow transition, or the steps need to be very coarse. From what I can tell, it changes the volume very fast, and then a delay before I get control back.. and the delay is not always the same amount of time. I'm hoping that this feature could be implemented with SetVol itself, then it could send the volume changes in increments at a specified rate, and the exit delay would not matter.
The Way I would implement something like this is to just add a rate specifier, where you specify the rate in Seconds for Full swing.... that way it would always be consistent and happen the same way no matter how far it had to go. So a Rate of 10 would take 10 seconds to go from 0% to 100%... so if the volume was at 35 and you did SetVol 75 Rate 10, it would take 4 seconds to go the 40% from 35 up to 75... and if the volume was 15 when you ran SetVol 75 Rate 10, it would now take 6 seconds to go the 60% from 15 to 75.. but after it crossed 35, the change would be the same as the previous 35 to 75 example. because at that point it would still have 4 seconds left to finish the change.
The math for this is pretty straight forward, just do
Delay_time = ((Target_Volume - Start_Volume)/Rate)/(Target_Volume - Start_Volume)
then just change volume 1% at a time with a timer of Delay_Time between them.
Thank You for your consideration.
I am using it on a CNC machine to turn up the volume on my system when the machine is running, then turn it back down automatically when the machine stops.
The only issue I have is that the volume change is very sudden, and it would be much better if it took some time to get to the new desired volume level, instead of just slamming it all the way to the target suddenly. This is how the automatic volume adjustment in my car works.. when I stop, it gradually turns the volume down, and when I get going again, it gradually turns it back up.. it's not a sudden change.
I tried to do this on my own, but unfortunately it takes too long for SetVol to return from a volume change, so I can either do a very slow transition, or the steps need to be very coarse. From what I can tell, it changes the volume very fast, and then a delay before I get control back.. and the delay is not always the same amount of time. I'm hoping that this feature could be implemented with SetVol itself, then it could send the volume changes in increments at a specified rate, and the exit delay would not matter.
The Way I would implement something like this is to just add a rate specifier, where you specify the rate in Seconds for Full swing.... that way it would always be consistent and happen the same way no matter how far it had to go. So a Rate of 10 would take 10 seconds to go from 0% to 100%... so if the volume was at 35 and you did SetVol 75 Rate 10, it would take 4 seconds to go the 40% from 35 up to 75... and if the volume was 15 when you ran SetVol 75 Rate 10, it would now take 6 seconds to go the 60% from 15 to 75.. but after it crossed 35, the change would be the same as the previous 35 to 75 example. because at that point it would still have 4 seconds left to finish the change.
The math for this is pretty straight forward, just do
Delay_time = ((Target_Volume - Start_Volume)/Rate)/(Target_Volume - Start_Volume)
then just change volume 1% at a time with a timer of Delay_Time between them.
Thank You for your consideration.