Author Topic: Magic numbers  (Read 11936 times)

Torkell

  • Posts: 1168
Magic numbers
« on: 7 Jun '03 - 11:08 »
This for Ian (and anyone else who wants to try and answers this):
Is the magic number 64?

Jace

  • Posts: 842
Re: Magic numbers
« Reply #1 on: 8 Jun '03 - 01:19 »
42 ;D

Torkell

  • Posts: 1168
Re: Magic numbers
« Reply #2 on: 8 Jun '03 - 15:37 »
Wrong!

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

Tsorovan

  • Posts: 1247
Re: Magic numbers
« Reply #3 on: 8 Jun '03 - 19:49 »
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.)
« Last Edit: 8 Jun '03 - 19:50 by Tsorovan »

Fraggie

  • Posts: 713
Re: Magic numbers
« Reply #4 on: 8 Jun '03 - 20:12 »
Quote

What do I win!?

A first class, one-way ticket to Albuquerque.

Torkell

  • Posts: 1168
Re: Magic numbers
« Reply #5 on: 8 Jun '03 - 21:15 »
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.
« Last Edit: 8 Jun '03 - 21:16 by BoggyB »

Tsorovan

  • Posts: 1247
Re: Magic numbers
« Reply #6 on: 8 Jun '03 - 21:19 »
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?
« Last Edit: 8 Jun '03 - 21:23 by Tsorovan »

Tsorovan

  • Posts: 1247
Re: Magic numbers
« Reply #7 on: 8 Jun '03 - 21:30 »
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. :(
« Last Edit: 8 Jun '03 - 21:32 by Tsorovan »

Torkell

  • Posts: 1168
Re: Magic numbers
« Reply #8 on: 8 Jun '03 - 21:43 »
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).
Quote

I'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

  • Administrator
  • Posts: 26254
Re: Magic numbers
« Reply #9 on: 10 Jun '03 - 10:58 »
Quote
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

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

Quote
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).

It should (and does here :)) stay at 64 in that example, providing that eq & reverb are not on.

Zarggg

  • Posts: 1242
Re: Magic numbers
« Reply #10 on: 10 Jun '03 - 16:18 »
64d = 2^6 = 1000000b = 40h = 100o ;D

Torkell

  • Posts: 1168
Re: Magic numbers
« Reply #11 on: 10 Jun '03 - 18:45 »
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

  • Posts: 1247
Re: Magic numbers
« Reply #12 on: 10 Jun '03 - 19:59 »
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.
« Last Edit: 10 Jun '03 - 20:00 by Tsorovan »

Zarggg

  • Posts: 1242
Re: Magic numbers
« Reply #13 on: 10 Jun '03 - 22:54 »
MAXINT in Java is defined as (2^31) - 1. I can't speak for Visual Basic.
« Last Edit: 10 Jun '03 - 22:55 by Zarggg »

Torkell

  • Posts: 1168
Re: Magic numbers
« Reply #14 on: 11 Jun '03 - 16:35 »
Quote

Not 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.
Quote

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.

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

  • Posts: 1168
Re: Magic numbers
« Reply #15 on: 11 Jun '03 - 16:36 »
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

  • Administrator
  • Posts: 26254
Re: Magic numbers
« Reply #16 on: 14 Jun '03 - 11:52 »
Nope. (assuming no EQ or reverb)