Cabbage Logo
Back to Cabbage Site

Opcode for converting floats into numbers in base n?

Are there Csound opcodes for converting a floating point number into a floating point number expressed in base 3 or 4 or 5 etc. ?

None that I’m aware of. Do you mean log base 3? Or are you trying to represent a floating point number in base 3, i.e., as a ternary digit?

The latter. Just as you have binary numbers (base 2), there are ternary numbers (base 3), quarternary numbers (base 4) , etc. I like to convert a given floating point number to a number in a chosen base (that may be 2, 3, 4, etc.).

Then you would need to write a UDO I think. You might also have to use strings to represent the digits? I don’t know, just thinking aloud…

Could it be that somebody has already written such a UDO? And if so where can I find it?

Steven Yi has released a base 16 system for creating hex beats in Csound.

Thanks. But that’s not quite what I’m looking for.

No, but he does work with base N representations of numbers as strings, which is probably what you might need to do too. Either way, I don’t think there are any opcodes for this. Are you on the Csound discord forum? You could try asking there :+1:

Took a look on the Discord forum but I don’t understand how that forum works. Are there no topics there? Or a tutorial on what you are supposed to do?

It’s not really a forum, it’s more a chat room. People drop in and out all the time. Just throw out the question and see who bites :+1:

OK - I will do so tomorrow. It’s getting late here. :wink: