Audio volume level
by Andrea Russo · in Technical Issues · 11/14/2006 (2:25 am) · 5 replies
I'm experiencing very low volume level for the soundtrack in my game... I set the levels at 1.0 (should be the highest audio level) but when I play the game the audio is very low... the .ogg file volume level is quite high if I open it with Winamp...
Can anyone help me to understand?
Thanks
Can anyone help me to understand?
Thanks
#2
Assuming you are using Torque, there are are a few things you should consider :
1) The master volume. At 0.0, you can't hear anything, whilst at 1.0, volume levels should be normal.
(I don't think you can set this higher than 1.0 (i.e. to amplify all the sounds), though this can be done per each sound via the volume parameter in an associated AudioDescription.)
2) The channel volumes. For each channel, this can be in the range 0.0 - 1.0. For simplicities sake, think of this value being multiplied against the master volume. E.g. a master volume of 0.5 and a channel volume of 0.5 would mean that the effective volume level of sounds in the channel would be 0.25.
3) The volume calculated for each sound when it is played, which is derived from the volume and channel parameters in the associated AudioDescription. So for a sound of volume 0.5, and channel 1 with a volume of 0.8, the volume of the sound would be set to 0.4. There is also the master volume on top of that (as mentioned in point 2), though that is handled separately by OpenAL.
4) The effect of other AudioDescription variables. e.g. make sure your sound is set to 2D, not 3D (especially if it is a music track).
5) Your OpenAL implementation may be dodgy. You could try using another version, or if you have the access to the source, you could also try specifying another device such as "Generic Software" when the OpenAL context is created.
11/14/2006 (4:54 am)
Andrea,Assuming you are using Torque, there are are a few things you should consider :
1) The master volume. At 0.0, you can't hear anything, whilst at 1.0, volume levels should be normal.
(I don't think you can set this higher than 1.0 (i.e. to amplify all the sounds), though this can be done per each sound via the volume parameter in an associated AudioDescription.)
2) The channel volumes. For each channel, this can be in the range 0.0 - 1.0. For simplicities sake, think of this value being multiplied against the master volume. E.g. a master volume of 0.5 and a channel volume of 0.5 would mean that the effective volume level of sounds in the channel would be 0.25.
3) The volume calculated for each sound when it is played, which is derived from the volume and channel parameters in the associated AudioDescription. So for a sound of volume 0.5, and channel 1 with a volume of 0.8, the volume of the sound would be set to 0.4. There is also the master volume on top of that (as mentioned in point 2), though that is handled separately by OpenAL.
4) The effect of other AudioDescription variables. e.g. make sure your sound is set to 2D, not 3D (especially if it is a music track).
5) Your OpenAL implementation may be dodgy. You could try using another version, or if you have the access to the source, you could also try specifying another device such as "Generic Software" when the OpenAL context is created.
#3
I had the same problem
in engine/audio/audio.cc, in this function, comment out the logtab call and just return value
perhaps someone else could explain why this was like this in the first place?
F32 linearToDB(F32 value)
{
if(value <= 0.f)
return(0.f);
if(value >= 1.f)
return(1.f);
return value;
//return(logtab[(U32)(logmax * value)]);
}
11/21/2006 (1:46 pm)
Hi AndreaI had the same problem
in engine/audio/audio.cc, in this function, comment out the logtab call and just return value
perhaps someone else could explain why this was like this in the first place?
F32 linearToDB(F32 value)
{
if(value <= 0.f)
return(0.f);
if(value >= 1.f)
return(1.f);
return value;
//return(logtab[(U32)(logmax * value)]);
}
#4
:)
@James: yes, sorry... I'm using TGE 1.5
11/22/2006 (5:51 am)
Thank you very much guys... I'll try that (as soon as I fix my pc).:)
@James: yes, sorry... I'm using TGE 1.5
#5
The call is like that since torque assumes all the volume values are linear. OpenAL only accepts volumes that are expressed on a dB scale (i.e. AL_GAIN), thus the need to convert from linear -> dB (i.e. AL_GAIN_LINEAR) and vice versa.
The audio code used to directly set AL_GAIN_LINEAR in the openal implementation. However, that property has been deprecated (AL_GAIN being the preferred solution), thus a workaround was implemented to convert AL_GAIN_LINEAR values to AL_GAIN values.
Some OpenAL implementations still support AL_GAIN_LINEAR, though imo it is best to assume they don't.
IMO, you should just stick to a dB scale (using AL_GAIN) and remove the linear <-> dB conversion code.
11/22/2006 (6:15 am)
Cary,The call is like that since torque assumes all the volume values are linear. OpenAL only accepts volumes that are expressed on a dB scale (i.e. AL_GAIN), thus the need to convert from linear -> dB (i.e. AL_GAIN_LINEAR) and vice versa.
The audio code used to directly set AL_GAIN_LINEAR in the openal implementation. However, that property has been deprecated (AL_GAIN being the preferred solution), thus a workaround was implemented to convert AL_GAIN_LINEAR values to AL_GAIN values.
Some OpenAL implementations still support AL_GAIN_LINEAR, though imo it is best to assume they don't.
IMO, you should just stick to a dB scale (using AL_GAIN) and remove the linear <-> dB conversion code.
Torque Owner Mike Rowley
Mike Rowley