Current music volume

Blitz3D Forums/Blitz3D Programming/Current music volume

Ekix(Posted 2007) [#1]
Hello guys
Is there any way to get the volume of the backround music into a variable, and move objects based on that in real time.
I don't mean the global volume, instead the current volume while the music is playing...


Dreamora(Posted 2007) [#2]
as you set it at some point, you can store it when you set it.

The channel volume is channelVolume * globalVolume


jfk EO-11110(Posted 2007) [#3]
I think he means the current Amplitude, as in a VU Meter. You can do that with the BASS lib, but as far as I know it costs some money to use the BASS lib in commercial projects.
see http://www.blitzbasic.com/Community/posts.php?topic=69887


Ekix(Posted 2007) [#4]
Yep, sorry that I did explain not so clearly. The current amplitude is just what I mean, a bit like lipsync in 3dsMax. So like for example a ball bouncing following the music. I think it should be possible somehow using WIN API or whatsoever, I'm not such a good programmer and anyway I don't want to pay for it, because it's just for playing around......


jfk EO-11110(Posted 2007) [#5]
Well, you MAY play around with the BASS.DLL, as long as you are not selling your Product. There are several samples for the BASS.dll on how to make such a VU Meter. You may also use the spectrum analyzer that is part of BASS, to get the amplitude of certain frequency ranges. All you need to do is add the last couple of amplitudes together to get a representative peak. I have to agree, those guys who used to write a working spectrum analyzer in Blitz using the BASS.dll were not so openhearted when it came to sourcecode-sharing. Well, maybe ask again, and/or try to translate one of the samples written in other languages.

I may be wrong, but I don't think there's a API Call for this.


Ekix(Posted 2007) [#6]
Hmph, I did download that BlitzBassStudio, but even both of the mp3 player demos gave some function errors even that I did follow the instructions included:

This is only for B3D !

- copy the bass.dll and bass.decls to your userlibs (see bass folder)
- copy the Draw3D.decls to your userlibs (only for syntax, you dont need it to compile)
- make shure the Draw3D.bb and Bass.bb are included
- put some mp3 or ogg files in the dreamplayer folder

Open dreamplayer.bb, compile it, be happy. :)

I don't feel so happy :=(

Any easier way ???


jfk EO-11110(Posted 2007) [#7]
This is not an easy thing.

What error messages do you get?

Maybe this Bass Project is not so good to start with.

Try this other bass project:

http://downloads.lineof7s.2ya.com/BlitzBass160.zip
You need to copy the decls file from the following file to your blitz-installations "userlibs" folder:
http://www.nigelibrown.pwp.blueyonder.co.uk/blitz/userlibs/index.htm

The BlitzBass160.zip used the old CallDLL commands, which became pretty obsolete with the introduction of Blitz userlibs (decls). LineOf7s however stated (http://www.blitzbasic.com/Community/posts.php?topic=61339#686129)
that the userlib found here http://www.nigelibrown.pwp.blueyonder.co.uk/blitz/userlibs/index.htm can be used with BlitzBass160.zip(you may have to replace and/or edit some things).

Note: when there are DLLs with the blitz code, then you need to copy the *.decls files to the userlibs folder of your blitz installation folder. The *.DLL files should be copied to the folder where the sourcecode resides (for distribution purposes, and NOT in the userlibs folder, as many people say)


An other idea, pretty hackish:
In the code archives there is some code to record and save a WAV somewhere. What you cound do is: Determine where it copies the recorded sample data (may be a simple bank), then read the last say 100 samples, add them together to get a volume peak.

For this you may need to study the WAV file format first, including how sampling works.


Ekix(Posted 2007) [#8]
Hmph, it's late here in Finland now. There's something I miss, because I'm not such a good in programming and sleepy now, I just would like to find a simple example which loads/plays something.mp3 and for example shows the amplitude as numbers on the screen or something. Anyway in case I have more time tomorrow, I'll try to have a closer view.
Thanks a lot for your help JFK :=)


Ekix(Posted 2007) [#9]
Hmph, it's late here in Finland now. There's something I miss, because I'm not such a good in programming and sleepy now, I just would like to find a simple example which loads/plays something.mp3 and for example shows the amplitude as numbers on the screen or something. Anyway in case I have more time tomorrow, I'll try to have a closer view.
Thanks a lot for your help JFK :=)