Forums > MaxMSP

Detecting within fractional note range.

January 18, 2012 | 12:45 am

Hey everyone,

I’m working on some pitch-matching magic and I’d like to check whether my sample frequency is, say an eighth tone of a target frequency.

My target tones are arriving from a midi file via seq, through a midiparse, stripnote and mtof.

Should I simply run a function on my mtof’d frequencies to determine what my range for a quarter note in each direction should be, perhaps add a pitchbend into the chain that the midi level and then sample that or leverage some other method that is lurking in the toolkit that I have yet to bump into?

I’m looking at using splits to determine whether my sample frequency lies between an eighth below and an eighth above the target frequency but I obviously need to accurately synthesise these frequency values in order to make this work.

Any pointers would be very much appreciated.


January 18, 2012 | 2:16 am

Where is the sample frequency coming from? Are you planning on doing some sort of pitch analysis on the sample?


January 18, 2012 | 8:34 am

That’s right Chris, but obviously the permissable deviation would vary depending on target pitch.


January 18, 2012 | 9:53 am

Well, leaving aside the pitch analysis for now, you could drive mtof with a floating point number and get back a floating point frequency. If your target was C (MIDI 60) you could hit it with notes of 59.75 and 60.25 to find a permissible frequency range.


January 18, 2012 | 10:11 am

is this something like what you need?

– Pasted Max Patch, click to expand. –

January 18, 2012 | 10:23 pm

Ha! I completely overlooked the possibility of converting my input frequency into the MIDI realm. For some reason I figured that fractions of notes would just be quantized out.

So good call there Chris.

Thanks for the patch Terry. I’m probably being a bit stupid but how does the bounds comparison work? I understand rounding the input frequency MIDI value to the nearest quarter note but the equivalence operator appears to only have a reference note as input and the comparison appears to be equal or not equal. How is the accuracy +/- 0.125 specified?

Thanks again everyone.

Edit – Scratch that – it was just too simple for me to see it. Excellently elegant solution!


January 19, 2012 | 12:26 am

Just one more thing before I shut up Terry: :)

If I wanted to attach something to the underside of the toggle which would constantly add into an accumulator all the the toggle was ‘ON’, say at a certain quantity per second, where might I look for such a component?

Many thanks for all the marvelous help.


January 19, 2012 | 1:04 am

Rob, try using the [toggle] to turn on a [metro] set to the rate you want to run at driving something like [counter] or [accum]. You can then use [sel 0] attached to the [toggle] to reset either of these objects when the input goes out of range again.


Viewing 8 posts - 1 through 8 (of 8 total)