## Detecting within fractional note range.

Jan 18, 2012 at 12:45am

# Detecting within fractional note range.

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.

#61300
Jan 18, 2012 at 2:16am

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

#220993
Jan 18, 2012 at 8:34am

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

#220994
Jan 18, 2012 at 9:53am

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.

#220995
Jan 18, 2012 at 10:11am

is this something like what you need?

– Pasted Max Patch, click to expand. –
#220996
Jan 18, 2012 at 10:23pm

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!

#220997
Jan 19, 2012 at 12:26am

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.

#220998
Jan 19, 2012 at 1:04am

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.

#220999

You must be logged in to reply to this topic.