Remove integer from float number

kpp9c kp8 at mac.com
Fri Mar 24 08:08:46 CET 2006


okay... out of curiousity... how would you then seperate the interger
value from the fractional part do something to one side and then put it
back together... like if you had 8.01 and you want to add to the '8'
part in one way (ordinary decimal) and add to the .01 part modulo
something .. like say modulo 12 so that adding .11 to 8.01 would give
you 9.0 ...

so that you had something like:

 . . . 7.11, 8.00, 8.01, 8.02, 8.03, 8.04, 8.05. 8.06, 8.07, 8.08,
8.09, 8.10, 8.11, 9.00 ...

why you might ask? This is one way that computer's can understand
musical pitch... the '.xx' part represents
the pitch classes (chromatically c-b) and the integer portion
represents the octave... go from b 7.11 to c (7.12 = 8.0)
and likewise down from c (6.00 for example) to b 5.11 ...

sometimes you want to 'pop' off the pitch-class portion of the number
and do things but also keep track
of your octave crossings....

sometimes you think "why would anyone want to do that" so here is why i
could use such a thing..
you have sort of compound notation that has to account for the base 12
part of the problem and
our octaves in regular base 10...

hehe...

sorry iffin i am highjacking the thread ..

-k




More information about the Python-list mailing list