## pitch detector

Scope and XITE Development

Original topic on PlanetZ: https://forums.scopeusers.com/viewtopic.php?t=2405

####

Posted: Sun Jul 08, 2001 11:03 am
by alfonso
hello everybody,
i'm not a scope developer, just a pulsarian, but i post here to ask if anyone thougt to make a module for the modular that detects pitch of an incoming signal (of course monophonic) and outputs a freq. mvc type signal to drive pitch of the oscillator...
could anybody tell me the specs of mvc freq. out? what kind of values are output to the osc.?
i tried to drive directly with a guitar a modular osc and it sounds, but acting mostly like a weird filter.....but it must be possible to do something else.
i hope i didn't bother you
cheers, alfonso

####

Posted: Wed Jul 11, 2001 4:12 pm
by alfonso
i've done it!
not the pitch detector, but a true modular to be driven by guitar or vocals or....
very soon on cw site and planetz.
just to close the thread a little O.T.
cheers, alfonso.

####

Posted: Tue Aug 07, 2001 10:16 pm
by Neutron
We have everything we need to make a pich detector except for a critical component which is a frequency to "voltage" (control level) converter this is not to hard to make with analog components but probably quite difficult with DSP.
one way similar to analog pitch detector circuit would be an atom that sends out a fixed length pulse every zero crossing, and another one to count how many pulses there were per second (adjustable time period - accuracy vs speed) and output a "voltage"
you would need other circuitry to pre process the input, but thats all there allready.

####

Posted: Tue Aug 07, 2001 10:45 pm
by Peezahj
Isn't that basically what the Obsidian Tuner is doing (which has quite a lag, btw, which may be the fault of the method rather than the designer)?

####

Posted: Wed Aug 08, 2001 10:41 am
by Neutron
I have not seen this device.

####

Posted: Fri Aug 10, 2001 7:53 am
by claes
it's just to count the samples since the last positive zero crossing every time a positive zero crossing occurs..
it shouldn't need more than a couple of rows of assembly to do it.

####

Posted: Thu Aug 16, 2001 9:36 pm
by stecki
<<<Just determine the zero-crossings ??
believe me, it´s not so easy ! There is a bit
more to do !
Greets

####

Posted: Sat Aug 18, 2001 11:08 am
by claes
you're probably right. it would leave quite an ugly output, and quite sensitive to how the input spectrum look's like.
the point that i was trying to make was, that it's probably better to think in code than atoms when it comes to building such a device.
cheers,
claes

####

Posted: Sun Aug 19, 2001 9:41 am
by stecki
The problem is that a zero crossing for detecting the frequency would only work for a sinewave ! but if you try to determe the frequency of a squarewave(which includes almost all frequencies), it can´t be done with zero crossings ! And music also doesn´t exist only of sine-waves !

####

Posted: Thu Aug 30, 2001 6:34 am
by claes
afaik a square wave only has two zero-crossings per cycle. and if you only trigger on positive ones that will leave one to trigger each cycle.
i don't understand why it should be more than one positive zero crossing, perhaps you could explain?
The only reason I can think of why it wouldn't work is if the base frequency is too low in amplitude so it gets overridden by it's formants, causing it to trigger more often. and you could solve this by putting filters in front of it.

####

Posted: Fri Aug 31, 2001 6:17 am
by jupiter8
I do agree BUT... at which frequency should you start filter? Too low and the high notes don't get detected, too low and you still have the same problem.
I don't like to be negative but i doubt that you can solve the pitch detector problem with "a few lines of assembler". I think the issue is a little more complex then that even though i agree with your theory.

####

Posted: Sat Sep 01, 2001 1:25 am
by claes
with "needing jut a few rows of assembler" I was just refering to the part of the circuit defex was describing an atom based solution to(count zerocrosssings and output frequency). the rest of the circuit would be easier to do with standard atoms.
The tricky part of pitch detection as I see it is probably to pre-filter the signal in an effective matter. Perhaps a lo-cut filter set really low just to remove rumble and then a 6 or 12 dB/oct lowpass filter just to ensure that the base frequency is dominant. this filter could be set to the same low frequency as the lo-cut, since dynamic range shouldn't be a problem since the signal shouldn't be used as an audio signal anyway. the pitch detection algorithm doesn't care how quiet it is, it just cares about zero crossings and with a 32-bit dynamic range the lowpass filtering hopefully wont kill the signal too much (not a 6db/osct at least).
the frequency of these filters could be user controllable to be able to adjust it for the in signal. (still sharing the same frequency is probably as good idea for ease of use)
the signal could also be postfiltered with a simple lowpass to smooth it out a little.
a probably good idea would also be to implement an optional hold function that holds the pitch whenever the gate signal is off as you can release notes even if the source signal doesn't have any long release.
Of course, I haven't tried it since I don't have DP and there are probably further issues that you notice when you actually try it. Perhaps I'll try it in a vst plugin later. This is also just the pitch detection, to play something with an insignal you have to gate it in a smart manner which is probably quite more tricky than the pitch detection if you want a satisfying result.

####

Posted: Sat Sep 01, 2001 12:15 pm
by Neutron
Pre filtering is (on some analog pitch detectors) an adjustable low pass filter to get rid of harmonics, and then the wave is over amplified to a square wave so the zero crossing detector can work better. that part may not be neccesary ona DSP based one because the circuit does not have hysterisis(sp?)

####

Posted: Sun Oct 21, 2001 5:22 am
by yade
If it would work to count zerocrossings, what about crushing it to 1 bit?

####

Posted: Sun Oct 21, 2001 11:15 am
by claes
It would work counting the time between two zero crossing of the same polarity. This would give the period time, which is the inverse of the frequency.
I've played around with this a little and here is a vst-plugin that works by that principle.
http://www.vember.net/vstplugins/treemonster.dll
note that it doesn't have any prefiltering built in. It is actually intended for fx.
You could also count zero crossings during a specific time like you mentioned (f.ex. one second) and there directly get the frequency. But reducing the resolution to one bit isn't enough. you have to be able to detect the switch from -1 to 1 and be able to add it to a variable. I don't think this is possible without coding your own atoms and i don't have dp but you could try.
If youre really anal you can use a reciproc method to get better measurements, but thats not really needed in pitch detection and counting period time is still the fastest way.
Ive contacted creamware about obtaing /dp and they wanted to see something ive done before and wonder what i intend to bring to the platform. I sent som stuff to them but i haven't got any reply yet. If you're lucky, they like it and let me have dp so i can bring you some fresh new atoms for pitch-detection..

####

Posted: Fri Mar 29, 2002 1:10 pm
by Nick
Myself, I would *kill* for a audio-to-midi device in Pulsar. I play the violin and so far the only devices that can track pitch in real time are the Zeta Synthony (~1300$USD) (in conjunction with the Zeta electric MIDI violin (1000+$USD) and Max/MSP, which is 300$, but runs on Mac. And I have a PC. Actually, MSP can actually detect different attacks and stuff.
Anyhow, to make a irrelevent story short, has anybody actually made any progress on this sort of device for pulsar? (modv2?)

####

Posted: Fri Mar 29, 2002 4:35 pm
by subhuman
Nick, if you're serious, don't wait, get the Zeta. My girlfriend's father has one and it's simply awesome. If such a device was created I can't imagine it would be free or too cheap.
My studiomate has an electric guitar hooked up to a Yamaha G50 Guitar to Midi Converter, and it tracks pretty well, almost usable, especially in the higher frequency range. The G50 was over $600 used and still sells new for about that much... In the end it doesn't really give as much expression through midi as the instrument alone does. Perhaps tryin recording the Violin and running it through some wacked out effects instead... this actually sounds pretty awesome on violin, and isn't anywhere near as popular as on guitar!

####

Posted: Fri Apr 05, 2002 12:10 pm
by Neutron
I think detecting the top of a cycle is easier than trying to extract a frequency from zero crossing. there is too much going on down there.
That way the filtering does not have to be so fancy, basically it just has to make sure the fundimental is the loudest partial in the waveform. It can probably be done with what we have.
When peak value is detected output a "1" signal which increments a counter. (gotta be sync though. can a sync counter be made with current atoms?)
once a certain time has gone by, sample the value and reset the counter.

####

Posted: Fri Apr 05, 2002 5:44 pm
by j9k
you should look at what the decimator i just posted in the devices area does to wave forms. it samples the peaks and valleys at the up down transition.
see ya