| Hi Francesco,
I'm not sure what the problem is, but I saw this bit of code:
instr 10
;print p1
iTableLen = p3*sr
iTableNum = (p1 - 10) * 1000
I'm wondering, what is the intention of writing "(p1 - 10) * 1000" ?
Seems like it will always be zero, no? I wonder if the source of the
problem might be tied to that.
steven
On Mon, May 14, 2018 at 8:11 AM, Francesco Porta
wrote:
> Hi All,
> so i have this csd that trigger a intrument for writing audio to table when input
> is over a threshold. When the writer instrument has finished it start another instrument for reading
> audio from table.
> Seems all fine but sometimes the reader play the previous note instead of latest.
> I mean:
> i play a note, writer start writing audio from input, at the end start the reader that play that audio.
> The writer seems to be ok, the reader instead, after a few (2 maybe) note, it play previous note.
> If i play again then it play correctly this last note.
> I create a new table with different number every note triggered and this numbers seems to
> be right, so what i'm doing wrong?
>
> Thanks for any help,
> ciao,
> francesco
>
>
>
>
> -odac -iadc -+rtaudio=jack -m0
>
>
> sr = 44100
> ksmps = 2
> nchnls = 2
> 0dbfs = 1
>
> gaInput init 0
> gaudio init 0
>
> instr 1
> gaInput inch 1
> endin
>
> instr 2
>
> iThresh = 0.1
> iWait = 1000
> kTimer init 1001
> kRms rms gaInput, 20
> iSampTim = 0.01
> kRmsPrev delayk kRms, iSampTim
> kChange = kRms - kRmsPrev
>
> knote init 1
>
> if(kTimer>iWait) then
> if kChange > iThresh then
> kTrig = 1
> knote = knote + 1
> else
> kTrig = 0
> endif
> kTimer = kTrig == 1 ? 0 : kTimer
> else
> kTimer += ksmps
> kTrig = 0
> endif
>
> kfracnum = 10 + knote/1000
>
> ; 4 sec.
> iTime = 4
>
> ; trigger a note event
> schedkwhen kTrig, 0, 0, kfracnum, 0, iTime
> endin
>
> instr 10
>
> ;print p1
>
> iTableLen = p3*sr
> iTableNum = (p1 - 10) * 1000
>
> ; crea una tavola per l'audio
> iTable ftgen iTableNum, 0, iTableLen, 7, 0
>
> krelease release ; sense when note is in final k-rate pass...
>
> ; -- write audio to table --
> andx line 0, p3, iTableLen
> tablew gaInput, andx, iTable
>
> ; fa partire l'analisi del file audio registrato ...
> schedkwhen krelease, 0, 0, 10 + p1, 0, 120, iTableLen, iTableNum
>
> ;ktime timeinsts
> ;printk2 krelease
> ;printk2 ktime
> endin
>
> instr 20
>
> prints "New\n"
> print p1
> print p5
>
> idur = p3
> ilock = 0
> ipitch = 1
> iamp = 1
>
> atime linseg 2, idur*0.5, 3.75, idur*0.5, 1
> asig mincer atime, iamp, ipitch, p5, ilock
> gaudio += asig
> endin
>
> instr 100
> outs gaudio, gaudio
> gaudio = 0
> endin
>
>
>
>
> i 1 0 240
> i 2 0 240
>
> i 100 0 240
>
>
>
>
> 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
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 |