#Boombox volume goes up to 11
1 messages · Page 1 of 1 (latest)
So I'm trying to work out where the method that controls the volume is. I think its part of VolumeAndInterferenceController
{
if (!interferenceAudioSource.isPlaying)
{
musicAudioSource.volume = volume;
return;
}
float num = volume * signalStrength;
float num2 = Mathf.Clamp01(volume * (1f - signalStrength / 0.7f) * interferenceSoundVolumeMultiplier);
if (num2 < 0.01f)
{
num2 = 0f;
}
musicAudioSource.volume = num;
interferenceAudioSource.volume = num2;
}```
I think it takes the original audio and if the volume is set below whatever is defined as 10 it reduces the volume
Internally, the control is also just 0 to 1. 10 is what's shown because showing 0.7 as volume instead of 7 makes no sense.
You cannot go above 1, you'd need to alter the original source to go any higher.
It could apply a limiter effect above 1 to cause that. I wonder if unity has an audio limiter built in.
You'd probably want to change the gains in the audio mixer the boombox uses, it might be able to boost the volume.
I don't think 0.7 is related to the volume I think that's specifically for the radio mode where it simulates signal loss if the antenna isn't up or you're in a tunnel etc.
It's literally there.
musicAudioSource.volume = volume;
it returns after if (!interferenceAudioSource.isPlaying) which I'm assuming is when a tape is used
The volume is also clamped to [0..1] by the method that takes the control's values.
Interference is the static you hear in tunnels.
So the audio volume is decreased if the interference audio is playing.
Yeah I think tackling with the cassettes would be best first. Or it just needs to apply a limiter effect to both the radio and tape audio that's probably simpler. And then the static effect will still work.
Something like this maybe
But a limiter would just lower the volume?
No limiters increase volume
Isn't your objective to increase it?
They're not intuitively named
I suppose its because it limits the dynamic range. It increases the overall perceived loudness by raising the quietest parts of the audio.
A limiter catches the highest peaks of an audio source and applies “brick wall” compression that prevents them from exceeding the digital clipping point of 0 dBFS – or any other threshold you set. Limiters are often used to increase perceived loudness by raising the quietest parts of an audio signal while preventing the peaks from clipping. Limiting is also the final, and perhaps the most easily recognizable, step in mastering a song, allowing you to turn up the master to commercial loudness without unintentionally clipping.
From skimming that unity discussion thread unity has a compressor but the ratios it offers wont work for this application
But it seems that it won't go over the highest peaks anyway. Though I guess the perception of the lower parts could help make it feel louder.
it does make quite a difference
I'm also not sure if the source audio peaks at 0dB I'd have to check. It could be the loudest parts can be boosted too. And after that I think applying a distortion effect would be cool.
It still all goes through a chain of audio mixers, which control the final volume in relation to eachother.
You could increase the dB gain of the one the boombox uses, though I'm not sure what the code to do that would be.
Digging through the code to see if I can find that. I'm also trying to find where it maps the values 1-10 to actual volume level internally
But still, wouldn't most audio already be "limited" when you listen to it?
I'm not sure it depends what the devs chose to do with the audio afaik
That 0-10 is just the display. All controls work in the [0..1] range.
Just like throttle notches show 0-11, it's just 0-1 internally.
0 to 100%.
Yeah but it has to map that somewhere to know what 1 and 10 is
unless it just truncates the value on the display
11 notches, so 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0.
I found it here I think bottomText.text = $"Volume: {volumeX10} - Station: {radioStationIndex + 1} - Signal strength: {(int)Mathf.Clamp(radioSignal * 100f, 0f, 100f)}";
volumeX10 is this though private int volumeX10 = 4; 🤔
That's interesting because it has public float spawnVolume = 0.5f; so it appears it spawns at 0.5 🤔
Anything that is public and in a MonoBehaviour cannot be trusted, as the editor will override the value.
In any case:
Are you looking at this in the unity editor?
Alright I'll check it out in there later thanks. I've been looking at it with ilspy
I'm really not sure if it's possible to change this stuff.
@lilac pilot there's a few but this is the one where people talk about the files and stuff, I can't understand code but it should help you a bit
ay thanks!
Making audio louder is the most difficult thing to do. Especially in VR where everything is even quieter
I just had to increase dB on all my audio files with some clipping
Don't understand the reason to restrict volume beyond 1.0, if it just multiples the audio wave. Sure, it will cause clipping and audio quality loss, but it's not that bad
Just a 1dB increase adds too much static if the volume is already normalised.
Also AudioMixers are hard to change from code for no reason. They don't have a proper class to set values on, can't be added at runtime, you have to have the editor open to do anything with it
Mixers are usually a thing you set in the project and should never change in realtime TBH.
It could be normalized to a single peak and the rest of the audio is too quiet
You can however multiply all master volumes of locomotives to a lower value, but that's a terrible idea.
Some sounds turn out louder then others even at the same normalized level, and yeah locomotive engine is one of them
Oh, if the question is "audible further way" that is easily done by increasing the radius of the audio source
Even without volume increases
I missed how old this thread was 😅
Initially that would me my first idea. Instead of risk clipping and noise to the boombox, turn everything else down
A shame for VR, I wish I could hold comms radio to my ear and hear it super loud, but instead it's just as quiet