[Csnd] Autocorrelation for pitch tracking in Csound?
| Date | 2026-02-02 16:00 |
| From | Iain Duncan |
| Subject | [Csnd] Autocorrelation for pitch tracking in Csound? |
My PhD supervisor (George Tzanetakis) suggested autocorrelation as likely being the best pitch tracking algorithm for my purposes, and I'm curious if anyone has done this in Csound (or if in fact, this is what the ptrack opcode does!).
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
thanks! iain |
| Date | 2026-02-02 16:19 |
| From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
|
There are several pitch trackers,
pitch - spectral analysis based (same used with wsig opcodes)
pitchtrack - also spectral tracking but more standard
pvspitch - pvs based
plltrack - phase locked loop based
pitchamdf - average magnitude difference method
lpcanal - pitch tracking via lpc
If you want to try autocorretion, there is autocorr
Prof. Victor Lazzarini
Maynooth University
Ireland
On 2 Feb 2026, at 16:00, Iain Duncan <iainduncanlists@gmail.com> wrote:
The information contained in this email may be confidential and privileged. It is intended only for the addressee(s) stated above. If you are not an addressee any use, dissemination, distribution, publication or copying of the information contained in this email is strictly prohibited. If you have received this email in error, please immediately notify us by email at dataprotection@mu.ie and delete this email from your system. Please note that Maynooth University is subject to Freedom of Information and Data Protection laws. We may be required to disclose the content of emails under the FOI Act 2014, the Data Protection Act 2018 or GDPR. Is don seolaí / do na seolaithe thuasluaite amháin an ríomhphost seo. D’fhéadfadh an t-eolas atá ann a bheith rúnda agus faoi phribhléid. Mura seolaí tú, tá cosc iomlán ar aon eolas atá sa ríomhphost seo a úsáid, a scaipeadh, a dháileadh, a fhoilsiú nó a chóipeáil. Má fuair tú an ríomhphost seo trí thimpiste, cuir sin in iúl dúinn láithreach trí ríomhphost a chur chuig dataprotection@mu.ie agus scrios an ríomhphost seo ó do chóras. Tabhair faoi deara go bhfuil Ollscoil Mhá Nuad faoi réir dhlíthe um Shaoráil Faisnéise agus um Chosaint Sonraí. D’fhéadfadh ceangal a bheith orainn ábhar ríomhphoist a nochtadh faoin Acht um Shaoráil Faisnéise 2014, faoin Acht um Chosaint Sonraí 2018 nó faoi GDPR. Registered charity number 20037130
|
| Date | 2026-02-02 16:41 |
| From | Iain Duncan |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
Thanks Victor, that's very helpful. lots to dig into! Do you (or anyone else) have a sense of which would work best for real time monophonic tracking? For the documentation team .... if anyone reads this. The new manual, when searching for "pitch tracking" it goes straight to the pitchamdf opcode. It might be better to have that land on the page linked from there, the Sensing and Control page which lists many of them? (In the old manual I couldn't find it anything with search "pitch tracking" so huge improvement!) Well trying this should hold me for the week, ha. :-) iain On Mon, Feb 2, 2026 at 8:19 AM Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote:
|
| Date | 2026-02-02 16:54 |
| From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
|
Hard to know, I've used amdf, pitchtrack, plltrack, and pvstrack before. The problem is always transient response. With the spectral ones the trick is how to trade time vs freq response.
If you'd like to add to this collection, you know we're always happy to take a PR. I suspect there are plenty newer methods out there. The latest addition was plltrack, about ten years ago.
Prof. Victor Lazzarini
Maynooth University
Ireland
On 2 Feb 2026, at 16:41, Iain Duncan <iainduncanlists@gmail.com> wrote:
The information contained in this email may be confidential and privileged. It is intended only for the addressee(s) stated above. If you are not an addressee any use, dissemination, distribution, publication or copying of the information contained in this email is strictly prohibited. If you have received this email in error, please immediately notify us by email at dataprotection@mu.ie and delete this email from your system. Please note that Maynooth University is subject to Freedom of Information and Data Protection laws. We may be required to disclose the content of emails under the FOI Act 2014, the Data Protection Act 2018 or GDPR. Is don seolaí / do na seolaithe thuasluaite amháin an ríomhphost seo. D’fhéadfadh an t-eolas atá ann a bheith rúnda agus faoi phribhléid. Mura seolaí tú, tá cosc iomlán ar aon eolas atá sa ríomhphost seo a úsáid, a scaipeadh, a dháileadh, a fhoilsiú nó a chóipeáil. Má fuair tú an ríomhphost seo trí thimpiste, cuir sin in iúl dúinn láithreach trí ríomhphost a chur chuig dataprotection@mu.ie agus scrios an ríomhphost seo ó do chóras. Tabhair faoi deara go bhfuil Ollscoil Mhá Nuad faoi réir dhlíthe um Shaoráil Faisnéise agus um Chosaint Sonraí. D’fhéadfadh ceangal a bheith orainn ábhar ríomhphoist a nochtadh faoin Acht um Shaoráil Faisnéise 2014, faoin Acht um Chosaint Sonraí 2018 nó faoi GDPR. Registered charity number 20037130
|
| Date | 2026-02-02 16:59 |
| From | Iain Duncan |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
Thanks Victor, I'll talk to George about this and go over these with him. I'm sure he'd be supportive of me doing so if there is something he has that is worth adding. I like the idea of doing this csound as it makes it simple to the tracker in a standalone process that might have different buffer settings and so one from the main music producing work. On Mon, Feb 2, 2026 at 8:54 AM Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote:
|
| Date | 2026-02-02 17:28 |
| From | vlz |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
| Also, Oeyvind should have lots of experience with these things, he would have something to say. Prof. Victor Lazzarini Maynooth University Ireland On 2 Feb 2026, at 16:54, Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote:
|
| Date | 2026-02-02 17:30 |
| From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
|
Things like the yin method. We don't have that.
It's one to target.
Prof. Victor Lazzarini
Maynooth University
Ireland
On 2 Feb 2026, at 16:59, Iain Duncan <iainduncanlists@gmail.com> wrote:
The information contained in this email may be confidential and privileged. It is intended only for the addressee(s) stated above. If you are not an addressee any use, dissemination, distribution, publication or copying of the information contained in this email is strictly prohibited. If you have received this email in error, please immediately notify us by email at dataprotection@mu.ie and delete this email from your system. Please note that Maynooth University is subject to Freedom of Information and Data Protection laws. We may be required to disclose the content of emails under the FOI Act 2014, the Data Protection Act 2018 or GDPR. Is don seolaí / do na seolaithe thuasluaite amháin an ríomhphost seo. D’fhéadfadh an t-eolas atá ann a bheith rúnda agus faoi phribhléid. Mura seolaí tú, tá cosc iomlán ar aon eolas atá sa ríomhphost seo a úsáid, a scaipeadh, a dháileadh, a fhoilsiú nó a chóipeáil. Má fuair tú an ríomhphost seo trí thimpiste, cuir sin in iúl dúinn láithreach trí ríomhphost a chur chuig dataprotection@mu.ie agus scrios an ríomhphost seo ó do chóras. Tabhair faoi deara go bhfuil Ollscoil Mhá Nuad faoi réir dhlíthe um Shaoráil Faisnéise agus um Chosaint Sonraí. D’fhéadfadh ceangal a bheith orainn ábhar ríomhphoist a nochtadh faoin Acht um Shaoráil Faisnéise 2014, faoin Acht um Chosaint Sonraí 2018 nó faoi GDPR. Registered charity number 20037130
|
| Date | 2026-02-02 17:51 |
| From | Iain Duncan |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
It just so happens that I owe some MIR work to wrap up a course reaquirement, and implementing Yin and autocorrelation were discussed as options! Doing those as Csound opcodes would be great. :-) iain On Mon, Feb 2, 2026 at 9:30 AM Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote:
|
| Date | 2026-02-02 18:03 |
| From | Steven Yi |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
| Attachments | Yin.csd |
Ed Costello posted a Yin pitch tracking example on Feb 27, 2012 (I couldn't find it in an online archive but have it in my email archive). I've attached the CSD he posted here. On Mon, Feb 2, 2026 at 12:30 PM Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote:
|
| Date | 2026-02-02 20:50 |
| From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
|
maybe it's worth converting into a binary opcode.
Prof. Victor Lazzarini
Maynooth University
Ireland
On 2 Feb 2026, at 18:04, Steven Yi <stevenyi@gmail.com> wrote:
The information contained in this email may be confidential and privileged. It is intended only for the addressee(s) stated above. If you are not an addressee any use, dissemination, distribution, publication or copying of the information contained in this email is strictly prohibited. If you have received this email in error, please immediately notify us by email at dataprotection@mu.ie and delete this email from your system. Please note that Maynooth University is subject to Freedom of Information and Data Protection laws. We may be required to disclose the content of emails under the FOI Act 2014, the Data Protection Act 2018 or GDPR. Is don seolaí / do na seolaithe thuasluaite amháin an ríomhphost seo. D’fhéadfadh an t-eolas atá ann a bheith rúnda agus faoi phribhléid. Mura seolaí tú, tá cosc iomlán ar aon eolas atá sa ríomhphost seo a úsáid, a scaipeadh, a dháileadh, a fhoilsiú nó a chóipeáil. Má fuair tú an ríomhphost seo trí thimpiste, cuir sin in iúl dúinn láithreach trí ríomhphost a chur chuig dataprotection@mu.ie agus scrios an ríomhphost seo ó do chóras. Tabhair faoi deara go bhfuil Ollscoil Mhá Nuad faoi réir dhlíthe um Shaoráil Faisnéise agus um Chosaint Sonraí. D’fhéadfadh ceangal a bheith orainn ábhar ríomhphoist a nochtadh faoin Acht um Shaoráil Faisnéise 2014, faoin Acht um Chosaint Sonraí 2018 nó faoi GDPR. Registered charity number 20037130
|
| Date | 2026-02-02 20:55 |
| From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
|
Btw, there's autocorrelation support in the module API,
csound->AutoCorrelation()
and that's what's exposed in the autocorr opcode.
Prof. Victor Lazzarini
Maynooth University
Ireland
On 2 Feb 2026, at 17:52, Iain Duncan <iainduncanlists@gmail.com> wrote:
The information contained in this email may be confidential and privileged. It is intended only for the addressee(s) stated above. If you are not an addressee any use, dissemination, distribution, publication or copying of the information contained in this email is strictly prohibited. If you have received this email in error, please immediately notify us by email at dataprotection@mu.ie and delete this email from your system. Please note that Maynooth University is subject to Freedom of Information and Data Protection laws. We may be required to disclose the content of emails under the FOI Act 2014, the Data Protection Act 2018 or GDPR. Is don seolaí / do na seolaithe thuasluaite amháin an ríomhphost seo. D’fhéadfadh an t-eolas atá ann a bheith rúnda agus faoi phribhléid. Mura seolaí tú, tá cosc iomlán ar aon eolas atá sa ríomhphost seo a úsáid, a scaipeadh, a dháileadh, a fhoilsiú nó a chóipeáil. Má fuair tú an ríomhphost seo trí thimpiste, cuir sin in iúl dúinn láithreach trí ríomhphost a chur chuig dataprotection@mu.ie agus scrios an ríomhphost seo ó do chóras. Tabhair faoi deara go bhfuil Ollscoil Mhá Nuad faoi réir dhlíthe um Shaoráil Faisnéise agus um Chosaint Sonraí. D’fhéadfadh ceangal a bheith orainn ábhar ríomhphoist a nochtadh faoin Acht um Shaoráil Faisnéise 2014, faoin Acht um Chosaint Sonraí 2018 nó faoi GDPR. Registered charity number 20037130
|
| Date | 2026-02-02 21:00 |
| From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
|
Another thing, I think the pitch tracker in lpc is basically autocorrelation, but I can't tell fully without looking at the code to remind myself.
Prof. Victor Lazzarini
Maynooth University
Ireland
On 2 Feb 2026, at 20:50, Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote:
The information contained in this email may be confidential and privileged. It is intended only for the addressee(s) stated above. If you are not an addressee any use, dissemination, distribution, publication or copying of the information contained in this email is strictly prohibited. If you have received this email in error, please immediately notify us by email at dataprotection@mu.ie and delete this email from your system. Please note that Maynooth University is subject to Freedom of Information and Data Protection laws. We may be required to disclose the content of emails under the FOI Act 2014, the Data Protection Act 2018 or GDPR. Is don seolaí / do na seolaithe thuasluaite amháin an ríomhphost seo. D’fhéadfadh an t-eolas atá ann a bheith rúnda agus faoi phribhléid. Mura seolaí tú, tá cosc iomlán ar aon eolas atá sa ríomhphost seo a úsáid, a scaipeadh, a dháileadh, a fhoilsiú nó a chóipeáil. Má fuair tú an ríomhphost seo trí thimpiste, cuir sin in iúl dúinn láithreach trí ríomhphost a chur chuig dataprotection@mu.ie agus scrios an ríomhphost seo ó do chóras. Tabhair faoi deara go bhfuil Ollscoil Mhá Nuad faoi réir dhlíthe um Shaoráil Faisnéise agus um Chosaint Sonraí. D’fhéadfadh ceangal a bheith orainn ábhar ríomhphoist a nochtadh faoin Acht um Shaoráil Faisnéise 2014, faoin Acht um Chosaint Sonraí 2018 nó faoi GDPR. Registered charity number 20037130
|
| Date | 2026-02-02 21:11 |
| From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
|
It is. Prof. Victor Lazzarini
Maynooth University
Ireland
On 2 Feb 2026, at 21:00, Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote:
The information contained in this email may be confidential and privileged. It is intended only for the addressee(s) stated above. If you are not an addressee any use, dissemination, distribution, publication or copying of the information contained in this email is strictly prohibited. If you have received this email in error, please immediately notify us by email at dataprotection@mu.ie and delete this email from your system. Please note that Maynooth University is subject to Freedom of Information and Data Protection laws. We may be required to disclose the content of emails under the FOI Act 2014, the Data Protection Act 2018 or GDPR. Is don seolaí / do na seolaithe thuasluaite amháin an ríomhphost seo. D’fhéadfadh an t-eolas atá ann a bheith rúnda agus faoi phribhléid. Mura seolaí tú, tá cosc iomlán ar aon eolas atá sa ríomhphost seo a úsáid, a scaipeadh, a dháileadh, a fhoilsiú nó a chóipeáil. Má fuair tú an ríomhphost seo trí thimpiste, cuir sin in iúl dúinn láithreach trí ríomhphost a chur chuig dataprotection@mu.ie agus scrios an ríomhphost seo ó do chóras. Tabhair faoi deara go bhfuil Ollscoil Mhá Nuad faoi réir dhlíthe um Shaoráil Faisnéise agus um Chosaint Sonraí. D’fhéadfadh ceangal a bheith orainn ábhar ríomhphoist a nochtadh faoin Acht um Shaoráil Faisnéise 2014, faoin Acht um Chosaint Sonraí 2018 nó faoi GDPR. Registered charity number 20037130
|
| Date | 2026-02-02 22:58 |
| From | Iain Duncan |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
Thanks so much for all the help! iain On Mon, Feb 2, 2026 at 1:11 PM Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote:
|
| Date | 2026-02-05 14:31 |
| From | Oeyvind Brandtsegg |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
Sorry to be late to the party. Here's yet another pitch tracking method. I was made aware of this method when supervising Daniel Formo's PhD some years ago, as he was analyzing a large number of speech recordings. The theory is that the glottal pulses are indeed pulses (which contains "all" frequencies), then we lowpass at a very low frequency and just count the zero crossings. It should in theory work only for voice, but I find that it oftentimes work very well for any sound. Here's a UDO ; epoch filtering udo opcode EpochCps, k,a a1 xin setksmps 8 a20 butterbp a1, 20, 5 a20 dcblock2 a20*40 aepochSig butlp a20, 200 kepochSig downsamp aepochSig kepochRms rms aepochSig ; count epoch zero crossings ktime times kZC trigger kepochSig, 0, 0 ; zero cross kprevZCtim init 0 kinterval1 init 0 kinterval2 init 0 kinterval3 init 0 kinterval4 init 0 if kZC > 0 then kZCtim = ktime ; get time between zero crossings kinterval4 = kinterval3 kinterval3 = kinterval2 kinterval2 = kinterval1 kinterval1 = kZCtim-kprevZCtim kprevZCtim = kZCtim endif kmax max kinterval1, kinterval2, kinterval3, kinterval4 kmin min kinterval1, kinterval2, kinterval3, kinterval4 kZCmedi = (kinterval1+kinterval2+kinterval3+kinterval4-kmax-kmin)/2 kepochZCcps divz 1, kZCmedi, 1 kepochZCcps mediank kepochZCcps, 40, 40 xout kepochZCcps endop Usage: kcps EpochCps a1 all best Øyvind man. 2. feb. 2026 kl. 22:11 skrev Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie>:
|
| Date | 2026-02-05 15:14 |
| From | "Dr. Richard Boulanger" |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
| Thanks for sharing Dr. Richard Boulanger Professor Electronic Production and Design Berklee College of Music On Feb 5, 2026, at 9:38 AM, Oeyvind Brandtsegg <obrandts@gmail.com> wrote:
|
| Date | 2026-02-05 15:14 |
| From | "Dr. Richard Boulanger" |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] Autocorrelation for pitch tracking in Csound? |
| Thanks for sharing. Dr. Richard Boulanger Professor Electronic Production and Design Berklee College of Music On Feb 2, 2026, at 1:04 PM, Steven Yi <stevenyi@gmail.com> wrote:
|