# Detecting fundamental pitch and partials

**URL:** <https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451>\
**Category:** Usage Questions\
**Created:** [May 21, 2022, 3:49pm UTC](https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451 "2022-05-21T15:49:34Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark\_durham](https://discourse.flucoma.org/letter_avatar_proxy/v4/letter/m/779978/32.png) [@mark\_durham](https://discourse.flucoma.org/u/mark_durham)\
**Post date:** [May 21, 2022, 3:49pm UTC](https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451/1 "2022-05-21T15:49:34Z")

</div>

I’m curious to know what options there are in Flucoma for this?

For example, using a note from a piano and being able to list the fundamental frequency and then a list of partials, could be buffer analysis or realtime. I’ve had a good poke around the helpfiles and can’t seem to find an example anywhere.

Thanks

---

<div class="post-metadata">

**Author:** ![tremblap](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tremblap/32/5_2.png) [@tremblap](https://discourse.flucoma.org/u/tremblap)\
**Post date:** [May 22, 2022, 11:41am UTC](https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451/2 "2022-05-22T11:41:29Z")

</div>

Hello!

Welcome! There is at the moment an object to find fundamental of monophonic signal: FluidPitch in real-time, FluidBufPitch for a buffer in non-real-time. They have a lot of various features to help.

To find the various harmonics, one could find the peaks in the spetrum. There is a thread on which I shared a way to do it in SuperCollider and in Max on this forum. I don’t know on which platform you are though.

p

---

<div class="post-metadata">

**Author:** ![mark\_durham](https://discourse.flucoma.org/letter_avatar_proxy/v4/letter/m/779978/32.png) [@mark\_durham](https://discourse.flucoma.org/u/mark_durham)\
**Post date:** [May 22, 2022, 12:45pm UTC](https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451/3 "2022-05-22T12:45:12Z")

</div>

Thanks for the reply.

Sorry, forgot this was cross-platform. I’m working in Max, that would be great if you could share the link.

---

<div class="post-metadata">

**Author:** ![tremblap](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tremblap/32/5_2.png) [@tremblap](https://discourse.flucoma.org/u/tremblap)\
**Post date:** [May 22, 2022, 2:55pm UTC](https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451/4 "2022-05-22T14:55:21Z")

</div>

oh it seems it is nested inside another post. I’ll clean it up and might even do an object eventually as discussed with @tedmoore but for now you can check inside this patch:

> [@Quick NMF toolbox](https://discourse.flucoma.org/t/quick-nmf-toolbox/677):
>
> Hello! I’m sharing a bit of a toolbox I needed to code to use my favourite examples from the helpfiles plus some interpolated additive synthesis from the various nmf decomposition. It was mostly for me, right in the middle of a compositional process where I wanted to be able to resynthesise dirty (noise) and clean (peaks) part of a complex sound, so having a quick way to record/import, mess about with fft and number of components until I was able to choose something I want my ear/poking, then p…

p

---

<div class="post-metadata">

**Author:** ![jan](https://discourse.flucoma.org/letter_avatar_proxy/v4/letter/j/ce7236/32.png) [@jan](https://discourse.flucoma.org/u/jan)\
**Post date:** [May 22, 2022, 3:01pm UTC](https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451/5 "2022-05-22T15:01:01Z")

</div>

hello @tremblap ,  
if there happens to be a version for sc too would be great to check it out!  
thanks,  
jan

---

<div class="post-metadata">

**Author:** ![tedmoore](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tedmoore/32/439_2.png) [@tedmoore](https://discourse.flucoma.org/u/tedmoore)\
**Post date:** [May 23, 2022, 10:44am UTC](https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451/6 "2022-05-23T10:44:15Z")

</div>

Hi @jan,

For a FluidPitch and FluidBufPitch example, check out (also in the helpfiles!):

> <https://github.com/flucoma/flucoma-docs/blob/main/example-code/sc/Pitch.scd>

> <https://github.com/flucoma/flucoma-docs/blob/main/example-code/sc/BufPitch.scd>

Regarding partials, there currently doesn’t exist an object that provides that information directly (the frequency values and what not). [Sines](https://learn.flucoma.org/reference/sines/) does that kind of analysis and then has the resynthesis bundled in.

To get the frequency values and their amplitudes, check out Nick Collins TopNFreqs: [https://composerprogrammer.com/code/TopNFreq.zip](https://composerprogrammer.com/code/TopNFreq.zip)

I use it and think it sounds pretty nice!

---

<div class="post-metadata">

**Author:** ![jan](https://discourse.flucoma.org/letter_avatar_proxy/v4/letter/j/ce7236/32.png) [@jan](https://discourse.flucoma.org/u/jan)\
**Post date:** [May 23, 2022, 12:01pm UTC](https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451/7 "2022-05-23T12:01:09Z")

</div>

Hi @tedmoore, thanks!  
Yes, i was asking specifically for the partials feature. I actually used to use TopNFreq more but will get back to it. Wouldn’t the access to the Sines analysis be a great and helpful additional feature to the object though?  
Greetings,  
Jan

---

<div class="post-metadata">

**Author:** ![tedmoore](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tedmoore/32/439_2.png) [@tedmoore](https://discourse.flucoma.org/u/tedmoore)\
**Post date:** [May 23, 2022, 12:03pm UTC](https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451/8 "2022-05-23T12:03:19Z")

</div>

> [@jan](#):
>
> Wouldn’t the access to the Sines analysis be a great and helpful additional feature to the object though?

Yes! It’ definitely on our radar! I’m guessing you’ve checked out [SPEAR](https://www.klingbeil.com/spear/) as well!? It allows exporting the data into a txt file in a few differently structured formats.

---

<div class="post-metadata">

**Author:** ![jan](https://discourse.flucoma.org/letter_avatar_proxy/v4/letter/j/ce7236/32.png) [@jan](https://discourse.flucoma.org/u/jan)\
**Post date:** [May 23, 2022, 12:05pm UTC](https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451/9 "2022-05-23T12:05:46Z")

</div>

I did, quite a while back though! Vaguely remember it was not too straightforward to export & import the arrays for freqs and amps to SC, but ill give it another shot!

---

<div class="post-metadata">

**Author:** ![mark\_durham](https://discourse.flucoma.org/letter_avatar_proxy/v4/letter/m/779978/32.png) [@mark\_durham](https://discourse.flucoma.org/u/mark_durham)\
**Post date:** [May 23, 2022, 12:24pm UTC](https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451/10 "2022-05-23T12:24:47Z")

</div>

> [@tremblap](#):
>
> check inside this patch

Thanks, that patch helped me a while back on the last project. If I’m understanding - do the NMF separation, then analyse each layer?

For my current use I think NMF may take too long (eg a 3 minute file). Would fluid.pitch~ also need to work on something previously separated by fluid.bufnmf~ ?

> [@jan](#):
>
> Sines analysis

Funny - I was just looking at fluid.sines~ and wondering if I could get list data from the dumpout outlet…

---

<div class="post-metadata">

**Author:** ![tremblap](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tremblap/32/5_2.png) [@tremblap](https://discourse.flucoma.org/u/tremblap)\
**Post date:** [May 23, 2022, 2:03pm UTC](https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451/11 "2022-05-23T14:03:53Z")

</div>

> [@mark\_durham](#):
>
> Funny - I was just looking at fluid.sines~ and wondering if I could get list data from the dumpout outlet…

that is exactly what I plan to do… but for now we are doing some deep changes to the code base to be version 1 ready. Then we’ll see.

in the meantime, pitch post nmf vs pre nmf will give different values, you should try both and see what you like best and what works best witn your musical explorations.

keep us posted with your results

---

<div class="post-metadata">

**Author:** ![spluta](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/spluta/32/21_2.png) [@spluta](https://discourse.flucoma.org/u/spluta)\
**Post date:** [May 23, 2022, 6:05pm UTC](https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451/12 "2022-05-23T18:05:13Z")

</div>

[SpearStuff.zip](https://discourse.flucoma.org/uploads/short-url/62ekWTjain5DBbm3RycclVtwcVM.zip) (3.6 KB)

See the attached class and “help” file. This is a spear analysis parser, with a nice way to look at frames and grab the top frequencies.

Sam

---

<div class="post-metadata">

**Author:** ![jan](https://discourse.flucoma.org/letter_avatar_proxy/v4/letter/j/ce7236/32.png) [@jan](https://discourse.flucoma.org/u/jan)\
**Post date:** [May 23, 2022, 8:41pm UTC](https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451/13 "2022-05-23T20:41:58Z")

</div>

nice, thanks a lot @spluta!

---

<div class="post-metadata">

**Author:** ![jose](https://discourse.flucoma.org/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@jose](https://discourse.flucoma.org/u/jose)\
**Post date:** [May 24, 2022, 4:34pm UTC](https://discourse.flucoma.org/t/detecting-fundamental-pitch-and-partials/1451/14 "2022-05-24T16:34:26Z")

</div>

Hello !  
Funny, I’m also looking for a real time spectral peaks analyser. For a long time I’ve been using iana~ from the Ircam library ([https://forum.ircam.fr/projects/detail/max-sound-box/](https://forum.ircam.fr/projects/detail/max-sound-box/)), but now that I’ve switched to SuperCollider I’m missing a good real-time analyser! Waiting for the great Flucoma library to integrate it !

Best,

José
