hi there, i stumbled across this pitch detection algorithm that is especially made for mcu's, it seems to perform quite well and is light on cpu. the library is available here:
https://www.cycfi.com/2018/04/fast-and-efficient-pitch-detection-bliss/ (there is a github link in that article)
this would be perfect for the axoloti. could somebody a little more code savy have a look? @johannes @thetechnobear @SmashedTransistors or anybody else up for the task. i am a bit overwhelmed by the code at the moment, but i only had a quick glance.
Pitch detection on axoloti
I think @SirSickSik has a pitch detector. Not the same I think, i have not looked into it, though.
Reviving this thread...
This looks awesome.
I also wonder if this could be ported to Axoloti.
If so, what would be needed?
Fast and accurate pitch detection would be so great!!
It was announced the code might disappear but there was a pull here:
I've read the pitch detection library will stay open, but the onset detection algorithm will not be released as open source.
Any thoughts appreciated!
Brilliant, it works quite well!! (I only tested briefly with the example, but latency seems to be very decent.)
Thanks so much for this... Will further experiment with voice as a source
Have you seen this:
(Apparently one of your students posted it)
I once implemented the gr-300 pitch tracker in PureData and it deals with attack noise (non periodic noise) in a very musical way. The output waveform of the gr-300 is a sawtooth wave and it's amplitude is changing with frequency, attack noise simply becomes very quiet (low pitched notes are much louder then high notes)
yes, it helps a lot especially on guitar. the circuit is not so complex and since they only had to track 17 or 19 frets (not even two octaves) it works very well.
maybe i will try to implement this pv "algo" in axoloti, the one i did in PD works very well, with no latency (since the output is directly generated from the input) and it sounds remarkably close to all those 70-80' pitch to cv trackers. here is an example (one side vocal input, other side synth output):
https://soundcloud.com/simon-iten-294936446/voxtosynthbela (it is done on bela, running a PD patch)
ok, @SmashedTransistors, here is my simple gr-300 approach in axolotiland.
i only did a simple pitch to "midi" conversion, not a model of the gr-300. but i took the conversion straight from the gr-300 schematic. look in the p to v object, it is a very simple approach. basically i fill a capacitor (a simple counter in axoloti) with a voltage and reset the circuit when a zero crossing occurs. this creates a sawtooth wave with an amplitude that is dependant on the input frequency. i then simply measure that amplitude before i reset the phase (the counter) and do a conversion to create "midi" notes from it.
it is crude, and not totally accurate but very fast and reactive. if you have time to look at the (quite bad) code maybe you can improve its accuracy or the frequency conversion part (from hertz to midi) that part actually eats up almost 15% CPU since its done in floats and uses log etc.
i tried the axoloti log object code, but it is not accurate enough for this.
the adaptive filtering seems to work pretty good, at least i get no octave jumps with my voice.
the p to v module outputs garbage if no periodic signal is input, hence the env-follower on the input to mute it.
maybe we could combine the responsiveness of this approach with the accuracy of yours
thanks, for getting me back into this...
gr-300WIP.axp (6.6 KB)
Thanks, for now this is above my head, but I will try to make some sense of this and have a nice holiday
haha, i looked briefly at your code. at first glance yours seems like a piece of art while i put together a pile of dirt i am amazed at how well my attempt performs though i should really learn to code more properly. it is great to have you on board the axoloti-train @SmashedTransistors
here is a newer version. i got rid of the expensive calculations and also implemented linear interpolation (i think). the CPU usage is now at 3% for the pitch-detector, at about the same precision i had in my first attempt. definitely look at this example rather then the first one @SmashedTransistors
gr-300WIP5.axp (8.7 KB)
Great! Thanks a lot!! Will start experimenting with this.
I also found this link:
https://www.youtube.com/watch?v=3mZXF1GCrcU
In the comment section he hints at quantizing the notes with a lookup table
and also separating the onset and actual pitch readout with a delay for improved accuracy.
Going to try some things out.
Thanks again, this is really great!
Sure, that is a method. It is actually not that hard to quantize the notes i would guess. But I rather have all pitch information as accurately as possible, and with axoloti I am not restricted to midi. I use this with a voice input, so for guitar you might need a hex pickup...or very clean monophonic playing. But I would still expect octave jumps, with just one pickup.
well, with a voice input your test patch (even with a butterworth filter at 1.4k) does not work very well. the detected pitch is very glitchy. the WIP-5 version i posted does perform MUCH better, but of course it is a more naive approach with no noise vs pitch detection etc.
Maybe post your dev objects as patches instead of on GitHub? The thread here looks and reads a bit funny without all your stuff... @SmashedTransistors
What’s happening here? It’s a very interesting topic but I can’t seem to property follow the thread, is there something missing?
I’ve been investigating cycfi‘s algorithm quite a bit based on their articles in the past. I wrote the tuner algorithm in the soundbrenner core based on that.
I‘d love to see Joel’s bitstream autocorrelation running on axoloti. I looked at bringing parts of the q library to axoloti, but ran into a roadblock, if I remember correctly, because it is written in C++14 and Axoloti cannot compile that (correct me if I’m wrong).
Recently I’ve been thinking that maybe there is a way to manually downgrade some of the relevant parts of the code though. Would anybody also be up for investigating this further?
yeah, @SmashedTransistors decided to remove some dev objects from his library because he fears he will not be able to delete them later on due to GitHub login changes (at least that is what i gather from another thread)
why he choose to delete all his related posts is beyond me tbh. as i wrote it makes the thread look very funny and i guess not very well understandable.
as for your question about the q library. sure would be very nice to have something like this on axoloti. i am very happy with the patch i posted above (WIP-5), although it is a very naive approach it works nicely for my voice and tracks the pitch in a very musical way. so i am happy for now