[Csnd] mediank array
Date | 2018-03-17 13:48 |
From | Andreas Bergsland |
Subject | [Csnd] mediank array |
Hi I a m trying to make an udo with a median filter for k-rate arrays, and I thought that I could do it by way of recursion. I am not sure if this is the right approach at all, but I thought that in this way the mediank opcode would be called as many times as there were elements in the array. I now get a segfault with: SECTION 1: new alloc for instr 1: instr 1: icnt = 1.000 instr 1: icnt = 0.000 PERF ERROR in instr 1 (opcode Mediank_array): Mediank_array: not initialised kDum Mediank_array kArr_in kwinsize imaxsize #i2 0 note aborted csound command: Segmentation fault Does anybody have an idea what to do here? (I am on 6.10.0 on osx 10.12.6) Best, Andreas opcode Mediank_array, k[], k[]kio kArr_in[], kwinsize, imaxsize, icnt xin iLen lenarray kArr_in kArr[] init iLen kDum[] init iLen if icnt >= iLen-1 igoto cont kDum Mediank_array kArr_in, kwinsize, imaxsize, icnt+1 cont: kArr[icnt] mediank kArr_in[icnt], kwinsize, imaxsize print icnt xout kArr endop instr 1 kArr_in[] init 2 kArr_in[0] lfo 1, 2, 1 kArr_in[1] lfo -1, 2, 1 kArr_out[] init (lenarray(kArr_in)) kArr_out Mediank_array kArr_in, 5, 10 endin -- Andreas Bergsland
|
Date | 2018-03-17 14:34 |
From | Victor Lazzarini |
Subject | Re: [Csnd] mediank array |
I have to investigate the segfault (nothing should segfault), but there are problems with your design. Each recursive instance will have its own kArr, and only one of then is output to the instrument. Maybe passing a kArr as input to hold the final output might
work (have to think more about it).
For some reason the opcode initialisation is either not complete or is being skipped.
We need to check this.
Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland
|
Date | 2018-03-17 14:41 |
From | Victor Lazzarini |
Subject | Re: [Csnd] mediank array |
Just spotted something wrong: you are using igoto, when it needs to be goto (which is i & k time). That is the reason for the not initialised message ======================== Prof. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 17 Mar 2018, at 13:48, Andreas Bergsland |
Date | 2018-03-17 15:13 |
From | Victor Lazzarini |
Subject | Re: [Csnd] mediank array |
fixed the segfault on git. ======================== Prof. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 17 Mar 2018, at 14:41, Victor Lazzarini |
Date | 2018-03-19 06:39 |
From | Andreas Bergsland |
Subject | Re: [Csnd] mediank array |
Thanks for looking into it Victor. It might not be possible then, to use recursion to solve this task due to kArr be overwritten? Best, Andreas From: A discussion list for users of Csound <CSOUND@LISTSERV.HEANET.IE> on behalf of Victor Lazzarini <Victor.Lazzarini@MU.IE> For some reason the opcode initialisation is either not complete or is being skipped. We need to check this. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
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 | 2018-03-20 14:51 |
From | Victor Lazzarini |
Subject | Re: [Csnd] mediank array |
No, I am not saying that. The particular design you offered would not work, but you can try replacing the data in the input array rather than creating new arrays inside each UDO instance. The other issue with your code was your use of igoto instead of goto. That cause the missing initialisation error. ======================== Prof. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 19 Mar 2018, at 06:39, Andreas Bergsland |
Date | 2018-03-20 15:05 |
From | Victor Lazzarini |
Subject | Re: [Csnd] mediank array |
This is a trivial example of what I meant opcode Test,k[],k[]o kArr[],icnt xin if icnt >= lenarray(kArr)-1 goto body kArr[] Test kArr,icnt+1 body: kArr[icnt] = icnt; xout kArr endop instr 1 kArr[] init 4 kArr[] Test kArr kcnt = 0 while kcnt < lenarray(kArr) do printk2 kArr[kcnt] printk2 kcnt kcnt += 1 od ======================== Prof. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 20 Mar 2018, at 14:51, Victor Lazzarini |
Date | 2018-03-22 09:16 |
From | Andreas Bergsland |
Subject | Re: [Csnd] mediank array |
Great! So, I tried opcode Test,k[],k[]o kArr[],icnt xin if icnt >= lenarray(kArr)-1 goto body kArr[] Test kArr,icnt+1 body: kArr[icnt] mediank kArr[icnt], 500, 501 xout kArr endop and it seemed to work as desired. Thanks! On 20/03/2018, 16:06, "A discussion list for users of Csound on behalf of Victor Lazzarini" |