Re: [Csnd] [EXTERNAL] [Csnd] Question re: writing one instr to a table to be read by another
Date | 2023-02-02 23:53 |
From | Scott Daughtrey |
Subject | Re: [Csnd] [EXTERNAL] [Csnd] Question re: writing one instr to a table to be read by another |
Thank you Joaquim & Victor for your replies. I'll try it out. Is GEN02 the suggested table for this purpose? I'm not as familiar with using arrays to store audio data, that's something I'd be interested in looking into to - the method & any possible benefits over tables. As a relative novice to both Csound and programming in general it seems that in Csound tables serve a very similiar purpose to arrays with the added benefit of the specialized GEN routines. So I'm still not sure where, when & why arrays are more practical than tables. Thanks again. Best regards, Scott 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 | 2023-02-03 06:40 |
From | joachim heintz |
Subject | Re: [Csnd] [EXTERNAL] [Csnd] Question re: writing one instr to a table to be read by another |
hi scott - actually you need an "empty" table. GEN02 is the most simple way to create a table filled with zeros (this is "emptiness" here ...): giMyBuffer = ftgen(0,0,sr,2,0) would create a table for one second of recording in your sample rate. or this for one minute: giMyBuffer = ftgen(0,0,sr,2,0) in general, you could use any GEN routine to create the table (buffer) you need. but why create a sine wave which is then overwritten ... best - joachim On 03/02/2023 00:53, Scott Daughtrey wrote: > Thank you Joaquim & Victor for your replies. I'll try it out. Is GEN02 the suggested table for this purpose? > > I'm not as familiar with using arrays to store audio data, that's something I'd be interested in looking into to - the method & any possible benefits over tables. > > As a relative novice to both Csound and programming in general it seems that in Csound tables serve a very similiar purpose to arrays with the added benefit of the specialized GEN routines. So I'm still not sure where, when & why arrays are more practical than tables. > > Thanks again. Best regards, > Scott > > 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 |
Date | 2023-02-03 06:43 |
From | joachim heintz |
Subject | Re: [Csnd] [EXTERNAL] [Csnd] Question re: writing one instr to a table to be read by another |
sorry, copy-and-past error: for one minute the table should be giMyBuffer = ftgen(0,0,sr*60,2,0) joachim On 03/02/2023 07:40, joachim heintz wrote: > hi scott - > > actually you need an "empty" table. GEN02 is the most simple way to > create a table filled with zeros (this is "emptiness" here ...): > > giMyBuffer = ftgen(0,0,sr,2,0) > > would create a table for one second of recording in your sample rate. or > this for one minute: > > giMyBuffer = ftgen(0,0,sr,2,0) > > in general, you could use any GEN routine to create the table (buffer) > you need. but why create a sine wave which is then overwritten ... > > best - > joachim > > > On 03/02/2023 00:53, Scott Daughtrey wrote: >> Thank you Joaquim & Victor for your replies. I'll try it out. Is GEN02 >> the suggested table for this purpose? >> >> I'm not as familiar with using arrays to store audio data, that's >> something I'd be interested in looking into to - the method & any >> possible benefits over tables. >> >> As a relative novice to both Csound and programming in general it >> seems that in Csound tables serve a very similiar purpose to arrays >> with the added benefit of the specialized GEN routines. So I'm still >> not sure where, when & why arrays are more practical than tables. >> >> Thanks again. Best regards, >> Scott >> >> 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 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 | 2023-02-03 10:01 |
From | Victor Lazzarini |
Subject | Re: [Csnd] [EXTERNAL] [Csnd] Question re: writing one instr to a table to be read by another |
What you get from tables is the table reading opcodes that can do the wrap around etc, at the expense of perhaps simplicity. It is also useful if you want separate instances to work at the same time, so you don’t need to create a function table for each. For example the code below implements a looper using arrays, opcode LooperA,a,aki asig,ktr,imx xin aBuf[] init imx*kr kp init 0 ilen lenarray aBuf if ktr == 1 then aBuf[kp] = asig aout = asig else aout = aBuf[kp] + asig endif xout aout kp = kp == ilen - 1 ? 0 : kp + 1 endop It takes the signal, a record gate (ktr), and the size (in seconds) of the loop. While the gate is high, it records. ======================== Prof. Victor Lazzarini Maynooth University Ireland > On 2 Feb 2023, at 23:53, Scott Daughtrey |
Date | 2023-02-03 10:18 |
From | Victor Lazzarini |
Subject | Re: [Csnd] [EXTERNAL] [Csnd] Question re: writing one instr to a table to be read by another |
I realise I got my sentences mixed up. I meant to say that the array approach is also useful if you want separate instances to work at the same time, so you don’t need to create a function table for each. ======================== Prof. Victor Lazzarini Maynooth University Ireland > On 3 Feb 2023, at 10:01, Victor Lazzarini |