Yes, I think that the best thing is to share some audio, here it is
In the one I’m sharing now, if you do the following
(
~b = Buffer.read(s, …);
(
{ var freq, hasFreq, sig = PlayBuf.ar(1, ~b, loop:1);
#freq, hasFreq = Tartini.kr(sig,n: 2048, k: 2048/2, overlap: 1024) ;
freq.poll(label:\freq);
hasFreq.poll(label:\HASFREQ);
Out.ar(0, sig!2);
}.play
))
you see that, as the sound of the trombone is higher in amplitude than the rest, Tartini is able to pitch-track it and in fact hasFreq argument tends towards 1 (full confidence), while Pitch.kr seems to say "yes I found the fundamental–> 1, no I don’t find any fundamental -->0, and no values in between.
My need would be to real time track the whole soundscape, and, when I find some periodic/pseudo periodic/almost periodic content, I save it and provide a dedicated elaboration to it, for the situation is actually that I’m building a sonic ecosystem, using the soundscape as the primary sound source. But the more I’m asking for help the more I realize, as I already said, that there’s something not working in the logic of this pitch extraction process. Because, in this case it is quite easy, as the trombone eats the rest of the scape, but what if wasn’t that loud…?
I should be prepared to recognise the periodicity (pseudo/almost…) in case it happens. For example, if I run some FFT based Ugens to see how the energy is spectrally distributed, I could know if, when end where there’s more energy, and do my things with that informations. The thing here is exactly what you said, to find some descriptors that fits the entire soundscape and possibly differentiate them in order to apply further, dedicated processing. So I guess one approach would simply be : be prepared to recognise periodic sounds if they appear, and they could appear -at the ears of the computer- when some conditions are presents -they are simply louder, the mics position…-, or another approach could be : continuously analyze the spectrum trying to clean it from anything that is not periodic -so, from the more noise quantity possible, so, build a, let’s call it, noise-mask - and when a periodic sound appear it can be isolated through this analysis, the computer sees it and I can elaborate it. I think there we are talking about this second possibility, as I’m able to do the first one, and refine it.
How do you see it?
Thanks for your patience
Leo