[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Conversion decimal into fractional




When I first wrote SC I debated whether to include rational numbers because I used just intonation heavily. I didn't include them for several reasons including:

slower
more data types make the language and its implementation more complex and harder to grow and maintain (complexity grows with the square of the number of numeric types) double precision floats are more than enough precision for music for any human time scale

I think too many just intonation people get beguiled by the multi-dimensionality of rational numbers and get into hair splitting, forgetting that pitch is still a continuum, not a multidimensional space. It is interesting that the culture that exploits just intonation most (but not from a mathematical POV) is one where vibrato and glissando are a highly developed feature.

You can convert a rational to a float with / and I demonstrated how to convert them back. That should be enough. The same argument you make could be made for arbitrary precision arithmetic and the same three reasons above apply for SC. In fact I have considered removing integers from SC because they are not really needed since double precision floats can represent much larger integers than the 32 bit integer class, and all the same operations can be implemented. The Lua programming language does not have integers. http://www.lua.org/pil/2.3.html

I did not add pavaroh to SC. that was julian.

On Dec 21, 2004, at 3:29 AM, Ph.E wrote:

James McCartney wrote:


Somehow I am able to do just intonation just fine with 64 bit double precision floating point.


Of course. And why bother to give instrumentalists a music sheet with notes and staves? We could as well give them a listing of frequencies expressed in Hz, durations in ms, and amplitudes in dB. Likewise, I don't think you could have created SC, had you had to use only a bunch of "0" and "1" to code it. My point is that data representation is as important as data themselves. Speaking of the pythagorean mystics would be off-topic here, suffice it to say that when you write 3/2, you express a relation between 2 integers. This meaning, given by this relation, is lost when you use the decimal form. That's why rational numbers are so important in music, and more generally, in arts: they express a relation.

I understand now that you had to give up a few things, like rational numbers, for the sake of real time execution. This answer sounds more...rational than saying that my request does not make sense. It has been making sense for the last 25 centuries, and probably before. Let us remind that a western aberration like 12-EQ has only been raging for the last 2 centuries (may it die quickly). As for the pertinence of taking into account rational expressions in the SC main distribution, we could ask ourselves whether it would be less pertinent than including the Pavaroh class.

Now, if it possible to have floats represented as rational numbers, that is, if we can input arrays of ratios to functions which would output arrays of ratios, this would solve the problem. Whether the function uses floats or ratios to compute the ratios is irrelevant to the user, as long as he can add, substract, divide, multiply and generate single ratios and arrays of ratios. If this could be done by simply appending .asRatio, as we do with .asFloat, this would be ideal.

I could probably try to code my own hack for my own personal use. But there is more to it. First, if this is done by a professional programmer, it will be more efficient and elegant. And second, maybe the more important, you understand that behind this matter of rational numbers, lies another conception of music, and music scales. By including in the main SC distribution a way of dealing with rational numbers, you recognize this alternative conception of music. Likewise, I guess that you included Pavaroh in the SC distribution as a way of expressing your taste for ragas, didn't you?

Philippe.










_______________________________________________
sc-users mailing list
sc-users@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-users