Smoothing the output of fzero~ (when converting to MIDI)?

Oct 2, 2013 at 3:02am

Smoothing the output of fzero~ (when converting to MIDI)?

Hi!

I’m trying to build a device to convert mono melodies to MIDI notes using fzero~. The problem is that fzero~ outputs continuous flow of frequency data, which needs to be smoothed to be useable as MIDI notes.

Here is my attempt to achieve this (see attached image and the code). Please, can you advice a better ways to convert the frequency flow to useable MIDI notes?

Thank you!

<code>

– Pasted Max Patch, click to expand. –

</code>

Attachments:
  1. PitchMIDI-MONO
#266818
Oct 2, 2013 at 5:23am

I didn’t try this out, but it may help:

<code>

– Pasted Max Patch, click to expand. –

</code>

#266826
Oct 2, 2013 at 6:29am

Thank you for your help.

It seems, we don’t need an additional amplitude level check, as fzero~ outputs 0. as a frequency when there is no signal: so all of the ‘empty’ MIDI-notes are filtered at [if $i1 > 43 then $i1].

There are great ideas in the smoother patcher. Unfortunately we can not use smth like [slide] as it introduces unwanted chromatic arpeggios. I will try to investigate further the [zl group] > [zl median] approach. This seems promising despite of the latency it introduces…

There is another one approach. We can switch fzero~ to output a list (frequency and amplitude) instead of a Bang from it’s right outlet when detecting onset. Theoretically detected onsets can be used as MIDI note triggers. But currently the list contains 0. as a frequency on 90% of detected onsets. Is this a bug and the frequency is outputted before it is really detected?

#266830
Oct 2, 2013 at 4:30pm

to get around the ‘arpeggio’ artifact you could get the difference (delay and subtract, absolute value) between two adjacent analyses and if the jump is larger than a semitone you switch out the slide object (adds more latency)

but i think there are more robust pitch detection strategies around — i believe fiddle~ is the 3rd party external of choice. i think it uses sophisticated fft and cepstrum analysis to get a more ‘perceptually’ accurate result, and maybe has built-in smoothing algorithms…? worth checking out anyway

#266890
Oct 2, 2013 at 5:21pm

The onset detection in fzero~ can be triggered by amplitude changes, as well as pitch. So, there are cases where it reports that a note has happened before it has a good guess about what the pitch is.

You could use the bang to open a gate, and then take the first non-zero pitch out the left outlet. Untested:

<code>

– Pasted Max Patch, click to expand. –

</code>

#266899
Oct 6, 2013 at 7:05am

I’ve done a lot of pitch tracking using fiddle~ and gbr.yin~ (FTM from IRCAM, which is GREAT but doesn’t work with M4L), and just starting to look at fzero~. For M4L I will perhaps use yin~ for the time being or revert to fiddle~. Putting a “round” object between fzero~ and ftom is very important for me (violin) using any trackers. I will be looking into using analyze~ (CNMAT) to compare with the fzero~ tracking…

#267215
Oct 6, 2013 at 10:20am

Instead of zl.group with zl.median, try zl.stream.

I’ve had good experiences with transcribe~ for piano.

#267237
Oct 6, 2013 at 4:09pm

Instead of zl.group with zl.median, try zl.stream.

yes, that’s what I meant

#267271
Oct 6, 2013 at 5:30pm

@VK: Have you gone through the settings in the back tabs of the help file? I generally find that a bit of tweaking can really improve the results.

What kind of signal are you trying to track?

#267274
Oct 7, 2013 at 9:56am

Any feedback about how people are using fzero~: settings tweaks, what works, what doesn’t, &c. would be appreciated. That object is still relatively new, and I’m sure there are improvements that could be made.

#267340
Oct 7, 2013 at 9:59am

Another interesting smoothing approach is CNMAT’s “look before you leap” object:

http://cnmat.berkeley.edu/patch/4067

It doesn’t incur the latencies that a running average will.

#267341
Oct 7, 2013 at 11:26am

Have you gone through the settings in the back tabs of the help file? I generally find that a bit of tweaking can really improve the results.
What kind of signal are you trying to track?

This is a tenor-saxophone. Monophonic signal, harmonic-reech and not really stable at the pitch.

Yes, I was experimenting with these without significant success. The pitch recognition seems good enough as a continuous data flow, but I’m still not able to quantize it to a valid MIDI notes…

#267351
Oct 7, 2013 at 8:49pm

Is this any better? worse?

<code>

– Pasted Max Patch, click to expand. –

</code>

#267401

You must be logged in to reply to this topic.