Magic numbers

Started by Torkell,

Torkell

This for Ian (and anyone else who wants to try and answers this):
Is the magic number 64?


Torkell

Wrong!

Okay, here's a hint: it's a default number for somewhere in XMPlay.

Tsorovan

#3
63

Default Volume is, if I'm not mistaken 63.
Same thing with Amplification.
Default buffer length is 0.63s.
Lowest EQ frequency control is 63 Hz.

What do I win!?

(Add the zero and you'll get 64, I guess.)

Fraggie

QuoteWhat do I win!?
A first class, one-way ticket to Albuquerque.

Torkell

#5
Wrong again (but not quite)!

Default volume is 90
Default amplication is 64
Default buffer length is 0.75
(you're right about the EQ band but that's not what I was thinking of)

While I'm at it...
Default EQ settings are (lowest first) 5.0, 1.0, -1.0, -2.0, 1.0
Default reverb settings are (cutoff) 80, (level) 30

I'll tell you what I think is going on, and you can tell me if I'm right. I think that there are some special settings for the amplification:
amp = 0 : off
0 < amp < 64 : deamplify (i.e. decrease output)
amp = 64 : no change
64 < amp <= 100 : amplify
I worked this out when I was getting clipping from a WAV file with the amp set to 100.

Note: this was with a fresh install of XMPlay, absolutely no settings already in registry/files/whatever.

Tsorovan

#6
Interesting; I wonder why I have so many 63s? To my knowledge I haven't changed any of those settings except for maybe volume, as I neither use EQ nor AAR, and buffer length is unchanged. This is spooky! :D

I do by the way not notice your phaenomenon here, but then again we have different sound cards so levels won't be the same eh?

Tsorovan

#7
Hmm, now when I was toying around, the amplification slider moves by itself, even though I've got AAR turned off...is it supposed to do that? o_O
It likes to settle at 63, but it made some songs clip when I've got the volume at 100. I'll set volume at 63 too like before because then the amplification seems to be content to stay put.
———————
I'm officially a retard; I somehow had managed to enable Auto-Load Settings. I feel so humiliated now. :(

Torkell

I don't know about different sound cards, I've got a choice of 5 or 6 (a pair of onboard VIAs, onboard SoundMAX, SB128, SB4.1 Live, Crystal PnP sound and some other onboard thingy - obviously not all in the same PC).
It seems to settle at 63 because it reduces when it shouldn't do (I bet if I played a square wave at full power (+max to -max) it would decide it was clipping).
QuoteI'm officially a retard; I somehow had managed to enable Auto-Load Settings. I feel so humiliated now. :(
I must now :laugh::laugh::laugh: !

Ian @ un4seen

QuoteI'll tell you what I think is going on, and you can tell me if I'm right. I think that there are some special settings for the amplification:
amp = 0 : off
0 < amp < 64 : deamplify (i.e. decrease output)
amp = 64 : no change
64 < amp <= 100 : amplify
There aren't really any "special settings", it's just a straightforward logarithmic scale...

amp 0 = -15.4db
amp 64 = 0db
amp 100 = +8.7db

I wanted more attenuation (level reduction) to be possible, incase XMPlay greatly over amplified some MOD file at the default level... not sure why I chose 64 in particular for the default - guess, as a programmer, I just have powers of 2 on the mind :D

QuoteIt seems to settle at 63 because it reduces when it shouldn't do (I bet if I played a square wave at full power (+max to -max) it would decide it was clipping).
It should (and does here :)) stay at 64 in that example, providing that eq & reverb are not on.

Zarggg

64d = 2^6 = 1000000b = 40h = 100o ;D

Torkell

64 = 2^6 = 4^3 = 6^2

It's a very nice power of two, and if you're a programmer then you'll know just how important powers of two are. Some examples (for valid ranges):
byte (VB: Byte): 0 to 255 (2^8-1)
unsigned short int: 0 to 65535 (2^16-1)
signed short int (VB: Integer): -32767 (-2^15+1) to 32768 (2^15)
unsigned long int: 0 to 4294967295 (2^32-1)
signed long int (VB: Long): -2147483647 (-2^31+1) to 2147483648 (2^31)
Floating-point numbers (e.g. float (VB: Single), double (VB: Double)) use a mantissa and exponent. The VB Decimal type is a scaled 64-bit integer, I believe (and I'm not sure what the valid range is). There are 92- and 128-bit data types, but they are actually implemented as structures.

To finish off:
1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, ... (don't know any higher ones without working them out).

Tsorovan

#12
Not to be a total arse, but you must mean 8^2, not 6^2 which is 36.

Furthermore, I believe a signed INT is -32768 to 32767 (and all other types of INTs concordantly so) as 0 is regarded as a positive number, but it was aeons ago I did any sort of programming so I might be wrong on that one.

Zarggg

#13
MAXINT in Java is defined as (2^31) - 1. I can't speak for Visual Basic.

Torkell

QuoteNot to be a total arse, but you must mean 8^2, not 6^2 which is 36.
I was thinking 8^2 when I wrote that.
QuoteFurthermore, I believe a signed INT is -32768 to 32767 (and all other types of INTs concordantly so) as 0 is regarded as a positive number, but it was aeons ago I did any sort of programming so I might be wrong on that one.
I guessed (I had a 1 in 2 chance of getting it write). I'll check what it is for VBA... you're right. It makes sens actually, given that all the other ranges have an upper limit of 2^x-1 (e.g. 255, 65535). Does this make me the official retard now? ;D

Torkell

Ian, if a WAV file is generated and it contains clipping (e.g. because the input level was too high), will XMPlay reduce the amplification when it plays that file?

Ian @ un4seen

Nope. (assuming no EQ or reverb)