Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] More Daisy help
Dave Seidel <[email protected]> Sun, 14 Sep 2025 13:18:14 -0400
| Newsgroups | gmane.comp.audio.csound.devel |
|---|---|
| Message-ID | <CAMnrweAOW9TD30JDJwJJzbZiyw2Rh==_E1gfu9WzDOV89uECiw@mail.gmail.com> |
Still haven't found my book, but I do have a (purchased) PDF of the Springer Csound book by Victor et al. This contains the same pitchshifter code along with the explanation. (BTW, the window used in the book is a triangle. Any reason to prefer Hanningh over triangle?) In any case, this pitchy shifter code doesn't work well on my Daisy either -- still a lot of noise overlaying the generated output. But this is a Versio, so perhaps it requires something different in the setup/initialization? Next step, I guess, is to compare the code in the Versio example in DaisyExamples to the boilerplate C++ code used in the DaisyCsound examples. I've attached my header file with the Csound code in it. The same Csound code works just fine on my Raspberry Pi. On Fri, Sep 12, 2025 at 4:19 PM Victor Lazzarini < [email protected]> wrote: > I think the second pvsynth in this code might be pushing it > Prof. Victor Lazzarini > Maynooth University > Ireland > > On 12 Sep 2025, at 20:18, Dave Seidel <[email protected]> wrote: > > > Rory, this was running in Daisy? > > On Fri, Sep 12, 2025 at 3:13 PM Rory Walsh <[email protected]> wrote: > >> I've used ksmps=256 and fftsize=1024 and it's worked Ok for me. I've been >> using pvsmooth and pvsynth. Not very heavy stuff, but nice results all the >> same. >> >> On Fri, 12 Sept 2025 at 20:11, Dave Seidel <[email protected]> wrote: >> >>> Great, thanks very much! Still looking for the book... :-) >>> >>> On Fri, Sep 12, 2025 at 1:56 PM Victor Lazzarini < >>> [email protected]> wrote: >>> >>>> Essentially this >>>> https://github.com/csound/book/blob/master/part4/chapter13/13.12.csd >>>> >>>> Prof. Victor Lazzarini >>>> Maynooth University >>>> Ireland >>>> >>>> On 12 Sep 2025, at 18:41, Dave Seidel <[email protected]> wrote: >>>> >>>> >>>> Thanks, Victor. I'll try those things, though I already tried ksmps=256 >>>> and FFT size 1024 -- didn't work, but it did reduce the noise somewhat, so >>>> I think that reinforces your theory. >>>> >>>> The delay-based approach might be fine, thanks for the suggestion. I >>>> know I have the book around somewhere, I just need to find it.... >>>> >>>> On Fri, Sep 12, 2025 at 1:17 PM Victor Lazzarini < >>>> [email protected]> wrote: >>>> >>>>> Hi Dave, >>>>> >>>>> this is probably because the Daisy can't compute audio in time for the >>>>> interrupt. >>>>> It could be that the FFTs are too much for it. >>>>> There's a few things you could try: >>>>> >>>>> increase ksmps to 256 >>>>> decrease FFT size to 1024 >>>>> >>>>> keep ksmps at 128 >>>>> decrease FFT size to 512 >>>>> >>>>> I have not yet tested spectral processing to see what the limits are. >>>>> I can't do any testing at the moment because my Daisy seed is faulty, I'm >>>>> waiting on a replacement. >>>>> >>>>> An alternative to doing pvs-based pitch shifting is to use a delay >>>>> line pitch shifter, which might just work ok in your case. Russell >>>>> Pinkston's chapter in the Csound Book has an example you could use. >>>>> >>>>> Otherwise I can send you some code. >>>>> >>>>> best >>>>> Prof. Victor Lazzarini >>>>> Maynooth University >>>>> Ireland >>>>> >>>>> On 12 Sep 2025, at 16:38, Dave Seidel <[email protected]> wrote: >>>>> >>>>> >>>>> *Warning* >>>>> >>>>> This email originated from outside of Maynooth University's Mail >>>>> System. Do not reply, click links or open attachments unless you recognise >>>>> the sender and know the content is safe. >>>>> Hi Victor, >>>>> >>>>> I have a tiny project that essentially duplicates the >>>>> DaisyCsoundProcess example, the only differences in the code being the >>>>> changes names and the contents of csdText. >>>>> >>>>> Here's the UDO I'm using, which works fine with standalone Csound. It >>>>> takes an input signal and turns it into a stereo output signal with a >>>>> binaural beat. When it's executed on the Daisy, I can sort of hear the >>>>> output, but it's very noisy. Is there anything in this code that you would >>>>> not expect to work on the Daisy? >>>>> >>>>> opcode binauralize, aa, ak >>>>> ain,kdiff xin >>>>> >>>>> ; take it apart >>>>> fsig pvsanal ain, 2048, 2048/4, 2048, 1 >>>>> >>>>> ; determine pitches >>>>> ; kcent, kamp pvspitch fsig, 0.1 >>>>> kcent pvscent fsig >>>>> >>>>> if (kcent > 0) && (kdiff > 0) then >>>>> kdiff /= 2 >>>>> krat1 = (kcent + kdiff) / kcent >>>>> krat2 = (kcent - kdiff) / kcent >>>>> else >>>>> krat1 = 1 >>>>> krat2 = 1 >>>>> endif >>>>> >>>>> ; create derived streams with shifted pitches >>>>> fsig2 = fsig >>>>> fbinL pvscale fsig, krat1, 0 >>>>> fbinR pvscale fsig2, krat2, 0 >>>>> >>>>> ; put it back together >>>>> aoutL pvsynth fbinL >>>>> aoutR pvsynth fbinR >>>>> >>>>> xout aoutL, aoutR >>>>> endop >>>>> >>>>>
daisyCsoundVersio.h
(text/plain, 2.2 KB)
/*
daisyCsoundVersio.h:
Copyright (C) 2025 Dave Seidel
This file is part of Csound.
The Csound Library is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
Csound is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with Csound; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
*/
#ifndef DAISY_CSOUND_H
#define DAISY_CSOUND_H
#include <string>
using namespace std;
string csdText = R"csd(
<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr=48000
nchnls=2
0dbfs=1
; triangle window
gifn ftgen 1,0,16384,20,3
/*****************************************************
asig PitchShifter ain,kp,kdel,ifn[,imax]
ain - input signal
kp - pitch shift factor (interval ratio)
kdel - delay mod width
ifn - window (envelope) to cut discontinuities
imax - optional max delay (defaults to 1 sec)
*****************************************************/
opcode PitchShifter,a,akkip
asig,kp,kdel,ifn,imax xin
kfm = (kp-1)/kdel
amd1 phasor -kfm
amd2 phasor -kfm,0.5
admp delayr imax
atp1 deltap3 amd1*kdel
atp2 deltap3 amd2*kdel
delayw asig
xout atp1*tablei:a(amd1,ifn,1) +
atp2*tablei:a(amd2,ifn,1)
endop
instr Main
ain inch 1
kf, ka pitchamdf ain,100,600
kf = kf < 100 ? 100 : (kf > 600 ? 600 : kf)
kdel = 2/kf
kdel port kdel, 0.01, 0.1
asig PitchShifter ain,1.5,kdel,1
outs asig+ain,asig+ain
endin
schedule("Main", 0, -1)
</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>
)csd";
#endif