I think the problem is that the channel names are created at i-time and the loop runs at perf time.
Why don't you try first creating the array with the channel names - then using that in the k-rate loop. Don't put the sprintf() in the k-rate loop.
Prof. Victor Lazzarini
Maynooth University
Ireland
Hi there and hi Victor,
I'm afraid to have no other choice to continue this thread today about a problem yet simple.
I just want in order to set a given number of chnsetpfield value, string for name of the channel and after set all corresponding chnget in a udo whose the xout ouptut is a array of k values.
I guess this is an other story of i- and k- rate confusion and maybe a misunderstanding of chnset and chnget behavior such as chnsetiival\[\], \[\]Sname, kval[] chngetk Sname[], etc.
I test the following code both in a udp maxmsp context and in a python script/app using udp, the problem comes from chnget who are set on the same S_name... I can just control the last channel, in this case ctrlArr[4] corresponding to the amplitude of an oscil.
Here the code, out of udp context for test, with some comments which will be more telling than my words:
<CsoundSynthesizer>
<CsOptions>
-odac ;--port=7777
</CsOptions>
<CsInstruments>sr = 48000
ksmps = 32
nchnls = 2
0dbfs = 1opcode testn:i:k\[\]
npfield:i = n // number of pfields
ctrlArr:k[] = initnpfield
;S_chnstr:S = init1
bar:i[] = [1 ... npfield]for j in [0 ... npfield-1] do
chnstr:S = sprintf"%\.02f\_p%d", p1, bar\[j\]
;S_chnstr[j] = sprintf"%\.02f\_p%d", p1, bar\[j\]
fieldvalue:i = pindexbar\[j\]
bar[j] = fieldvalue
chnsetbar\[j\],chnstr
;chnsetbar\[j\],S\_chnstr\[j\]
// use chnsetk, chnseti ?ctrlArr[j] = initbar\[j\]
ctrlArr[j] = chngetchnstr
;ctrlArr[j] = chngetS\_chnstr\[j\]
//I guess here is the problem :
//all chnget are seted on the same Sname, in this case the last
// use chngetk ? Get an error linked to the previous chnset useprintj
printbar\[j\] // values of pfield
putschnstr,1 // names of channels
printk2ctrlArr\[0\] // values stored at index in a krate array
printk2ctrlArr\[1\] //
printk2ctrlArr\[2\] //
printk2ctrlArr\[3\] //
printk2ctrlArr\[4\] //
odxoutctrlArr
endopinstr 1
ctrlArr:k[] = test5
asig = oscilctrlArr\[4\], ctrlArr\[3\]
outsasig,asig
endin</CsInstruments>
<CsScore>
i 1 0 1 80 0.5
e
</CsScore>
</CsoundSynthesizer>Thank you for your quick look, help and advice,
Best,
JB
Csound mailing list
Csound@listserv.heanet.ie
LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE
Send bugs reports to
Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here
The information contained in this email may be confidential and privileged. It is intended only for the addressees 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<mailto: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<mailto: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
Csound mailing list
Csound@listserv.heanet.ie
Send bugs reports to
Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here