SynthMaker

Pitch to midi in SM?

Archive · 2008 15 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

nix ·

Hey all, I was just wondering if those in the know think I would have any success trying for pitch to midi in SM? Any help or ideas as to how to attempt this would be much appreciated. Wishing you satisfying creations, nix

nix ·

Hey again, To start with, I was wondering if it's possible to convert a float value to an integer value? Help would be appreciated muchly. Cheers, nix

Acrobat ·

nix wrote: Hey again, To start with, I was wondering if it's possible to convert a float value to an integer value? Help would be appreciated muchly. Cheers, nix

..in green data, just connect an F box to an I one, in poly audio, you need to round integer in code...

rl ·

> trying for pitch to midi in SM...

I'm not sure what you need. The pitch output of the Midi2Poly component carries the MIDI note number.

oddson ·

I think the idea is to create a midi stream from audio pitch data.

nix ·

Thanks very much Acrobat, That really helps. The problem I am having now is that I'm triggering multiple note on and offs, rather than just 1 when I introduce the audio signal. I'll try again now. That's what I'm trying to do oddson. If it could be accomplished you could even use your voice as a midi instrument. Wishing you satisfying creations, nix

oddson ·

Re: Pitch to MIDI In theory... you could filter the input to a passband that contains the fundamentals you want to capture. Then periodically 'sample' small bursts of audio and run them through the FFT component... use the max value in the array to determine the dominant frequency and calculate a pitch-bend or new note based on that...

Whether to use pitch-bend or new note would be based on the output of an envelope follower that's tracking the dynamics of the input - as would note-on and off events and their velocity.

Hurdles: The current FFT component may not have the resolution required. The frequency of 'sampling' and processing the results might be way too slow to be usable. The signal would have to be pretty clean - and intrinsically monophonic (in the sense of 'one note at a time').

As I understand it these schemes - when done by professional DSP programers - have always been a bit hit-and-miss. Even trying to do a pulse follower in SynthMaker I had pretty unsatisfactory results. I'm guessing this is an idea whose time has not-yet come.

rl ·

you could also try the poor man's approach to pitch estimation. High-pass filter the signal and count the transitions through zero. This will of course introduce some latency e.g. with a base frequency of 100 Hz the signal has a base period of 10 ms

oddson ·

That's likely to be a more productive approach given the limitations of the program... I might just try it... thanks Rudolph!

angstrom ·

I have an MS20 which uses this type of pitch tracking, although it's not very accurate it has a certain sound which is quite fun. 'Wailing' or 'electronic yodeling' might describe it !

I would go for a lowpass rather than a hipass, you want to try and keep the fundamental and discard everything else.

oddson ·

I'm sure he meant low-pass that's how I read it, I didn't even notice is said 'high'. It should be a bit of a brick wall too. I think the real problem is the possibility of multiple crossings where the fundamental approaches zero. So a steep rolloff would be essential.

Then the trick would still be to get the dynamics tracking working well enough to be passible. You'd have to hold off trigging the event until the new pitch had been detected. And you'd still have to sense pitch-bend vs. new note.

nix ·

Hey again, Thanks very much for your help. Both of these methods seem beyond me, but I will go over what's been said again. I am still interested to try. To take another approach, is there any way to control an oscillator without using midi, just audio? I know of FrettedSynth Audio's SE guitar controlled synths, and would hope to achieve something similar. If you would make the zero crossings method, oddson, I would be curious to try it. Wishing you satisfying music, nix

oddson ·

I did a little investigating and found the zero crossing method is not very reliable even in theory. Unless you strongly filter your signal to within a single octave band you can easily get multiple crossings from a signal with even moderate amounts of low-order harmonic content.

I was thinking if you summed the (absolute) values of each sample since the last crossing you could have some kind of threshold check that tries to determine if it is a localized crossing or the result of the fundamental oscillation. But it's just a thought so far and it would have to be calibrated with changes in the overall volume of the signal...

Anyway... I'll give the basic version a try and see where that takes me.

oddson ·

streamin x; streamout f; float x1,zx,i,i1,w,w1; // x1 is x @ t-1 // zx a mask -> upwards zero crossing is true // i is counter of cycles since last zx // i1 is the increment i is based on // w is the current wavelength calculation // w1 is a lowpassed filtered version of same

zx = (x1 < 0) & (x >= 0); // true when upward zero crossing reached

i = i1 - (i1 & zx);

w= (zx & 1 ==0 & w) + (zx & i1);

hop(16){ w1 = 0.25 * w + 0.75 * w1; f = 1/w1; }

//lagged/incremented values i1 = i + 1; x1 = x;

This code will extract the normalized frequency of a signal based on upwards zero crossings.

I've made no investigation on using different hop values for the wavelength averaging (using a low-pass filter on the calculated integer values) or on the responsiveness to the output frequency calculation nor have I given much thought at all to the averaging process or the lowpass coeff. It's just a rough sketch for now.

I should have been easy but I'm still not very good at masks. It takes me ten times as long to figure out how to do something with them as it would with normal if-then logic. 😕

oddson ·

The results are as expected... simple waveforms read OK but others less so. 🙁

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.