• ### Extracting partial information

Hi,

I'd like to be able to isolate harmonic partials based on incoming pitch data from sigmund~

e.g.

[mtof]
|
v
[expr \$f1;
2 * \$f1;
3 * \$f1;
4 * \$f1;
5 * \$f1;
6 * \$f1;
7 * \$f1;]

I hacked the following patch so that I could manipulate the table data, but it is a bit clumsy: http://www.pd-tutorial.com/english/patches/3-8-2-1-fft-filter.pd

Is it best to use rfft~ or bp~? Any advice or examples would be greatly appreciated.

Best wishes,

Ricky

• Posts 12 | Views 11216
• If all you want is that one frequency, why not just use the data from [sigmund~] to run [osc~]s at those partials?

• I want to use the initial audio source. Perhaps I don't understand what you mean by using osc~?

[sigmund~]
|
v
[mtof]
|__
|
v
[osc~]

?

Ricky

• I was actually thinking of using [sigmund~] in peaks mode and routing the frequency and amplitude data of the partials to [osc~]. But looking at it now, I see that it orders them in amplitude, not harmonic number, so it might be difficult to get the specific harmonic you're after. And I don't really know how to get the correct phase from that, either.

I know that [bp~] and [vcf~] can ring a bit if you try to narrow the Q too much, so they're not ideal for extracting a single frequency from a complex signal.

FFT has its own complications. The frequencies of each bin in the analysis frame range from 0 to the samplerate, and they are evenly spaced at a distance of SR/blocksize. In other words, if your block size (which is also the number of bins) is 512 and sample rate is 44100Hz, then you have a bin for frequencies 0, 86.13, 172.27, etc. That's fine if you want a frequency that falls right on one bin; you can just resynthesize that bin. But if it falls between two bins, then it actually gets represented across several bins. I don't really know how to determine which bins should be used to resynthesize one frequency. I'm sure it can be done, though (I believe Spear does it).

After writing all that, I'm still kind of leaning toward [sigmund~].

• I've tried FFT and [bp~] and I have encountered the same problems. [bp~] actually came out on top! I'm intrigued by your idea of using [sigmund~] in peaks mode, but must confess I do not have experience using it in such a way. Would you mind demonstrating?

What about [fiddle~]? Or is [sigmund~] more appropriate?

edit: Here's what I have developed using [bp~] so far. I haven't decided how to attenuate a partial just yet. I'm thinking of simply building all the possible configurations, unless there is an easier way to do it. Although, I'm not sure that the Q parameter is cutting it when using [bp~]. Let me know what you think of the patch! Any feedback is most welcome.

Also of interest: http://williambrent.conflations.com/mov/pitchHeight.mov

http://www.pdpatchrepo.info/hurleur/ricky_bp_partial_filter.pd

• I've uploaded what I have built using [bp~] for your scrutiny

• How it should work:

• After looking at this (and your videos) and thinking about it more, I'm not so into using [sigmund~] anymore. Because it only works at message rate, I don't think it's well suited for resynthesis. I think it could be done with FFT, but I can't wrap my head around how to do it with live input (I'm not well-versed in FFT anyway), which is what I think you want to do in the end.

But I think you'll be okay with band-pass filters, unless there's something bigger here your trying to achieve that requires strictly sinusoids. I do have some recommendations, though, for how to improve your patch a bit.

First, I think you should switch to [vcf~]. You can control the center frequency at audio rate, and if you intend on doing any bends, you'll likely want that.

To go along with that, I don't think it's necessary to use _out of [sigmund~]. (In fact, the way you have it now, if your guitar is slightly flat, it will truncate to the half-step below. It should actually be [+ .5]->_if you're looking to "autotune.") Doing that kills some important guitar idiosyncrasies, like bends and vibrato. You might be better off instead using the non-integer MIDI note like this:

[sigmund~]
|
[mtof]
|
[vline~]
|
[lop~ 4]
| [r partial.number]
| /
[*~ ]
\
\
[vcf~]

Obviously you'd rework that a bit to fit in your patch, but I think you get the idea.

To pull frequencies out instead of isolate them, you'll want a notch filter. This is just a reverse band-pass filter, really, so you could make one like this:

[inlet~]
| \
| [vcf~]
| |
[-~ ]
|

Also keep in mind that [sigmund~]'s output is delayed by the hop size, so you should delay the copy of the input signal going into the filters by that amount if you want the filters to line up perfectly with the notes. Well, it won't be perfectly, but "closer to perfectly."

One last thing, instruments like guitars have noisy attacks, which can result in initial erratic pitches coming out of pitch trackers. There are two things that can help with this. One is to low-pass filter the signal going into [sigmund~] to keep the output from being to high (Some pitch trackers actually work better if you get rid of some unnecessary high-frequency content. Not sure about [sigmund~], though). The other thing is to get a running median of the output of [sigmund~]. This essentially has the effect of throwing out any outliers. You can use [median_n] from mapping to do this. You may find you'll need to delay the signal a bit more for this to be accurate, though. Probably by hopsize*median_n arg/2.

Hope that helps.__

• Mike, thanks so much for all of this information. It is indeed a great help. I'll be sure to implement your ideas, and stick with band pass for now. I'll maybe revisit FFT later down the line if I want to work with specific sinusoid.

Best wishes,

Ricky

• O.K. - Here's the latest using [vcf~]. Thanks to Mike for all his help!

Using [vcf~] instead of [bp~] to extract partials to be reconstructed as harmonic series for manipulation and exploration into the concept of pitch space. This system does not deal with individual sinusoids, but approximate frequency bands with narrow "Q" at specified multiples of a fundamental frequency.

[vcf~] is like [bp~] except it takes an audio signal to set center frequency, which may thus change continuously in time. The "Q" or filter sharpness is still only set by messages. More expensive than bp~ in CPU time but more powerful too (vcf~ help file, Pd-ext).

Any partial (fundamental and multiples) may be selected within the constructed series. Each partial may be placed in any desired order. Each partial may be accentuated or attenuated in amplitude by the user.

[sigmund~] tracks the pitch of a selected string or all strings in sequence. One instance of [sigmund~] does not accommodate chordal (simultaneous) structures in real-time. This is not a concern as this system is developed primarily for the study of sequential pitch structures. Once a fundamental frequency is established, [vcf~] superimposes the relevant "Q"s to achieve the fundamentals harmonic series. The user may superimpose the "Q"s of unrelated harmonic series over another tone, to explore inharmonic content, or simply to achieve more percussive tones (as demonstrated toward the end of the video). By accentuating different harmonic and inharmonic content, we may establish macro and micro music structures on each string in relation to a fundamental frequency.

In this instance, notes which coincide with the set harmonic series will be perceived as more resonant. For example, the "A" note played on the second string (chc. 2) is perceived as more resonant as the channel has a "Q' of 220hz. Any perceived ringing is a result of a narrow "Q", which the user will be able to adjust to suit their performance style.

• And something more fun with the grain engine for each partial (still at an early stage):

• Hi,
Iām looking towards a similar patch for processing guitar (mainly). I see you did various works on processing guitars, very nice!
I see the objects listed above are just for a single note, right? What about extracting partials from a polyphonic input?
Thanks š

Posts 12 | Views 11216
Internal error.

Oops! Looks like something went wrong!