SynthMaker

Examples of a guitar tuner.

Archive · 2010 20 old posts

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

attic ·

Are their any examples of a guitar tuner that have been made in Synthmaker?

oddson ·

Do you mean something that 'listens' to the input and give's you up/down signals?

This might be where the zero-crossing pitch detection would be good enough since it's problem wasn't so much with accuracy as with delay and difficulty with extraneous noise.

Also you could impose some very specific filtering to boost the note you're looking for.

Start here:

Pitch to midi in SM?

I could give a hand if you're really interested.

nix ·

The latest revision of 2SYN might help (check it if you like oddson, it samples 50 or so 0 crossings and grabs the middle one->

Also BertAnt has a tuner essentially. It's called FretKeys and the 2SYN thread includes it 🙂

attic ·

Hi Oddson Yes that's what I meant "listens' to the input and give's you up/down signals"

The links you both posted are very interesting thank you, but I'm not sure I can do that level of rocket science yet. I was wanting to give my users a simple way to tune as some people don't have perfect pitch. I was thinking something might have already existed along these lines.

For my purposes all I needed was a one note tuner ... If I thought I could pull it off, it would work as so ....Listen to the input and show the up down signals for tuning to middle c, as I only need the user to tune one note and the rest will be taken care off.

Cheers

oddson ·

I've slept on it and I'm thinking there are a number of techniques that could be used to make this. It might be best to combine two of them as some work well in narrowing the field well others work better on telling you when you're zeroing in on the target.

1) FFT - a fast fourier transform of the incoming wave would be able to tell you what ball-park you're in but won't give you the cent values you need to get that last nudge of a turn.

2) Zero-crossing - will give you the approximate pitch but only if you don't have strong harmonic content messing up the wave (causing other zero crossings than those associated with the fundamental). On the plus side the harmonic content of a vibrating string tends to diminish faster than the fundamental so this problem may only happen in the attack of the note and the system could just delay output until it's getting a stable reading from the crossings -- a luxury you can't afford for performance pitch detection.) Another problem is that the sample count between crossings will be an integer value that will not correspond closely enough to get 'dead on' values. But a filter or averaging system might get you that last bit of accuracy (the average value over even a few cycles should be very close to the actual wavelength) or you may need to use something else for last bit.

3) Beat detection - once you're withing a few Hz of the target you can compare a pure and perfectly tuned sine wave with the signal and have the system 'listen' for beat frequencies in the sub-sonic range. You would have to LFO the pitch around the target to tell if you are high or low as the speed of the beat won't tell you for sure. (This is how a human gets the last way there... after the pitches are too close to hear the qualitative difference between them you can still hear the beating from them not lining up exactly... that last little wobble with your thumb tells you when you're dead on.)

4) Sweeping Peaking Filter - a very narrow band, high gain rate peaking filter could sweep around the target frequency and the peak value of the envelop from the resulting signal would give a good indication of where the centre is.

I'm sure one or more of these could be used to make a working system.

Yes there are some 'rocket science' sounding things here but the great thing about SynthMaker is you don't have to really understand the inner workings of something to use it like a black-box... if you understand it's inputs and output you don't need to know how it works.

Because tracking speed isn't imperative this is a much more achievable project than obtaining rock-solid pitch detection from performance signals.

nix ·

Hey attic and McBarGig, Here is the start of a tuner. It's no good for cents and the note display is midi note no. not letter. It can be changed to use floats instead of integers so cents might work. The blue line is the note you are tuning to and the little led comes on when it is within 1/127 of the note. Just a start like if yous want to pick it up. I can help 🙂 Cheers

oddson ·

Turns out SynthMaker's green-only FFT is quite usable for this application without need for any of the other techniques mentioned.

I found some threads on the net about interpolation from bin values and come up with this (I got it working without really understanding why or how!).

It seems to be fairly robust with different source signals provided the fundamental has more sound energy than any of the harmonics... if that's not the case a simple low-pass could help make sure it does.

The error seems to be < 0.1 Hz which I'm pretty sure it close enough for jazz (and classical and maybe micro-tonal).

Since it outputs actual frequency (instead of an analogue for how close your fit is; like a beat system would do) you don't have to resort to sweeping LFOs and fancy math after the fact...

Just compare the result of an audio input with the anticipated frequency and it will read a difference value. The sign of the difference is the direction and the magnitude is how far off you are.

nix ·

That's cool oddson! I have use it to make a guitar to midi. I'll post here tonight. It triggers the note on after one fft is done. Works pretty good 🙂

oddson ·

For MIDI pitch detection make sure your tick rate is 100 and you might want to lower the number of data-points and/or eliminate the bin-interpolation as the pitch accuracy is really not that important (especially for anything other then low notes were the frequencies of semi-tones are several to 100s of Hz apart).

I might dust off the work I did on this and see if this approach can replace the sample-rate zero-crossing approach.

MegaHurtz ·

oddson wrote: I might dust off the work I did on this and see if this approach can replace the sample-rate zero-crossing approach.

It will pull it`s pants down and give it a good ole spanking 🙂 Nice work!

nix ·

Here is no.2 of the tuner. I have check it with a Korg one. It works, mighty thanks oddson 🙂

nscerri ·

Hi Guys,

First of all great work oddson and nix. I am new to this forum and Synthmaker and currently working on a thesis, and part of it involves pitch detection.

I really wish to know on what algorithm is this based on? I noticed that at first you mentioned the zero crossing method, yet about the last post by nix, does it use the same method?

Thanks in advance and of course any post that you send me will be properly acknowledged in my thesis 😉

Regards

Noel

oddson ·

It's using one of SynthMaker's Fast Fourier Transform primitives.

I barely understand how this stuff works in a broad-stroke, hand-waving sort of way. I just plodded along with trial and error. But because I could tell how close I was getting by comparing the actual frequency with my detected frequency I was able to make something that worked because the results told me when it didn't.

Zero-crossing, on the other hand, is quite simple. It' just looking for the point where the signal transitions from negative to positive. But it's intrinsically inaccurate (because it provides an approximate wavelength as an integer value of samples -- so averaging across several crossings or using some kind of interpolation for how close to zero the before and after samples are to approximate true wavelength is need) and it's prone false readings when harmonic content can cause multiple crossings in the same wave cycle (which you can minimize with filtering but unless you already know the approximate frequency (where you can apply a very strong peaking filter to emphasis the fundamental) you can have signals where it will not work at all.

McBarGig ·

Man... I was going through my postings and forgot about this...Great work guys...I have not got to do too much with it yet..But wow..excellent...Thanks for thinking of me Nix...

nix ·

Talk to oddson, i pick up that he did some work further with this. Hang on, I find his .osm . Anyway, test this one, maybe pitch detection isn't great to midi, but might be workable for a tuner. It's handy in guitar plugs for sure. I remember that it seems to start high before settling down. Cheers man, I have a couple of projects on the go, and want to record a new album, but in future I would like to help out graphic wise. I'll watch your space 🙂 edit: I couldn't find it , but maybe talk to oddson if you like if you need greater accuracy. All success

oddson ·

I was working on a tuner but the problem I had was that the fundamental on the bass notes isn't the strongest component.

I was trying to make a tuner that guessed which string you were playing by assuming it was the lowest string possible for the pitch you were playing and that note was not more than a whole tone sharp. But it guesses wrong for bass notes because the largest frequency peak isn't the fundamental.

I tried to filter the signal and to come up with a way to identify the first 'obvious' peak but didn't succeed.

So the next obvious step was to abandon the 'guess' part and have the user select which string he's tuning. Then limit the section of the array being considered for a max to roughly half an octave above the expected note... but I haven't done it yet.

Here's the file:

McBarGig ·

Thanks Guys...Oddson I'll check this out this week as soon as I can get out of Shredsville..🙂

Nix...Graphics...sure, the help would be appreciated, thanks..

oddson ·

If someone wants to take on the UI I'll be happy to help sort out the FFT stuff.

loopeytunes ·

@Oddson - I'll have a go at the UI if that's ok 😀

LT

martinvicanek ·

Here is a chromatic tuner based on a pitch tracker that I posted in another thread earlier. It is a bit of an overkill in terms of CPU load, however it was an obvious thing to do once I had this pitch tracker ready. The device will recognize the fundamental of a monophonic input sound and display its frequency in Hz, the closest note as well as the offset in cents.

P.s. I'd like to thank Oddson and Trog for the Note to Name converter. Comes in handy!

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.