GLBasic forum

Main forum => GLBasic - en => Topic started by: Dabz on 2011-Jan-15

Title: Odd PlaySound with volume
Post by: Dabz on 2011-Jan-15
When I use playsound with a volume of 1.0, its fine... Though, when I set it to 0.5, its barely audible, though, if I do the same with, say BlitzMax, setting the channel volume at 0.5:-

Code (glbasic) Select

sound = LoadSound ("path/sound.wav")
channel=CueSound(sound)
SetChannelVolume channel,0.5
ResumeChannel channel
Repeat
Until ChannelPlaying(channel) = False


it produces a sound that does indeed sound half the volume on the auld ears, whereas in GLBasic, its nothing more then a whisper!?!

Code (glbasic) Select

GLOBAL soundVol# = 0.5
PLAYSOUND(sound_id%,0,soundVol#)


Any idea's?

Dabz

Title: Re: Odd PlaySound with volume
Post by: Dabz on 2011-Jan-15
Quote
No idea but i have only been using this software for less than a week and i think it's ridiculous that the fact its Version 8.203 wtf or whatever and it still has more bugs than a dog shit in the height of summer in it.

Dont sit on the fence there, let us know what you really think! :D

Seriously, there really is something up because I've tried it with PlayMusic and it works as expected when you set MusicVolume with 0.5

Dabz
Title: Re: Odd PlaySound with volume
Post by: MrTAToad on 2011-Jan-15
QuoteAny idea's?
Do you have Windows volume up to maximum ?  If not, then put it to maximum and try again.  The volume is a percentage of the global volume value (at least on Windows).  Also is it a stereo sample ?

Quotewhatever and it still has more bugs than a dog shit in the height of summer in it
So where are your bug reports then ?
Title: Re: Odd PlaySound with volume
Post by: Dabz on 2011-Jan-15
Quote
Do you have Windows volume up to maximum ?  If not, then put it to maximum and try again.

First thing I tried!

Quote
The volume is a percentage of the global volume value (at least on Windows).  Also is it a stereo sample ?

All my effects are normalized mono samples, they are only little effects!

Do they need to be stereo, and if you dont mind, whats the difference in terms of playing them through GLBasic, when it works fine via BlitzMax? (I'd just like to know really)

Dabz
Title: Re: Odd PlaySound with volume
Post by: Dabz on 2011-Jan-15
Converted the track to stereo... No difference!

Dabz
Title: Re: Odd PlaySound with volume
Post by: MrTAToad on 2011-Jan-15
GLBasic using DirectX 7 for Windows and BlitzMax uses various things
Title: Re: Odd PlaySound with volume
Post by: Dabz on 2011-Jan-15
Very technical information there Mr Toad... Thanks for that! ;) Hehehe

Nah, doesnt matter if its stereo or not, same result, as in, its not working as expected, and as such, doesnt matter what it uses, if 0.5 is half, but its playing at 0.1, theres something amiss, simple as as simple is!

Only thing I have to see is how it runs on iOS, I havent tried it for a while on their due to the missing lib file when building through VM, may as well have a pop!

Dabz
Title: Re: Odd PlaySound with volume
Post by: Dabz on 2011-Jan-15
Looks like its a Windows thing!!!

Maybe Kitty should move the windows driver to OpenAL... That works, and OGG format is pretty good!

Dabz
Title: Re: Odd PlaySound with volume
Post by: MrTAToad on 2011-Jan-15
Might be an idea - dont forget to do a Bug Report!
Title: Re: Odd PlaySound with volume
Post by: Leginus on 2011-Jan-15
Sound volume works fine on os, but it does seems a little sensitive on Windows

@ Ionise
The reason that there may be the odd bug now and again (like with every software) is that GLbasic is constantly evolving to provide us with new features, different os compatibility etc.  And if you need and example of bugs with other stuff, how many updates does windows do a week??

Oh and just a quick thought (and i am not trying to start arguments) but this forum is also used by some younger people so maybe editing the language maybe an idea.  I have too and work on a building site so believe me I swear a lot :)


Title: Re: Odd PlaySound with volume
Post by: Ian Price on 2011-Jan-15
The volume issue has come up before - I recall mentioning the differing volumes of GP2X, Wiz and pc - all three are totally different. Even the GP2X F100 and F200 are different - I think that's actually a hardware issue with those machines. This proves that it's not possible to get everything right for every machine as there are just too many variations.

And negative comments such as those above are most definitely not welcome here - report bugs by all means, as they do exist, but be constructive and try to at least provide examples rather than posting general statements. That's just trolling.
Title: Re: Odd PlaySound with volume
Post by: Wampus on 2011-Jan-16
An idea for what can be done to get around this: Test the actual output volume of PLAYSOUND by recording it with another computer as a WAV. Then you could compare to a WAV that has been set to amplifications of 100%, 90%, 80%, etc. in something like Audacity. That way you can see what PLAYSOUND volume levels match most closely. Perhaps there is a exponential relationship or whatever. I don't know but I have been meaning to do this recently. Perhaps today is the day.

BTW Ionise I think your frustration is understandable but you were very harsh with your metaphor! It smacks of naivety. Nothing is perfect in this world but there is such a thing as good enough. If GLBasic isn't good enough for what you want to use it for I have to wonder what would live up to your expectations (and if there is anything in the real world that comes close to it).
Title: Re: Odd PlaySound with volume
Post by: Wampus on 2011-Jan-16
Ok, so I wrote a little app to that I'll upload tomorrow that can be used to compare PLAYSOUND volumes and WAVS normalised to various volumes. I'll explain a bit more then but basically it allows you to find out what corresponding PLAYSOUND volume settings are approximately the same as 90%, 80%, 70% volume, etc. I would've posted it right now but I haven't had a chance to test it on my iPod since my Xcode installation is kerbukacuffled for no good reason. GAH! I have to wait a few hours just for a copy of the new version to install so I'm going to give up for tonight and try again in the morning.

For now, below are the results of my first run of the app to check what volume I should be settings for PLAYSOUND on my PC. They might be different with your PC & sound hardware and the results are only roughly equivalent since PLAYSOUND volume settings only register two decimal places even though the accuracy needed for a more equivalent volume requires about 3 (something I learnt just now):-













Volume    - -    Equivalent PLAYSOUND volume setting
100%1.0
90%0.99
80%0.98
70%0.96
60%0.95
50%0.93
40%0.92
30%0.9
20%0.87
10%0.81
Title: Re: Odd PlaySound with volume
Post by: Ian Price on 2011-Jan-16
Wow! Those are strange values. It would be interesting to see if those values are roughly consistant with everyone's machines - I suspect not, but it might make workinig out volume levels a bit easier. The above is one of the reasons I introduced proper volume control options into some of my handheld games.
Title: Re: Odd PlaySound with volume
Post by: Dabz on 2011-Jan-16
@Ragaril

Never tested, but thats roughly what I'm getting... Basically, when its set at 0.5, its barely audible, and I mean volume is right up and I can just make it out... Though, it does work as expected on my iPlod, which is good enough for the moment.

But, it is a bit of a knacker since 99% of the dev is on bootcamp, and to test I have to log out of bootcamp, go into OSX, copy and paste the xCode project, build that, go back into bootcamp,  tinker with the value... Rinse repeat*!  :S

Dabz

EDIT:

*Fixed... Needed to add a drive letter to the sodding shared folders in order for that libsomething.a to be outputted... NICE!!!!
Title: Re: Odd PlaySound with volume
Post by: Wampus on 2011-Jan-16
Yeh, there seems to be some sort of exponential fall off rather than linear progression! After testing on my iPod I can confirm that both PLAYSOUND and PLAYMUSIC work as expected so no adjusting is needed there. On the PC though I get those strange values. I tested on three PCs and got 3 ever so slightly different results but a general pattern did emerge.

I've attached the little proggy I mentioned yesterday to this thread. Probably won't be of much use unless you want to see if your PC matches to similar values. The generated sound is a horrible square wave that I created in a hex editor rather than a sound program so be aware that your ears may bleed! To measure the output I used a output jack from the source PC and plugged the other end into the microphone jack on another PC then used a simple vu meter program from here: http://robotplanet.dk/knef/vumeter/ (http://robotplanet.dk/knef/vumeter/)

BTW I finally settled on these values as what I'm going to use for PC PLAYSOUND volume control for now:-













Volume    - -    Equivalent PLAYSOUND volume setting
100%1.0
90%0.99
80%0.98
70%0.96
60%0.95
50%0.93
40%0.91
30%0.89
20%0.86
10%0.8



[attachment deleted by admin]
Title: Re: Odd PlaySound with volume
Post by: Dabz on 2011-Jan-16
I've bunged this in the bug reports section, because obviously something is wrong (Tried it on two PC's now)

Dabz
Title: Re: Odd PlaySound with volume
Post by: Hemlos on 2011-Jan-20
70% volume results in almost inaudible sound.
Windows xp here.
Title: Re: Odd PlaySound with volume
Post by: Kitty Hello on 2011-Jan-21
instead of "MUSICVOLUME x" try "MUSICVOLUME (POW(x,  2.7182818285))" - does that sound better?
I'll include that in the engine then. The problem is, the ear is not working linear, but exponentially.
Title: Re: Odd PlaySound with volume
Post by: Hemlos on 2011-Jan-23
I thought it was just my ear not working  :S
Title: Re: Odd PlaySound with volume
Post by: Dabz on 2011-Jan-23
Quote
instead of "MUSICVOLUME x" try "MUSICVOLUME (POW(x,  2.7182818285))" - does that sound better?
I'll include that in the engine then. The problem is, the ear is not working linear, but exponentially.

MUSICVOLUME seems fine, its #volume in the PLAYSOUND parameter that seems to be the broken Kitty me auld fruit.

If that works, I'll just wait till you update the engine, as mentioned, it all seems fine on iOS! :)

Thanks for taking a look at it, much appreciated! ;)

Dabz
Title: Re: Odd PlaySound with volume
Post by: Kitty Hello on 2011-Jan-24
is the POW mehtod for playsound working then?
Title: Re: Odd PlaySound with volume
Post by: spudgunjake on 2011-Jan-24
I had problems with samples, but found out that its was some codex on my pc, I uninstalled what I coould find and just have VLC player and media player installed, and it worked fine. I very careful what codex i use, I install ogg codex for windows this morning and my apt some times crashes.  just sures you what can happen.
Title: Re: Odd PlaySound with volume
Post by: Dabz on 2011-Jan-24
Code (glbasic) Select

soundVol# = POW(0.5,  2.7182818285)
LOCAL ch% = PLAYSOUND(menu_click%,0,soundVol#)


Nothing Kitty, not a whimper, even with it as soundVol# = POW(0.8,  2.7182818285), with 0.8 being audible when used without POW!

Quote
I uninstalled what I coould find and just have VLC player and media player installed, and it worked fine.

Well, thats all well and good, and indeed a fix then, but alas, no good if your planning to sell your game... No customer is gonna want a faff like that, some of them can barely open a zip file never mind fannying on with codecs! :D

Dabz