PDA

View Full Version : 100 or 1 for volume?


cpucpu
05-30-2010, 02:17 AM
When developed a sound handling class, i had this dilemma, using the more natural 0-100 volume levels, or the more consistent(in the context of other flash native properties like alpha) 0-1 values. What do you think?

maskedMan
05-30-2010, 02:32 AM
It depends on your audience. If the code is for your consumption only, it's fine to do it as you wish. If it's for general use you might want to consider the needs of your users. My gut tells me that most programmers would prefer 0-1, as they're thinking in terms of multiplying the sound volume by the number in question

cpucpu
05-30-2010, 03:24 AM
Curently i am using 0-100, but as i play with other object's 'subject to range' properties, i see 0-1 ii most common, at the point that using 0-100 may sometimes be confusing and less standard

Flash Gordon
05-31-2010, 07:30 AM
any questions of standards should always adopt the standard the language is written in. For AS this means 0-1, and things like URLLoader vs Java's HttpRequest.

For things like AMF where the Flash and Java must use the same names....then it's up to you guys but I'd probably favor the Java side.

newblack
05-31-2010, 04:15 PM
there's nothing natural about 0 - 100. there's an arbitrary scale applied to it. go with 0 - 1

pixelwit
06-14-2010, 12:44 PM
There's nothing natural about 0 to 360 either but Flash still uses that. I eagerly await the day Flash adopts a rotation of 0 to 1.

-PiXELWiT
http://www.pixelwit.com

maskedMan
06-14-2010, 02:16 PM
There's nothing natural about 0 to 360 either but Flash still uses that. I eagerly await the day Flash adopts a rotation of 0 to 1.

-PiXELWiT
http://www.pixelwit.com

Where 1 == 6.28318531 radians?

*Boggle*

:)

pixelwit
06-14-2010, 04:12 PM
Where 1 == 6.28318531 radians?

*Boggle*

:)

Right, where 1 == 6.28318531/ 6.28318531 radians
or where 1 == 360/360 degrees
or where 1 == 100/100 percent
or where 1 == 256/256 binary degrees
or where 1 == 400/400 grads
or where 1 == 24/24 hour angles
or where 1 == 32/32 points
OR WHERE 1 == 1 TURN.
LONG LIVE THE TURN!

Crazy aint it? I kind of touched on the concept in my Arc Drawing Tutorial (http://www.pixelwit.com/blog/2007/07/draw-an-arc-with-actionscript/) and tried to explain why a ratio is better.

Just imagine how much easier Trig would be if the sine and cosine functions accepted ratios rather than radians too. Simple ratios the whole way through. I sort of touched on that subject in my other Circle Drawing Tutorial (http://www.pixelwit.com/blog/2007/06/basic-circle-drawing-actionscript/) with "magic" trig functions.

Let the computer mess with irrational numbers, people inherently understand 0 turns, 1 turn, or 1/2 a turn.

Sorry to hijack your thread for a minute there Cpucpu, but I think everything should be '0 to 1 based' for standardization purposes whenever possible. The concept of data abstraction isn't new but for some reason this idea hasn't really caught on. At least Math.random is already on track. ;)

-PiXELWiT
http://www.pixelwit.com

pixelwit
06-14-2010, 05:01 PM
I've reconsidered and am now certain that my previous statement is incorrect. Since you're dealing with sound, shouldn't it just go up to 11 (http://www.youtube.com/watch?v=EbVKWCpNFhY)?

-PiXELWiT
http://www.pixelwit.com

Flash Gordon
06-15-2010, 04:47 AM
buhwahahahaha....11

Elephantium
08-17-2010, 05:16 PM
I've reconsidered and am now certain that my previous statement is incorrect. Since you're dealing with sound, shouldn't it just go up to 11[/URL]?

-PiXELWiT



That's nothing. I can make one that goes up to 12!

Only $1500 -- it's a steal :-P

(shades of xkcd...I'd link, but my post count is too low)

alijaya
08-18-2010, 02:32 PM
hmmm... it is good to use 0-1 value, is it good for programming...
say if you want to calculate sound from x value from a sprite, you just have to divide the x value with the max x value allowed, and it's you sound volume.

but it's need to consider 0-100 value, color use 0-255 value, not 0-1 value, rotation 0-360, and it's nice to have if you precalculated what the value is :D.
so if i want my sprite heading right, i just need to set the rotation to 90, not 0.25, or heading north east, just to write 45, not 0.125 (wow).

sooo... make your decision :D *am i make this helpful or more complicated?

martian
08-26-2010, 04:02 PM
will this great man

drkstr
09-19-2010, 02:04 AM
pixelwit, you are my new hero! :D

but it's need to consider 0-100 value, color use 0-255 value, not 0-1 value, rotation 0-360, and it's nice to have if you precalculated what the value is :D.
so if i want my sprite heading right, i just need to set the rotation to 90, not 0.25, or heading north east, just to write 45, not 0.125 (wow).

That's just because you've been indoctrinated with arbitrary scales. You like 0-255 because that's what your used to (and is standard).

Color could easily be represented as a 0-1 ratio. For example, a color could have 0 red, or full (1 aka 255) red.

Personally, I think it's genius. But maybe that's because I consider myself more of a mathematician than a programmer...

I am now an avid fan of the ratio notation. :D

bradosia
01-16-2011, 04:59 AM
do 0-100 just incase you want users to control it. or else its either on or off. sometimes ppl want it a wee quiter

Ravi Bhadauria
02-20-2011, 10:46 AM
Both are the standard measurements these days.

specially 0-100 we use in actionscript 2.0 and 0-1 we use in actionscript 3.0.

Thanks
ravi bhadauria
admec multimedia institute