What do you use to control the system volume

Blitz3D Forums/Blitz3D Programming/What do you use to control the system volume

puki(Posted 2006) [#1]
I'm pretty sure there is some kind of sound lib that let's you alter your PC's main volume level. I had a quick look in 'Toolbox', but couldn't see one.

What is this sound lib?

I want to be able to turn up the PC's main volume from within Blitz3D and turn it back again at program exit.


markcw(Posted 2006) [#2]
i put my fingers in my ears and voila! volume control!

sorry, i'll get me coat.


Damien Sturdy(Posted 2006) [#3]
Why would you need that?


Boiled Sweets(Posted 2006) [#4]
BASS


b32(Posted 2006) [#5]
I think you need an API to do that. There is a command waveoutsetvolume in winmm.dll. I found some decls for winmm in this post:
http://www.blitzforum.de/forum/viewtopic.php?t=3915
(edit) yes, i tried this, the first parameter should be 0, the second one in the range 0..65536 (/edit)
The mixer window doesn't show the changes in volume, but when i played a looping sound, it's volume changed.


GfK(Posted 2006) [#6]
PC users generally don't like programs that mess with system settings. Quite right, too.


OJay(Posted 2006) [#7]
yep, lovely if a program turns up all the volumes and then...crashes...

=> BAD BAD IDEA! leave it up to the user to change the volume!


puki(Posted 2006) [#8]
I'll take a look at that "bram32".

The beta testers for my Star Trek game are complaining that they have to put the volume up to play the game, then they forget to lower it later.

This problem is really due to the original sound source - we are talking 1960's sound recording.

It is not a vital thing, but a sneaky shift in system volume at program start and exit would be nice.

I am looking at the option of increasing the sound volume of all sound files using some kind of batch process. If there are applications out there that can batch process sound files from one format to another, then there must be ones that can batch process volume increase.

Anyone know of any such application?


GfK(Posted 2006) [#9]
Goldwave can probably do it.


b32(Posted 2006) [#10]
Some programs (like winamp, mediaplayer) control the wave volume mixer of windows. In these programs, it is still the user that changes the volume, but you don't have to open the mixer window to do it.

I've used CoolEdit (now Audition) and some other people I know SoundForge. I think you need to maybe use compression on the waves. Simply maximizing waves could be not enough.
Compression changes the dynamics of a wave, so that the difference between loud and quiet parts is reduced.


puki(Posted 2006) [#11]
Mmm, I don't know much about sound engineering but this is surely Windows related (ie, maybe not the recordings).

The volumes of the sounds when played through Blitz, Windows SoundRecorder, Windows Media Player or Winamp are not as high as when playing through VLC media player.

All are set to full volume, yet VLC Media Player somehow plays the samples at a higher volume. I want to know why.


puki(Posted 2006) [#12]
VLC seems to be playing the samples at roughly 75% higher than everything else. I established that by using SoundRecorder's increase volume by 25% to match them.

How can it play the samples at a higher volume? In fact, why would it?


Damien Sturdy(Posted 2006) [#13]
because VLC is probrably "Normalising" the sound :)

Puki, maybe if the files arent too big, you could email then to me? I wont be able to touch them till later, but I will at least be able to prod them to see what the problem is.


Boiled Sweets(Posted 2006) [#14]
Yup you need to normalise them (and probably remove hiss).


Damien Sturdy(Posted 2006) [#15]
Or if you want to do it yourself:

http://audacity.sourceforge.net/


puki(Posted 2006) [#16]
maybe if the files arent too big

Well, the files are small - but there are a few thousand of them.


I understand now. I am using 'WavePad' - I checked the docs:

Normalize

To 'normalize' is to adjust the volume so that the loudest peak is equal to (or a percentage of) the maximum signal that can be used in digital audio. Usually you normalize files to 100% as the last stage in production to make it the loudest possible without distortion.


I'm just hoping it can do this as a batch process.


Damien Sturdy(Posted 2006) [#17]
it wouldn't be too difficult to write a tool to read in, normalise, and output the WAV files again, if you want... but the input files must be a "PCM formatted WAV" file.


puki(Posted 2006) [#18]
Mine are PCM - no cheap stuff with me.

I found a free program that may do the trick - recommended by people who use 'Audacity':

Tired of reaching for your volume knob every time your mp3 player changes to a new song? 'MP3Gain' analyzes and adjusts mp3 files so that they have the same volume.



Damien Sturdy(Posted 2006) [#19]
I use MP3Gain, but I wasn't aware it worked on WAV files, since it was for normalising the MP3 signal losslessly.


puki(Posted 2006) [#20]
It doesn't.

My files are WAV as master copies - however, I am also using MP3 conversions. It will probably be impossible to not use MP3 due to overall file-size of the thousands of files.


Damien Sturdy(Posted 2006) [#21]
Puki just make sure your MP3 conversions are the FINAL conversion of the top notch WAV files.

And remember a) Legal problems with Mp3s and B) Quality loss with MP3s.

How large are the files?

Someone/i can code a "load/save" tool later, it'll simply load your wavs and spit them out normalised, as I said above.


jfk EO-11110(Posted 2006) [#22]
There's an example in the code archives on controling the WMM mixer. I'd save the current volume in a file, then when the game finishes I'd reset the volume to its original value. Additionally I'd write a file that signals if the game was ended correctly. If the game crashed, this file will be missing. So when the game is started the next time, it may determine if it has to reset the volume.

This method may be about 98% secure. Not sure if you shoud risk it.