opposite of transratio?

Florent Ghys's icon

Hello,
I need to convert transposition frequency ratios (1: no trans, 2: up 1 oct, 0.5: down 1 oct) to transposition in cents (0: no trans, 1200: up one octave, -1200: down 1 oct).
What is the math to do something like this?
What I am looking for is the exact opposite of the transratio patcher.
thanks
Florent

kLSDiz's icon

sil-voo-plea

Max Patch
Copy patch and select New From Clipboard in Max.

Florent Ghys's icon

yay! merci beaucoup!