Pitch Detection - Theory, Building Basic Pitch Detection Ensemble, User Library Ensembles
Pitch Detection - Theory, Building Basic Pitch Detection Ensemble, User Library Ensembles
8/2/09 3:57 PM
reaktorforyou
Reaktor For You Community
Native Instruments Reaktor Community
Current Mood:
hot
Today we're going to discuss one of most interesting topics in Reaktor and in Digital Signal Processing as well
- pitch detection. I'm going to start with theory, based on some articles and after that we will build simple
ensemble, that will detect pitch of basic waveform and I'll insert some links to User Library uploads.
Pitch detection is a way to detect frequency and pitch of some sound, whether it is complex or basic one. Why
do we need to detect it? For example, you're going to remix some track and you have remix pack for this
track with vocal and guitar parts. But you don't know what pitch does these original samples have. Of course,
you can drop these samples to your host sequencer and try to draw some notes and listen if they fit pitch of
those samples or not. However, you would be glad to see some ensemble made in Reaktor which will allow
you do detect pitch automatically and will show you different tones of samples being detected. There is such
ensemble in User Library and we'll get back to it in the end of my post.
The very first and basic method which is used to detect pitch of sound is zero-crossing, which is part of
Time-domain approaches. Basically if you take a look at any waveform (for example, saw wave) you will see
that it is sometimes reaches 0. If we will be able to detect how often it reaches those zero points we will be
able to detect frequency of sound. And as you know from previous posts it's not hard to detect pitch after
that.
http://reaktorforyou.livejournal.com/5957.html Page 1 of 4
Reaktor For You Community - Pitch Detection: theory, building basic pitch detection ensemble, User Library ensembles 8/2/09 3:57 PM
But as you can see it won't work (or won't work properly enough) with more complex waveforms. For
example, with vocals or guitar chords, as they have many zero crossings at several times. Here the second
method goes in - using filters you can get your wave make less zero-crossings by reducing unpleasant
frequencies.
In general a complex waveform is actually made up by simple ones, so if we could increase the domination of
the important one and decrease the others, we could easily use the zero-crossing method to track the
freq/pitch of the waveform, since the crossing only happens on its fundamental period. And this can be
achieved with filters, we can use it to filter out or at least reducing the upper harmonics so the fundamental
will be the loudest one, and zero-crossing only happens on the fundamental period.
Okay, we've done with main theory, now the main problem is to implement it in Reaktor. We won't build
complex waveform detector today, indeed we're going to concentrate on smaller project to understand
complex issues. We're going to build pitch detection for sawtooth oscillator. Let's start.
First, insert Sawtooth Oscillator and connect Note Pitch and Gate outputs to it P & A inputs. Now we need to
detect how often this wave reaches 0 when we play notes on our keyboard. This work would be much more
harder if we didn't have A to E (Trig) module, which can be found in Auxiliary modules. It does all the main
work - when our wave reaches 0 event with value at A strikes. So each time we have zero-crossing we will
have event with value 1. Now we need to count how often this event occurs, as it is going to be our frequency.
For this thing there is also another great module in library called Timer from Event Processing. It counts
frequency of event that strikes trigger input and outputs frequency and time of this event. That's what we need
- connect output of A to E Trig module to Timer and we'll have frequency of oscillator on output. After that all
we need to do is to connect module Log. (F) in Math to frequency output of Timer and we'll get our pitch.
http://reaktorforyou.livejournal.com/5957.html Page 2 of 4
Reaktor For You Community - Pitch Detection: theory, building basic pitch detection ensemble, User Library ensembles 8/2/09 3:57 PM
It's working good so far, however our pitch is changing from time to time and is floating value. It would be
better to use integer stable number for our pitch. For this we can use Quantize module which makes float
changing values into stable integer. You have to connect output of Log. (F) module to input of Quantize
module and step should be 1, so Quantize will work for our purpose.
Now you can connect Numeric Readouts to both output of Note Pitch and output of Quantize module to be
sure your pitch is detected right. After that you can connect test oscillator (for example Sine Oscillator) to
Quantize input and sum two signal (Sawtooth Oscillator & Sine Oscillator) to hear if your pitch is detected right.
Final scheme of your ensemble will look like this:
(http://pics.livejournal.com/reaktorforyou/pic/00018t9c/)
Now you can try to connect some complex waveform (for example, sample with vocal) to A to E Trig input and
99% you won't get positive result as complex waveform has much more zero-crossings at same time.
Theoretically you will have to use low-pass filter as they reduce zero-crossings. The lower the pitch, the better
zero-crossing is, however it's not a rule, but for most waveforms it works like this.
Try inserting different filters in your project and you'll see their effect.
We've been working together with BertAnt on Splatter Pitch Detection Analyzing Tool which was uploaded to
User Library here:
Splatter is ensemble which allows to detect pitch of different waveforms - from basic ones (for example saw
and sine) to complex ones (vocals or guitar chords).
It is a simple pitch tracker / analyzer using zero-crossing method which has a scope to easily see the actual
zero-crossing after it's been filtered with two LP filters.
http://reaktorforyou.livejournal.com/5957.html Page 3 of 4
Reaktor For You Community - Pitch Detection: theory, building basic pitch detection ensemble, User Library ensembles 8/2/09 3:57 PM
Page 1 on Google !(Anonymous) Hooray, this tutorial shows on page 1 on Google search for keywords "reaktor
pitch detector" ! :D
Bert
Re: Page 1 on Google ! : reaktorforyou: Really? Great. I wish my blog was on first pages of google as
well..:D
Re: Page 1 on Google !(Anonymous) I think you should add more 'Reaktor' and 'tutorial' words on your
page (and it's better on the title ;) ), your blog is already favorited by google i sense, it's just that maybe it
didn't realize this is a Reaktor tutorial source..
Bert
ADVERTISEMENT Customise
http://reaktorforyou.livejournal.com/5957.html Page 4 of 4