[Csnd] unexpexted pitches
| Date | 2026-03-14 21:47 |
| From | Stefan Thomas |
| Subject | [Csnd] unexpexted pitches |
Hello. I'm wondering why, in the example below, instead of the expected notes, I end up playing a note that's about a fourth too low, and then a minor third too low. What can I do to get the desired pitches in both cases? Here's the code: <CsoundSynthesizer> <CsOptions> -odac </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 1 0dbfs = 1 opcode onepole_allpass, a, ai ain, icoef xin aX1 init 0 aY1 init 0 aout = icoef * (ain - aY1) + aX1 aX1 = ain aY1 = aout xout aout endop instr 1 iFreq mtof p4 iDelay = 1 / iFreq aEnv expon 1, 0.01, 0.0001 aExc rand 0.5 aExc = aExc * aEnv abuf delayr 0.1 aTap deltapi iDelay ; without Allpass I get the correct pitch ;aLoop = aTap ; with Allpass: to low aLoop onepole_allpass aTap, -0.3 delayw aExc + 0.999 * aLoop out aTap * 0.5 endin </CsInstruments> <CsScore> i 1 0 3 69 i 1 + . 69 e </CsScore> </CsoundSynthesizer> |
| Date | 2026-03-14 22:00 |
| From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] unexpexted pitches |
|
you should get the correct pitch just with the interpolated output (deltapi). If you want to use an allpass, then you need a truncated output (deltapn) instead but the allpass coefficient then depends on how much fractional delay you need for a given pitch.
Prof. Victor Lazzarini
Maynooth University
Ireland
On 14 Mar 2026, at 21:47, Stefan Thomas <kontrapunktstefan@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-03-14 22:04 |
| From | "Jeanette C." <000015cdd0ffa6cd-dmarc-request@LISTSERV.HEANET.IE> |
| Subject | Re: [Csnd] unexpexted pitches |
Hi Stefan,
for me it also worked setting the ksmps to 1. You could do that locally. But I
am very sure that Victor's solution is systematically a lot better. Still, it
might serve as a workaround, if you have many other issues to solve with your
code/piece.
Best wishes,
Jeanette
--
* Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
* GitHub: https://github.com/jeanette-c
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 |
| Date | 2026-03-15 08:08 |
| From | Stefan Thomas |
| Subject | Re: [Csnd] unexpexted pitches |
Dear Jeanette, dear Victor, thanks for Your replies. Actually, when I set ksmps to 1, I get (roughly) the right pitch (about 20 cents to low) and the Intervals seem to be slightly out of tune. Unfortunately I didn't understand what to do with the deltapi or deltapn opcode. I don't get the right pitches with the following code: <CsoundSynthesizer> <CsOptions> -odac </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 1 0dbfs = 1 opcode onepole_allpass, a, ai ain, icoef xin aX1 init 0 aY1 init 0 aout = icoef * (ain - aY1) + aX1 aX1 = ain aY1 = aout xout aout endop instr 1 iKey = p4 iFreq mtof iKey iDel = 1 / iFreq ; kurzer Anregungsimpuls aEnv expon 1, 0.01, 0.0001 aExc rand 0.4 aExc = aExc * aEnv abuf delayr 0.1 aTap deltapi iDel aLoop onepole_allpass aTap, -0.3 delayw aExc + 0.999 * aLoop out aTap * 0.5 endin </CsInstruments> <CsScore> i 1 0 3 60 i 1 3 3 64 i 1 6 3 67 i 1 9 3 72 e </CsScore> </CsoundSynthesizer> Am Sa., 14. März 2026 um 23:04 Uhr schrieb Jeanette C. <000015cdd0ffa6cd-dmarc-request@listserv.heanet.ie>: Hi Stefan, |
| Date | 2026-03-15 10:50 |
| From | "Jeanette C." <000015cdd0ffa6cd-dmarc-request@LISTSERV.HEANET.IE> |
| Subject | Re: [Csnd] unexpexted pitches |
Hi Stefan,
I had the same issue with deltapn. A look at the manual helps. Delaytime in
samples. So, set:
iDel = 1 / iFreq * sr
That works very well and it answered one of my own unasked questions. I knew
that there was a delay opcode with a delay time in samples.
Best wishes,
Jeanette
--
* Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
* GitHub: https://github.com/jeanette-c
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 |