# (Teletype) Inverse N OP needed / nearest N to IN

Hey all,

Can anybody help me figure out how to get the nearest N value to a given IN value - in other words, what equal temperament note is closest to the current CV input? Or I guess how would I go about quantizing IN to the equal temperament chromatic scale?

I’m doing this so I can play notes from a CV keyboard into TT and store in patterns, but I’d like to have N values instead of the “raw” CV as given by IN.

Apologies if this has been asked before, but my forum searches haven’t turned up anything that helped me solve this question. I did see other peoples’ posts about various quantizers, but those seemed to all deal with quantizing to specific heptatonic / pentatonic scales.

Any help would be greatly appreciated!

Edit: @alanza with the solution:

1 Like

Perhaps the quantize QT op? (To N 1)

3 Likes

`QT IN N 1` does get you there a lot quicker than what I had in mind!

3 Likes

Thanks, I did actually try that! But it’s not quite what I need - so for example, if I put 1V into IN, I need to somehow have Teletype convert that to 12 (10V would be 120 etc.). `QT N 1` however gives me 1644 as a result, which isn’t “12” and actually isn’t even the correct CV value as output by `N 12` (it should be 1638)…

Ahhh, what you want is `/ QT IN N 1 N 1`. i.e., crush the value of `IN` to the nearest `N` value, and then division by `N 1` should give you a more human-readable number.

5 Likes

OOooOO that’s it! Nice! Thank you so much!!!

1 Like

I’m trying this out with a keystep right now and finding it works until the 4th octave. A and Bb are both coming back as 45 and then everything after that is one less than it ought to be

I’m also using a keystep and it works fine for me. I did calibrate TT beforehand to the output of the keystep (using `IN.CAL.MIN` and `IN.CAL.MAX`), so maybe give this a try?

2 Likes

jonas as a new comer to TT and I have a key step - I’d love to try this - could you show me the shole script for this?

I tried calibrating and I’m still not getting a perfect conversion across the whole range.

The first issue comes at the 5th octave. C gets me 60, but then C# is also 60. Then D is 62 as it should be and it keeps ascending properly until A which returns 68 (the same as G#). From there, everything is one lower than it ought to be. The next C is 71, but if I keep pressing it, it occasionally gives me 72. When I look at the raw value coming in for that key, it changes a little bit… 9782, 9773, 9818 are the values I see, but it’s mostly 9782.

Anyone else with a keystep experiencing something like this? Any recommendations? I’d really like to get this conversion solid!!!

hmm if i change the line to `/ QT + IN 60 N 1 N 1` (offsetting the value by 60), I get accurate conversions until the final octave (A and A# both come back as 117), so that seems workable, but I can’t fit it into a DEL pre statement anymore

we’re all using a short delay before reading from IN, after receiving a gate, yea?