Csound Csound-dev Csound-tekno Search About

[Csnd] mediank array

Date2018-03-17 13:48
FromAndreas 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

 


Date2018-03-17 14:34
FromVictor Lazzarini
SubjectRe: [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

On 17 Mar 2018, at 13:49, Andreas Bergsland <andreas.bergsland@NTNU.NO> wrote:

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

 

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

Date2018-03-17 14:41
FromVictor Lazzarini
SubjectRe: [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  wrote:
> 
> 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
>  
> 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/issuesDiscussions 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

Date2018-03-17 15:13
FromVictor Lazzarini
SubjectRe: [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  wrote:
> 
> 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  wrote:
>> 
>> 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
>> 
>> 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/issuesDiscussions 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

Date2018-03-19 06:39
FromAndreas Bergsland
SubjectRe: [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>
Reply-To: A discussion list for users of Csound <CSOUND@LISTSERV.HEANET.IE>
Date: Saturday, 17 March 2018 at 15:34
To: "CSOUND@LISTSERV.HEANET.IE" <CSOUND@LISTSERV.HEANET.IE>
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


On 17 Mar 2018, at 13:49, Andreas Bergsland <
andreas.bergsland@NTNU.NO> wrote:

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

 

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


Date2018-03-20 14:51
FromVictor Lazzarini
SubjectRe: [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  wrote:
> 
> 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  on behalf of Victor Lazzarini 
> Reply-To: A discussion list for users of Csound 
> Date: Saturday, 17 March 2018 at 15:34
> To: "CSOUND@LISTSERV.HEANET.IE" 
> 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
> 
> On 17 Mar 2018, at 13:49, Andreas Bergsland  wrote:
> 
> 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
>  
> 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/issuesDiscussions 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

Date2018-03-20 15:05
FromVictor Lazzarini
SubjectRe: [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  wrote:
> 
> 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  wrote:
>> 
>> 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  on behalf of Victor Lazzarini 
>> Reply-To: A discussion list for users of Csound 
>> Date: Saturday, 17 March 2018 at 15:34
>> To: "CSOUND@LISTSERV.HEANET.IE" 
>> 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
>> 
>> On 17 Mar 2018, at 13:49, Andreas Bergsland  wrote:
>> 
>> 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
>> 
>> 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/issuesDiscussions 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

Date2018-03-22 09:16
FromAndreas Bergsland
SubjectRe: [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"  wrote:

    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  wrote:
    > 
    > 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  wrote:
    >> 
    >> 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  on behalf of Victor Lazzarini 
    >> Reply-To: A discussion list for users of Csound 
    >> Date: Saturday, 17 March 2018 at 15:34
    >> To: "CSOUND@LISTSERV.HEANET.IE" 
    >> 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
    >> 
    >> On 17 Mar 2018, at 13:49, Andreas Bergsland  wrote:
    >> 
    >> 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
    >> 
    >> 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/issuesDiscussions 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
    


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