Csound Csound-dev Csound-tekno Search About

[Csnd] Plugin Opcode API - Arrays of audio signals

Date2019-12-01 14:37
FromJohann Philippe <000002c2c0737523-dmarc-request@LISTSERV.HEANET.IE>
Subject[Csnd] Plugin Opcode API - Arrays of audio signals
Dear all,

I'm working on a plugin opcode with C++ API "csound/plugin.h". As I saw in
articles about that, inargs and outargs can work with arrays at i and
k-rate. But there is nothing about arrays of audio signals.

In my case, I need variable number of arguments for input, and Csound array
is a very simple way to manage it. Opcode is supposed to work at i, k and
a-rate. Is there any way/workaround to get values of an array of audio
signals in a plugin ?

I wish it could work like this :
aargs[] init 2
aargs fillarray 3.56,12
ares = myopcode(aargs)

Thanks

Johann PHILIPPE 



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2019-12-01 16:02
Fromjohn
SubjectRe: [Csnd] Plugin Opcode API - Arrays of audio signals
There is nothing stopping you having an audio array. There  are opcodes 
that accept and/or return such.

==John ff

On Sun, 1 Dec 2019, Johann Philippe wrote:

> Dear all,
>
> I'm working on a plugin opcode with C++ API "csound/plugin.h". As I saw in
> articles about that, inargs and outargs can work with arrays at i and
> k-rate. But there is nothing about arrays of audio signals.
>
> In my case, I need variable number of arguments for input, and Csound array
> is a very simple way to manage it. Opcode is supposed to work at i, k and
> a-rate. Is there any way/workaround to get values of an array of audio
> signals in a plugin ?
>
> I wish it could work like this :
> aargs[] init 2
> aargs fillarray 3.56,12
> ares = myopcode(aargs)
>
> Thanks
>
> Johann PHILIPPE
>
>
>
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
> 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

Date2019-12-01 18:29
FromRichard Knight
SubjectRe: [Csnd] Plugin Opcode API - Arrays of audio signals

hi

There are some useful examples here: https://github.com/csound/examples/blob/master/plugin/opcodes.cpp
Namely from line 91 there is an example of an a-rate array opcode.

The c++ lets you get/set the array data as a vector eg, inargs.vector_data<MYFLT>(n) , as in those examples, or it is also possible to cast to the 'old' ARRAYDAT struct eg (ARRAYDAT*) inargs(n)

best,
Richard

On Sun, 1 Dec 2019 07:37:54 -0700, Johann Philippe wrote:

Dear all,

I'm working on a plugin opcode with C++ API "csound/plugin.h". As I saw in
articles about that, inargs and outargs can work with arrays at i and
k-rate. But there is nothing about arrays of audio signals.

In my case, I need variable number of arguments for input, and Csound array
is a very simple way to manage it. Opcode is supposed to work at i, k and
a-rate. Is there any way/workaround to get values of an array of audio
signals in a plugin ?

I wish it could work like this :
aargs[] init 2
aargs fillarray 3.56,12
ares = myopcode(aargs)

Thanks

Johann PHILIPPE 



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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
-- 


http://rk.1bpm.net/

Date2019-12-02 07:52
FromJohann Philippe <000002c2c0737523-dmarc-request@LISTSERV.HEANET.IE>
SubjectRe: [Csnd] Plugin Opcode API - Arrays of audio signals
There is still one point I'm not sure to understand. Since audio signals are themselves vectors, shouldn't the inargs.vector_data(0) return a vector of vector like csnd::Vector< csnd::Vector <MYFLT> > ?

What I need to do is accessing values in every audio signal in the array -  something like this :
for(int i = 0; i < arraysize; i++) {
    for(int aidx=0; aidx < nsmps; aidx++) {
        doSomething( in[i][aidx] ) ;
    }
}

Le dimanche 1 décembre 2019 à 19:30:03 UTC+1, Richard Knight <richard@1bpm.net> a écrit :


hi

There are some useful examples here: https://github.com/csound/examples/blob/master/plugin/opcodes.cpp
Namely from line 91 there is an example of an a-rate array opcode.

The c++ lets you get/set the array data as a vector eg, inargs.vector_data<MYFLT>(n) , as in those examples, or it is also possible to cast to the 'old' ARRAYDAT struct eg (ARRAYDAT*) inargs(n)

best,
Richard

On Sun, 1 Dec 2019 07:37:54 -0700, Johann Philippe wrote:

Dear all,

I'm working on a plugin opcode with C++ API "csound/plugin.h". As I saw in
articles about that, inargs and outargs can work with arrays at i and
k-rate. But there is nothing about arrays of audio signals.

In my case, I need variable number of arguments for input, and Csound array
is a very simple way to manage it. Opcode is supposed to work at i, k and
a-rate. Is there any way/workaround to get values of an array of audio
signals in a plugin ?

I wish it could work like this :
aargs[] init 2
aargs fillarray 3.56,12
ares = myopcode(aargs)

Thanks

Johann PHILIPPE 



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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
-- 


http://rk.1bpm.net/
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

Date2019-12-02 14:04
FromVictor Lazzarini
SubjectRe: [Csnd] Plugin Opcode API - Arrays of audio signals
Vector is only a thin wrapper over ARRAYDAT.

In the case of audio-rate arrays, the data is arranged in rows of ksmps MYFLT samples,
one for each array item. Once you get the data pointer, you can access each member as data[n + i*ksmps], where n is sample index and i is the array index.

Prof. Victor Lazzarini
Maynooth University
Ireland

On 2 Dec 2019, at 07:52, Johann Philippe <000002c2c0737523-dmarc-request@listserv.heanet.ie> wrote:

There is still one point I'm not sure to understand. Since audio signals are themselves vectors, shouldn't the inargs.vector_data(0) return a vector of vector like csnd::Vector< csnd::Vector <MYFLT> > ?

What I need to do is accessing values in every audio signal in the array -  something like this :
for(int i = 0; i < arraysize; i++) {
    for(int aidx=0; aidx < nsmps; aidx++) {
        doSomething( in[i][aidx] ) ;
    }
}

Le dimanche 1 décembre 2019 à 19:30:03 UTC+1, Richard Knight <richard@1bpm.net> a écrit :


hi

There are some useful examples here: https://github.com/csound/examples/blob/master/plugin/opcodes.cpp
Namely from line 91 there is an example of an a-rate array opcode.

The c++ lets you get/set the array data as a vector eg, inargs.vector_data<MYFLT>(n) , as in those examples, or it is also possible to cast to the 'old' ARRAYDAT struct eg (ARRAYDAT*) inargs(n)

best,
Richard

On Sun, 1 Dec 2019 07:37:54 -0700, Johann Philippe wrote:

Dear all,

I'm working on a plugin opcode with C++ API "csound/plugin.h". As I saw in
articles about that, inargs and outargs can work with arrays at i and
k-rate. But there is nothing about arrays of audio signals.

In my case, I need variable number of arguments for input, and Csound array
is a very simple way to manage it. Opcode is supposed to work at i, k and
a-rate. Is there any way/workaround to get values of an array of audio
signals in a plugin ?

I wish it could work like this :
aargs[] init 2
aargs fillarray 3.56,12
ares = myopcode(aargs)

Thanks

Johann PHILIPPE 



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2019-12-02 16:45
FromJohann Philippe <000002c2c0737523-dmarc-request@LISTSERV.HEANET.IE>
SubjectRe: [Csnd] Plugin Opcode API - Arrays of audio signals
It's working great now. Thank you all.

Bests

Johann PHILIPPE

Le lundi 2 décembre 2019 à 15:04:40 UTC+1, Victor Lazzarini <victor.lazzarini@mu.ie> a écrit :


Vector is only a thin wrapper over ARRAYDAT.

In the case of audio-rate arrays, the data is arranged in rows of ksmps MYFLT samples,
one for each array item. Once you get the data pointer, you can access each member as data[n + i*ksmps], where n is sample index and i is the array index.

Prof. Victor Lazzarini
Maynooth University
Ireland

On 2 Dec 2019, at 07:52, Johann Philippe <000002c2c0737523-dmarc-request@listserv.heanet.ie> wrote:

There is still one point I'm not sure to understand. Since audio signals are themselves vectors, shouldn't the inargs.vector_data(0) return a vector of vector like csnd::Vector< csnd::Vector <MYFLT> > ?

What I need to do is accessing values in every audio signal in the array -  something like this :
for(int i = 0; i < arraysize; i++) {
    for(int aidx=0; aidx < nsmps; aidx++) {
        doSomething( in[i][aidx] ) ;
    }
}

Le dimanche 1 décembre 2019 à 19:30:03 UTC+1, Richard Knight <richard@1bpm.net> a écrit :


hi

There are some useful examples here: https://github.com/csound/examples/blob/master/plugin/opcodes.cpp
Namely from line 91 there is an example of an a-rate array opcode.

The c++ lets you get/set the array data as a vector eg, inargs.vector_data<MYFLT>(n) , as in those examples, or it is also possible to cast to the 'old' ARRAYDAT struct eg (ARRAYDAT*) inargs(n)

best,
Richard

On Sun, 1 Dec 2019 07:37:54 -0700, Johann Philippe wrote:

Dear all,

I'm working on a plugin opcode with C++ API "csound/plugin.h". As I saw in
articles about that, inargs and outargs can work with arrays at i and
k-rate. But there is nothing about arrays of audio signals.

In my case, I need variable number of arguments for input, and Csound array
is a very simple way to manage it. Opcode is supposed to work at i, k and
a-rate. Is there any way/workaround to get values of an array of audio
signals in a plugin ?

I wish it could work like this :
aargs[] init 2
aargs fillarray 3.56,12
ares = myopcode(aargs)

Thanks

Johann PHILIPPE 



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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
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