Division object


#1

Hello!
I'm trying to do division by a set constant, preferably output floats. Figured I'd just copy an object and modify it, but division by inlet_x / inlet_y doesn't seem to work.
I took a look at STAR.axo, which uses the ___SMMUL construct. Looking up the assembler for the processor, two division instructions are available, SDIV and UDIV, but the compiler says the command isn't specified in this scope.

My objective is to make a ms -> Hz conversion, maybe there is another way of doing it besides 1/ms? smile


#2

math/reciprocal

There is no a/b division object, the reason is that division by zero is illegal, and such object would have an extreme dynamic range.


Wishlist of objects
#3

OK I can understand that, but how about other ways of doing Hz<->ms conversion? smile


#4

The Axoloti objects work internally with "native" units, only the GUI shows corresponding real-world units.
Internally (in object code) there is no Hz unit value, but fraction of samplerate. There is no milliseconds counter but k-rate ticks. This makes efficient use of processing power and precision.


#5

Alright, I'll just have to rethink what I had in mind then!
The purpose was to slave to incoming signals but I think it'll probably work with midi for my current needs.
Thanks for your explanation! : )


#6

I need this so baaad.
max/msp example:

how can we get there?

In the object editor,I found this parameter option

which seems to point in the right direction..is there any function/class I could call from my code?


#7

Id suggest LFO is perhaps closer to what you want.... (if you click on the label, it will cycle pitch between hz and ms etc)

k, what you have to understand is that for efficiency, we don't store things as numbers like milliseconds ( e.g. 43mS) , instead they are converted into internal units, which are then display to the user. (similar to how say, pitch runs -64 to +64)

so... you will find things like the parameter you mention, and the lfo one above, have a defined range and scaling for 0 to 64, or -64 to +64.

of course this doesn't mean you cant do it... its just means its a bit of maths you have to do...
as Johannes pointed out, you already have a math/reciprocal , so to do division you multiply by the reciprocal... just I fear this wont get you wear you want....

perhaps its better to create a post, explaining what you are trying to do...
I suspect, its just you have to perhaps go around it a different way.


#8

soooo....

I just sketched up something pretty close to a tap-tempo-object.
what it does roughly,is start counting and then setting a saw-LFO to the corresponding speed.
I guess this is useful for a tap-tempo object...
I'm not shure how I did it,there's a lot of experimantal bit-shifting in there... :wink:

taptempo_4.axp (4.5 KB)