[Csnd] wonky array access

It seems when you send a clock/stepm count to parse an array position it starts to act a bit weird.

can anyone test for me?

thnx

gktrk_1 fillarray 1, 2, 3, 4, 5
kstepinput chnget “stepvalue”
printk2 gktrk_1[kndx]

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

whoops i made my own bug in the example code (i modified it a little because of an array change) the code should be

gktrk_1 fillarray 1, 2, 3, 4, 5
kstepinput chnget “stepvalue”
printk2 gktrk_1[kstepinput]

i’m wondering if it’s the clock sent that’s causing bad behavior reading wrong values from arrays/mathematical bugs, or a timing error somewhere. .

so if you want to replicate my environment i am using remove the fillarray code since gktrk_1 is obviously initialized

https://knobcore.github.io/tracker is a live coding environment with a sequencer i have been working on. in fact, i ironically decided to use javascript for clock generation because the ones you can make in csound doesn’t seem too stable with time.

Is the clock always an integer? Or sometimes it’s a float? Arrays will truncate a float index.

Prof. Victor Lazzarini
Maynooth University
Ireland

yes always an integer. from 0-255. the javascript clock runs as a worker and then sends the data as a channel. in fact if you print the clock channel in the console it prints just fine, it gets the correct data.

i hacked around a bit on it again this morning and find that if you change the array to a non-global one it runs as expected. maybe there’s a problem with global arrays, but i’d like to use a global array so i can have my data outside of my instruments since it introduces a bug when you generate new tracks for the sequencer (multiple instruments of the same number) where each array is a track, with 5 values per step.

maybe function tables would be better i am unsure. i have had this problem before now that i think about it which is how i remembered to test krate local to the instrument vs global krate which is weird because you’d think if the array is already in memo that before reading you shouldn’t have issues reading from it…

Since function tables are global objects, they may be suitable for this too.

I am not aware of any issue with global arrays, but if you find one please open a ticket with a minimal example and
we’ll work on it.

Hello all !

This might be a stupid question related to performance threads (java, maybe python also …),
but how can I give an i-message according to the following principle:

pt.InputMessage(“i2 0 0”); // pt is the performance thread

I try to activate the second (help) instrument in an orchestra as soon as csound gets the message from java (the first 0) and it would be executed only once (the second 0).

As far as I understand the second argument should tell the relative time from the start-time.
When this application in question works in real-time, the relative time is not known.
I guessed that maybe 0 would work in real-time case to indicate the present time.

The last argument gives the duration time in beats, but how to execute that instrument only once?
Again here I guessed that maybe 0 would give the minimum duration (one round) for the instrument execution, but looks like it doesn’t work that way.

The reason why I ask this is that I’m trying to send a message from java to csound when some midi-values have been already read into java and that way release csound to read further midi-input values. The instrument 2 simply sets only one help-variable to a certain value.

Any ideas ? Thanks in advance !

–Risto

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

hello dear risto -

im not sure i understood what you need. because when you run csound it executes the instr only once. but i think you run csound several times from java (each time that midi happens in java). so perhaps you need to count how many times you run csound from java ? and write if-statement.

but if you run csound only once you can count like this:
giCount init 0
instr 2
giCount += 1
endin

but again, i dont think you need it if you run csound for once.

hope that helps, if not explain more please -
parham

Probably I was not clear enough. So the actual csound-orc has two instruments 1 and 2.
The instrument 1 does the actual midi-handling and is running in principle continuously.
The instrument 2 is just a helper instrument for timing/hand-shaking.

The csound thread starts with this:
pt.Play();

Immediately after that the instrument 1 starts by e.g:
pt.InputMessage(“i 1 0 55”); // for 55s

Then there is a loop in a java-code to read values from csound to java, e.g:

Sta2 = Sta2Channel.GetValue(0);

The java-loop runs forever in principle and csound keeps running as an independent thread.
During this read-loop i would like to use that .InputMessage for instrument 2, but it may not be the correct method
to be utilised.
I found from python-API document (https://csound.com/docs/ctcsound/ctcsound-PT.html) this command,
with python-specific explanation. This could be more suitable for me because of the absp2mode-parameter:

`scoreEvent`(*absp2mode*, *opcod*, *pFields*)[](https://csound.com/docs/ctcsound/ctcsound-PT.html#ctcsound.CsoundPerformanceThread.scoreEvent)

Sends a score event.

The event has type opcod (e.g. ‘i’ for a note event). pFields is tuple, a list, or an ndarray of MYFLTs with all

the pfields for this event, starting with the p1 value specified in pFields[0]. If absp2mode is non-zero,

the start time of the event is measured from the beginning of performance, instead of the default of relative to the current time.

There seems to be a similar method also in java, like this:

The method ScoreEvent(int, char, int, SWIGTYPE_p_double)

I haven’t seen any java-example where this method has been used, but I guess int = 0/1, char =‘i’,
but what about the rest of the parameters ? SWIGTYPE_p_double type can’t be used in java.
It is quite hard to just guess parameters without any explanation. There is no java-api manual available
with similar explanations as in the case of python as far as i know. Does anyone else know ?

( I know I’m an old fart because of java, but that’s the only programming language where I have
some practical experience )

–Risto

ma 3.3.2025 klo 22.11 Parham Izadyar (parhamizadyar93@gmail.com) kirjoitti:

hello dear risto -

im not sure i understood what you need. because when you run csound it executes the instr only once. but i think you run csound several times from java (each time that midi happens in java). so perhaps you need to count how many times you run csound from java ? and write if-statement.

but if you run csound only once you can count like this:
giCount init 0
instr 2
giCount += 1
endin

but again, i dont think you need it if you run csound for once.

hope that helps, if not explain more please -
parham

Hello all !

This might be a stupid question related to performance threads (java, maybe python also …),
but how can I give an i-message according to the following principle:

pt.InputMessage(“i2 0 0”); // pt is the performance thread

I try to activate the second (help) instrument in an orchestra as soon as csound gets the message from java (the first 0) and it would be executed only once (the second 0).

As far as I understand the second argument should tell the relative time from the start-time.
When this application in question works in real-time, the relative time is not known.
I guessed that maybe 0 would work in real-time case to indicate the present time.

The last argument gives the duration time in beats, but how to execute that instrument only once?
Again here I guessed that maybe 0 would give the minimum duration (one round) for the instrument execution, but looks like it doesn’t work that way.

The reason why I ask this is that I’m trying to send a message from java to csound when some midi-values have been already read into java and that way release csound to read further midi-input values. The instrument 2 simply sets only one help-variable to a certain value.

Any ideas ? Thanks in advance !

–Risto

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

now i understand better,
unfortunately i don’t know these stuff about communication between csound and java/python, so perhaps others can help with that. but what if you write k-rate trigger for instr 2 inside your csound orc? like:

if changed(kMidi) == 1 then
schedulek 2, 0, 1
endif

that’s all i know im afraid
best wishes -
parham

I tried to get an answer from HI (human intelligence) how to use ScoreEvent-method but
because of poor success I turned to NHI (non-human intelligence) in this case Edge-Copilot.

  1. I asked the following question:
    “can you find any example of java-code using csound-api ScoreEvent method?”
    And this was the answer:

import csnd6.csnd6;
import csnd6.Csound;
import csnd6.CsoundMYFLTArray;

public class CsoundExample {
public static void main(String[] args) {
csnd6.csoundInitialize(csnd6.CSOUNDINIT_NO_ATEXIT);

Csound csound = new Csound();
csound.CompileOrc(“instr 1\n a1 oscil p4, p5, 1\n out a1\n endin”);
csound.ReadScore(“i1 0 1 0.5 440”);

csound.Start();
csound.PerformKsmps();

// Create a score event
CsoundMYFLTArray pFields = new CsoundMYFLTArray(5);
pFields.SetValue(0, ‘i’);
pFields.SetValue(1, 1);
pFields.SetValue(2, 0);
pFields.SetValue(3, 1);
pFields.SetValue(4, 0.5);
pFields.SetValue(5, 440);

csound.ScoreEvent(‘i’, pFields, 6);

csound.PerformKsmps();
csound.Stop();
csound.Cleanup();
}
}

That looks actually quite clear, but it is related to Csound-type object.

  1. So asked another question:

“can you find any example of java-code using csound-api ScoreEvent method in the case of Performance thread ?”

Now the answer was this:

import csnd6.csnd6;
import csnd6.Csound;
import csnd6.CsoundPerformanceThread;
import csnd6.CsoundMYFLTArray;

public class CsoundPerformanceThreadExample {
public static void main(String[] args) {
csnd6.csoundInitialize(csnd6.CSOUNDINIT_NO_ATEXIT);

Csound csound = new Csound();
csound.CompileOrc(“instr 1\n a1 oscil p4, p5, 1\n out a1\n endin”);
csound.ReadScore(“i1 0 1 0.5 440”);

CsoundPerformanceThread perfThread = new CsoundPerformanceThread(csound);
perfThread.Play();

// Create a score event
CsoundMYFLTArray pFields = new CsoundMYFLTArray(5);
pFields.SetValue(0, ‘i’);
pFields.SetValue(1, 1);
pFields.SetValue(2, 0);
pFields.SetValue(3, 1);
pFields.SetValue(4, 0.5);
pFields.SetValue(5, 440);

perfThread.ScoreEvent(‘i’, pFields, 6);

// Wait for the performance to finish
perfThread.Join();
csound.Cleanup();
}
}

The actual syntax of the ScoreEvent-call seems to be the same in both cases.
It looks like Copilot gives here a wrong answer because there should be one additional
parameter in the call in the Performance-case.

Of course I tried both cases in java-code but without success.
I can define those p-field arrays but the problem is the actual method call.
When I try to utilise CsoundMYFLTArray-type parameter in the code:

CsoundMYFLTArray pp = new CsoundMYFLTArray(3);

pp.SetValue(0, 2);

pp.SetValue(1, 0);

pp.SetValue(2, 3);

And then use the actual call like this (c is of type Csound):
c.ScoreEvent(‘i’, pp, 3 );

Now i get this error-message in Eclipse:

“The method ScoreEvent(char, SWIGTYPE_p_double, int) in the type Csound is not applicable
for the arguments (char, CsoundMYFLTArray, int)”

This clearly indicates that for some reason the definition in the API for the ScoreEvent is
somehow wrong. Copilot suggested Csound MYFLTArray, but it has been defined as SWIGTYPE_p_double in csnd6.jar.
I can’t understand how any kind of test could have passed java-compiler if tihs method
had been used in java-code.

–Risto

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

pp is a wrapper around the array, the API function take a pointer instead. Look at cs_glue.hpp to see how to get it.

Prof. Victor Lazzarini
Maynooth University
Ireland

Sorry, but I really don’t understand:
a) Where can I find that c++ file (c++ I suppose), this page
https://csound.com/docs/api/files.html
lists only these files:

cscore.h
csdebug.h
csdl.h
csound.h
csound.hpp
csound_threaded.hpp
csoundCore.h

b) Now I noticed that to get java to know that the type SWIGTYPE_p_double exists, this additional import was required
(how could I know this, because it can’t be found in any of the examples)

import csnd6.SWIGTYPE_p_double;

Now I can do something like:
CsoundMYFLTArray pp = new CsoundMYFLTArray(3);
pp.SetValue(0, 2);
pp.SetValue(1, 0);
pp.SetValue(2, 3);

SWIGTYPE_p_double aa = pp.GetPtr(3);

and then use that this way:

pt.ScoreEvent(0, ‘i’,3, aa );

There is still one question mark here, the value 3. Is it correct in .GetPtr(3) (= number of elements) or should it
“point” to the fist element of the pp array ?

c) Any idea why Edge-Copilot could not give a correct example here ? Maybe this type of NHI is
not intelligent enough :slight_smile:

–Risto

ti 4.3.2025 klo 19.50 Victor Lazzarini (000010b17ddd988e-dmarc-request@listserv.heanet.ie) kirjoitti:

pp is a wrapper around the array, the API function take a pointer instead. Look at cs_glue.hpp to see how to get it.

Prof. Victor Lazzarini
Maynooth University
Ireland

Warning

This email originated from outside of Maynooth University’s Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.

I tried to get an answer from HI (human intelligence) how to use ScoreEvent-method but
because of poor success I turned to NHI (non-human intelligence) in this case Edge-Copilot.

  1. I asked the following question:
    “can you find any example of java-code using csound-api ScoreEvent method?”
    And this was the answer:

import csnd6.csnd6;
import csnd6.Csound;
import csnd6.CsoundMYFLTArray;

public class CsoundExample {
public static void main(String[] args) {
csnd6.csoundInitialize(csnd6.CSOUNDINIT_NO_ATEXIT);

Csound csound = new Csound();
csound.CompileOrc(“instr 1\n a1 oscil p4, p5, 1\n out a1\n endin”);
csound.ReadScore(“i1 0 1 0.5 440”);

csound.Start();
csound.PerformKsmps();

// Create a score event
CsoundMYFLTArray pFields = new CsoundMYFLTArray(5);
pFields.SetValue(0, ‘i’);
pFields.SetValue(1, 1);
pFields.SetValue(2, 0);
pFields.SetValue(3, 1);
pFields.SetValue(4, 0.5);
pFields.SetValue(5, 440);

csound.ScoreEvent(‘i’, pFields, 6);

csound.PerformKsmps();
csound.Stop();
csound.Cleanup();
}
}

That looks actually quite clear, but it is related to Csound-type object.

  1. So asked another question:

“can you find any example of java-code using csound-api ScoreEvent method in the case of Performance thread ?”

Now the answer was this:

import csnd6.csnd6;
import csnd6.Csound;
import csnd6.CsoundPerformanceThread;
import csnd6.CsoundMYFLTArray;

public class CsoundPerformanceThreadExample {
public static void main(String[] args) {
csnd6.csoundInitialize(csnd6.CSOUNDINIT_NO_ATEXIT);

Csound csound = new Csound();
csound.CompileOrc(“instr 1\n a1 oscil p4, p5, 1\n out a1\n endin”);
csound.ReadScore(“i1 0 1 0.5 440”);

CsoundPerformanceThread perfThread = new CsoundPerformanceThread(csound);
perfThread.Play();

// Create a score event
CsoundMYFLTArray pFields = new CsoundMYFLTArray(5);
pFields.SetValue(0, ‘i’);
pFields.SetValue(1, 1);
pFields.SetValue(2, 0);
pFields.SetValue(3, 1);
pFields.SetValue(4, 0.5);
pFields.SetValue(5, 440);

perfThread.ScoreEvent(‘i’, pFields, 6);

// Wait for the performance to finish
perfThread.Join();
csound.Cleanup();
}
}

The actual syntax of the ScoreEvent-call seems to be the same in both cases.
It looks like Copilot gives here a wrong answer because there should be one additional
parameter in the call in the Performance-case.

Of course I tried both cases in java-code but without success.
I can define those p-field arrays but the problem is the actual method call.
When I try to utilise CsoundMYFLTArray-type parameter in the code:

CsoundMYFLTArray pp = new CsoundMYFLTArray(3);

pp.SetValue(0, 2);

pp.SetValue(1, 0);

pp.SetValue(2, 3);

And then use the actual call like this (c is of type Csound):
c.ScoreEvent(‘i’, pp, 3 );

Now i get this error-message in Eclipse:

“The method ScoreEvent(char, SWIGTYPE_p_double, int) in the type Csound is not applicable
for the arguments (char, CsoundMYFLTArray, int)”

This clearly indicates that for some reason the definition in the API for the ScoreEvent is
somehow wrong. Copilot suggested Csound MYFLTArray, but it has been defined as SWIGTYPE_p_double in csnd6.jar.
I can’t understand how any kind of test could have passed java-compiler if tihs method
had been used in java-code.

–Risto

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

it’s in ./interfaces. Look there you’ll get the relevant method.

Prof. Victor Lazzarini
Maynooth University
Ireland

./interfaces ?

Do you mean https://csound.com/docs/api/interfaces.html or what ? (this doesn’t exist)

At the main page https://csound.com/docs/api/index.html there is the following text:

"The Csound Application Programming Interface (API) reference is contained herein. The Csound API actually consists of several APIs:

  • The basic Csound C API. Include csound.h and link with libcsound.a. This also includes the Cscore API (see below).
  • The basic Csound C++ API. Include csound.hpp and link with libcsound.a.
  • The interfaces API, includes a number of auxiliary C++ classes, which add functionality and support the wrapping of the Csound API by various languages (e.g. Python, Java, Lua)."
    Unfortunately only the first two items have a link forward, but the “interfaces API” doesn’t have any.
    I’m a bit confused where to go now ?

–Risto

ti 4.3.2025 klo 22.58 Victor Lazzarini (000010b17ddd988e-dmarc-request@listserv.heanet.ie) kirjoitti:

it’s in ./interfaces. Look there you’ll get the relevant method.

Prof. Victor Lazzarini
Maynooth University
Ireland

Sorry, but I really don’t understand:
a) Where can I find that c++ file (c++ I suppose), this page
https://csound.com/docs/api/files.html
lists only these files:

cscore.h
csdebug.h
csdl.h
csound.h
csound.hpp
csound_threaded.hpp
csoundCore.h

b) Now I noticed that to get java to know that the type SWIGTYPE_p_double exists, this additional import was required
(how could I know this, because it can’t be found in any of the examples)

import csnd6.SWIGTYPE_p_double;

Now I can do something like:
CsoundMYFLTArray pp = new CsoundMYFLTArray(3);
pp.SetValue(0, 2);
pp.SetValue(1, 0);
pp.SetValue(2, 3);

SWIGTYPE_p_double aa = pp.GetPtr(3);

and then use that this way:

pt.ScoreEvent(0, ‘i’,3, aa );

There is still one question mark here, the value 3. Is it correct in .GetPtr(3) (= number of elements) or should it
“point” to the fist element of the pp array ?

c) Any idea why Edge-Copilot could not give a correct example here ? Maybe this type of NHI is
not intelligent enough :slight_smile:

–Risto

ti 4.3.2025 klo 19.50 Victor Lazzarini (000010b17ddd988e-dmarc-request@listserv.heanet.ie) kirjoitti:

pp is a wrapper around the array, the API function take a pointer instead. Look at cs_glue.hpp to see how to get it.

Prof. Victor Lazzarini
Maynooth University
Ireland

Warning

This email originated from outside of Maynooth University’s Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.

I tried to get an answer from HI (human intelligence) how to use ScoreEvent-method but
because of poor success I turned to NHI (non-human intelligence) in this case Edge-Copilot.

  1. I asked the following question:
    “can you find any example of java-code using csound-api ScoreEvent method?”
    And this was the answer:

import csnd6.csnd6;
import csnd6.Csound;
import csnd6.CsoundMYFLTArray;

public class CsoundExample {
public static void main(String[] args) {
csnd6.csoundInitialize(csnd6.CSOUNDINIT_NO_ATEXIT);

Csound csound = new Csound();
csound.CompileOrc(“instr 1\n a1 oscil p4, p5, 1\n out a1\n endin”);
csound.ReadScore(“i1 0 1 0.5 440”);

csound.Start();
csound.PerformKsmps();

// Create a score event
CsoundMYFLTArray pFields = new CsoundMYFLTArray(5);
pFields.SetValue(0, ‘i’);
pFields.SetValue(1, 1);
pFields.SetValue(2, 0);
pFields.SetValue(3, 1);
pFields.SetValue(4, 0.5);
pFields.SetValue(5, 440);

csound.ScoreEvent(‘i’, pFields, 6);

csound.PerformKsmps();
csound.Stop();
csound.Cleanup();
}
}

That looks actually quite clear, but it is related to Csound-type object.

  1. So asked another question:

“can you find any example of java-code using csound-api ScoreEvent method in the case of Performance thread ?”

Now the answer was this:

import csnd6.csnd6;
import csnd6.Csound;
import csnd6.CsoundPerformanceThread;
import csnd6.CsoundMYFLTArray;

public class CsoundPerformanceThreadExample {
public static void main(String[] args) {
csnd6.csoundInitialize(csnd6.CSOUNDINIT_NO_ATEXIT);

Csound csound = new Csound();
csound.CompileOrc(“instr 1\n a1 oscil p4, p5, 1\n out a1\n endin”);
csound.ReadScore(“i1 0 1 0.5 440”);

CsoundPerformanceThread perfThread = new CsoundPerformanceThread(csound);
perfThread.Play();

// Create a score event
CsoundMYFLTArray pFields = new CsoundMYFLTArray(5);
pFields.SetValue(0, ‘i’);
pFields.SetValue(1, 1);
pFields.SetValue(2, 0);
pFields.SetValue(3, 1);
pFields.SetValue(4, 0.5);
pFields.SetValue(5, 440);

perfThread.ScoreEvent(‘i’, pFields, 6);

// Wait for the performance to finish
perfThread.Join();
csound.Cleanup();
}
}

The actual syntax of the ScoreEvent-call seems to be the same in both cases.
It looks like Copilot gives here a wrong answer because there should be one additional
parameter in the call in the Performance-case.

Of course I tried both cases in java-code but without success.
I can define those p-field arrays but the problem is the actual method call.
When I try to utilise CsoundMYFLTArray-type parameter in the code:

CsoundMYFLTArray pp = new CsoundMYFLTArray(3);

pp.SetValue(0, 2);

pp.SetValue(1, 0);

pp.SetValue(2, 3);

And then use the actual call like this (c is of type Csound):
c.ScoreEvent(‘i’, pp, 3 );

Now i get this error-message in Eclipse:

“The method ScoreEvent(char, SWIGTYPE_p_double, int) in the type Csound is not applicable
for the arguments (char, CsoundMYFLTArray, int)”

This clearly indicates that for some reason the definition in the API for the ScoreEvent is
somehow wrong. Copilot suggested Csound MYFLTArray, but it has been defined as SWIGTYPE_p_double in csnd6.jar.
I can’t understand how any kind of test could have passed java-compiler if tihs method
had been used in java-code.

–Risto

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

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

I mean ./interfaces in the csound github repo,
csound6 branch.

Prof. Victor Lazzarini
Maynooth University
Ireland

Still scratching my head …
At https://github.com/csound/csound I found:
" Anyone seeking the latest 6.x version please checkout the csound6 branch (or the master branch, containing the latest and final release of this version"

Literally this means I should checkout the whole csound 6.x source-code to my PC in order
to just get usage information of the java-interface… really?

I don’t have any experience on working in github-enviroment. I used to work in svn-environment still a few years ago,
but I suppose that doesn’t help me at all here.

–Risto

ke 5.3.2025 klo 8.43 Victor Lazzarini (000010b17ddd988e-dmarc-request@listserv.heanet.ie) kirjoitti:

I mean ./interfaces in the csound github repo,
csound6 branch.

Prof. Victor Lazzarini
Maynooth University
Ireland

./interfaces ?

Do you mean https://csound.com/docs/api/interfaces.html or what ? (this doesn’t exist)

At the main page https://csound.com/docs/api/index.html there is the following text:

"The Csound Application Programming Interface (API) reference is contained herein. The Csound API actually consists of several APIs:

  • The basic Csound C API. Include csound.h and link with libcsound.a. This also includes the Cscore API (see below).
  • The basic Csound C++ API. Include csound.hpp and link with libcsound.a.
  • The interfaces API, includes a number of auxiliary C++ classes, which add functionality and support the wrapping of the Csound API by various languages (e.g. Python, Java, Lua)."
    Unfortunately only the first two items have a link forward, but the “interfaces API” doesn’t have any.
    I’m a bit confused where to go now ?

–Risto

ti 4.3.2025 klo 22.58 Victor Lazzarini (000010b17ddd988e-dmarc-request@listserv.heanet.ie) kirjoitti:

it’s in ./interfaces. Look there you’ll get the relevant method.

Prof. Victor Lazzarini
Maynooth University
Ireland

Sorry, but I really don’t understand:
a) Where can I find that c++ file (c++ I suppose), this page
https://csound.com/docs/api/files.html
lists only these files:

cscore.h
csdebug.h
csdl.h
csound.h
csound.hpp
csound_threaded.hpp
csoundCore.h

b) Now I noticed that to get java to know that the type SWIGTYPE_p_double exists, this additional import was required
(how could I know this, because it can’t be found in any of the examples)

import csnd6.SWIGTYPE_p_double;

Now I can do something like:
CsoundMYFLTArray pp = new CsoundMYFLTArray(3);
pp.SetValue(0, 2);
pp.SetValue(1, 0);
pp.SetValue(2, 3);

SWIGTYPE_p_double aa = pp.GetPtr(3);

and then use that this way:

pt.ScoreEvent(0, ‘i’,3, aa );

There is still one question mark here, the value 3. Is it correct in .GetPtr(3) (= number of elements) or should it
“point” to the fist element of the pp array ?

c) Any idea why Edge-Copilot could not give a correct example here ? Maybe this type of NHI is
not intelligent enough :slight_smile:

–Risto

ti 4.3.2025 klo 19.50 Victor Lazzarini (000010b17ddd988e-dmarc-request@listserv.heanet.ie) kirjoitti:

pp is a wrapper around the array, the API function take a pointer instead. Look at cs_glue.hpp to see how to get it.

Prof. Victor Lazzarini
Maynooth University
Ireland

Warning

This email originated from outside of Maynooth University’s Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.

I tried to get an answer from HI (human intelligence) how to use ScoreEvent-method but
because of poor success I turned to NHI (non-human intelligence) in this case Edge-Copilot.

  1. I asked the following question:
    “can you find any example of java-code using csound-api ScoreEvent method?”
    And this was the answer:

import csnd6.csnd6;
import csnd6.Csound;
import csnd6.CsoundMYFLTArray;

public class CsoundExample {
public static void main(String[] args) {
csnd6.csoundInitialize(csnd6.CSOUNDINIT_NO_ATEXIT);

Csound csound = new Csound();
csound.CompileOrc(“instr 1\n a1 oscil p4, p5, 1\n out a1\n endin”);
csound.ReadScore(“i1 0 1 0.5 440”);

csound.Start();
csound.PerformKsmps();

// Create a score event
CsoundMYFLTArray pFields = new CsoundMYFLTArray(5);
pFields.SetValue(0, ‘i’);
pFields.SetValue(1, 1);
pFields.SetValue(2, 0);
pFields.SetValue(3, 1);
pFields.SetValue(4, 0.5);
pFields.SetValue(5, 440);

csound.ScoreEvent(‘i’, pFields, 6);

csound.PerformKsmps();
csound.Stop();
csound.Cleanup();
}
}

That looks actually quite clear, but it is related to Csound-type object.

  1. So asked another question:

“can you find any example of java-code using csound-api ScoreEvent method in the case of Performance thread ?”

Now the answer was this:

import csnd6.csnd6;
import csnd6.Csound;
import csnd6.CsoundPerformanceThread;
import csnd6.CsoundMYFLTArray;

public class CsoundPerformanceThreadExample {
public static void main(String[] args) {
csnd6.csoundInitialize(csnd6.CSOUNDINIT_NO_ATEXIT);

Csound csound = new Csound();
csound.CompileOrc(“instr 1\n a1 oscil p4, p5, 1\n out a1\n endin”);
csound.ReadScore(“i1 0 1 0.5 440”);

CsoundPerformanceThread perfThread = new CsoundPerformanceThread(csound);
perfThread.Play();

// Create a score event
CsoundMYFLTArray pFields = new CsoundMYFLTArray(5);
pFields.SetValue(0, ‘i’);
pFields.SetValue(1, 1);
pFields.SetValue(2, 0);
pFields.SetValue(3, 1);
pFields.SetValue(4, 0.5);
pFields.SetValue(5, 440);

perfThread.ScoreEvent(‘i’, pFields, 6);

// Wait for the performance to finish
perfThread.Join();
csound.Cleanup();
}
}

The actual syntax of the ScoreEvent-call seems to be the same in both cases.
It looks like Copilot gives here a wrong answer because there should be one additional
parameter in the call in the Performance-case.

Of course I tried both cases in java-code but without success.
I can define those p-field arrays but the problem is the actual method call.
When I try to utilise CsoundMYFLTArray-type parameter in the code:

CsoundMYFLTArray pp = new CsoundMYFLTArray(3);

pp.SetValue(0, 2);

pp.SetValue(1, 0);

pp.SetValue(2, 3);

And then use the actual call like this (c is of type Csound):
c.ScoreEvent(‘i’, pp, 3 );

Now i get this error-message in Eclipse:

“The method ScoreEvent(char, SWIGTYPE_p_double, int) in the type Csound is not applicable
for the arguments (char, CsoundMYFLTArray, int)”

This clearly indicates that for some reason the definition in the API for the ScoreEvent is
somehow wrong. Copilot suggested Csound MYFLTArray, but it has been defined as SWIGTYPE_p_double in csnd6.jar.
I can’t understand how any kind of test could have passed java-compiler if tihs method
had been used in java-code.

–Risto

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

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

Well, learning how to use git is a good idea since it’s ubiquitous, and checking out the sources is not that much of an effort and it doesn’t take too much space
either.

Alternatively, you can look at the file online, csound/interfaces/cs_glue.hpp at csound6 · csound/csound · GitHub

Or you can do neither of these things, it’s up to you. You asked for help and I am suggesting where you could search for it.

OK, to get the whole Csound seemed to be very simple. Just download the appropriate .gz-file and so on.
(So I didn’t really do a checkout)

Now if I try to find what are the bindings from e.g. ScoreEvent java-method to the corresponding c+±functions
I still can’t find anything. It seems that csnd6.jar java source code is not here, but where is that ?
For a person that understands a bit of java the java source code would probably clarify things a bit
more than c++ only.
Neither cs_glue.hpp or .cpp includes anything related to ScoreEvent.

–Risto

ke 5.3.2025 klo 11.52 vlz (viclazzarini@gmail.com) kirjoitti:

Well, learning how to use git is a good idea since it’s ubiquitous, and checking out the sources is not that much of an effort and it doesn’t take too much space
either.

Alternatively, you can look at the file online, https://github.com/csound/csound/blob/csound6/interfaces/cs_glue.hpp

Or you can do neither of these things, it’s up to you. You asked for help and I am suggesting where you could search for it.

Still scratching my head …
At https://github.com/csound/csound I found:
" Anyone seeking the latest 6.x version please checkout the csound6 branch (or the master branch, containing the latest and final release of this version"

Literally this means I should checkout the whole csound 6.x source-code to my PC in order
to just get usage information of the java-interface… really?

I don’t have any experience on working in github-enviroment. I used to work in svn-environment still a few years ago,
but I suppose that doesn’t help me at all here.

–Risto

ke 5.3.2025 klo 8.43 Victor Lazzarini (000010b17ddd988e-dmarc-request@listserv.heanet.ie) kirjoitti:
I mean ./interfaces in the csound github repo,
csound6 branch.

Prof. Victor Lazzarini
Maynooth University
Ireland

./interfaces ?
Do you mean https://csound.com/docs/api/interfaces.html or what ? (this doesn’t exist)

At the main page https://csound.com/docs/api/index.html there is the following text:

“The Csound Application Programming Interface (API) reference is contained herein. The Csound API actually consists of several APIs:
• The basic Csound C API. Include csound.h and link with libcsound.a. This also includes the Cscore API (see below).
• The basic Csound C++ API. Include csound.hpp and link with libcsound.a.
• The interfaces API, includes a number of auxiliary C++ classes, which add functionality and support the wrapping of the Csound API by various languages (e.g. Python, Java, Lua).”
Unfortunately only the first two items have a link forward, but the “interfaces API” doesn’t have any.
I’m a bit confused where to go now ?

–Risto

ti 4.3.2025 klo 22.58 Victor Lazzarini (000010b17ddd988e-dmarc-request@listserv.heanet.ie) kirjoitti:
it’s in ./interfaces. Look there you’ll get the relevant method.

Prof. Victor Lazzarini
Maynooth University
Ireland

Sorry, but I really don’t understand:
a) Where can I find that c++ file (c++ I suppose), this page
https://csound.com/docs/api/files.html
lists only these files:

cscore.h
csdebug.h
csdl.h
csound.h
csound.hpp
csound_threaded.hpp
csoundCore.h

b) Now I noticed that to get java to know that the type SWIGTYPE_p_double exists, this additional import was required
(how could I know this, because it can’t be found in any of the examples)

import csnd6.SWIGTYPE_p_double;

Now I can do something like:
CsoundMYFLTArray pp = new CsoundMYFLTArray(3);
pp.SetValue(0, 2);
pp.SetValue(1, 0);
pp.SetValue(2, 3);

SWIGTYPE_p_double aa = pp.GetPtr(3);

and then use that this way:

pt.ScoreEvent(0, ‘i’,3, aa );

There is still one question mark here, the value 3. Is it correct in .GetPtr(3) (= number of elements) or should it
“point” to the fist element of the pp array ?

c) Any idea why Edge-Copilot could not give a correct example here ? Maybe this type of NHI is
not intelligent enough :slight_smile:

–Risto

ti 4.3.2025 klo 19.50 Victor Lazzarini (000010b17ddd988e-dmarc-request@listserv.heanet.ie) kirjoitti:
pp is a wrapper around the array, the API function take a pointer instead. Look at cs_glue.hpp to see how to get it.

Prof. Victor Lazzarini
Maynooth University
Ireland

Warning
This email originated from outside of Maynooth University’s Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
I tried to get an answer from HI (human intelligence) how to use ScoreEvent-method but
because of poor success I turned to NHI (non-human intelligence) in this case Edge-Copilot.

  1. I asked the following question:
    “can you find any example of java-code using csound-api ScoreEvent method?”
    And this was the answer:

import csnd6.csnd6;
import csnd6.Csound;
import csnd6.CsoundMYFLTArray;

public class CsoundExample {
public static void main(String args) {
csnd6.csoundInitialize(csnd6.CSOUNDINIT_NO_ATEXIT);

Csound csound = new Csound();
csound.CompileOrc(“instr 1\n a1 oscil p4, p5, 1\n out a1\n endin”);
csound.ReadScore(“i1 0 1 0.5 440”);

csound.Start();
csound.PerformKsmps();

// Create a score event
CsoundMYFLTArray pFields = new CsoundMYFLTArray(5);
pFields.SetValue(0, ‘i’);
pFields.SetValue(1, 1);
pFields.SetValue(2, 0);
pFields.SetValue(3, 1);
pFields.SetValue(4, 0.5);
pFields.SetValue(5, 440);

csound.ScoreEvent(‘i’, pFields, 6);

csound.PerformKsmps();
csound.Stop();
csound.Cleanup();
}
}

That looks actually quite clear, but it is related to Csound-type object.

  1. So asked another question:

“can you find any example of java-code using csound-api ScoreEvent method in the case of Performance thread ?”

Now the answer was this:

import csnd6.csnd6;
import csnd6.Csound;
import csnd6.CsoundPerformanceThread;
import csnd6.CsoundMYFLTArray;

public class CsoundPerformanceThreadExample {
public static void main(String args) {
csnd6.csoundInitialize(csnd6.CSOUNDINIT_NO_ATEXIT);

Csound csound = new Csound();
csound.CompileOrc(“instr 1\n a1 oscil p4, p5, 1\n out a1\n endin”);
csound.ReadScore(“i1 0 1 0.5 440”);

CsoundPerformanceThread perfThread = new CsoundPerformanceThread(csound);
perfThread.Play();

// Create a score event
CsoundMYFLTArray pFields = new CsoundMYFLTArray(5);
pFields.SetValue(0, ‘i’);
pFields.SetValue(1, 1);
pFields.SetValue(2, 0);
pFields.SetValue(3, 1);
pFields.SetValue(4, 0.5);
pFields.SetValue(5, 440);

perfThread.ScoreEvent(‘i’, pFields, 6);

// Wait for the performance to finish
perfThread.Join();
csound.Cleanup();
}
}

The actual syntax of the ScoreEvent-call seems to be the same in both cases.
It looks like Copilot gives here a wrong answer because there should be one additional
parameter in the call in the Performance-case.

Of course I tried both cases in java-code but without success.
I can define those p-field arrays but the problem is the actual method call.
When I try to utilise CsoundMYFLTArray-type parameter in the code:

CsoundMYFLTArray pp = new CsoundMYFLTArray(3);pp.SetValue(0, 2);
pp.SetValue(1, 0);
pp.SetValue(2, 3);

And then use the actual call like this (c is of type Csound):
c.ScoreEvent(‘i’, pp, 3 );

Now i get this error-message in Eclipse:

“The method ScoreEvent(char, SWIGTYPE_p_double, int) in the type Csound is not applicable
for the arguments (char, CsoundMYFLTArray, int)”

This clearly indicates that for some reason the definition in the API for the ScoreEvent is
somehow wrong. Copilot suggested Csound MYFLTArray, but it has been defined as SWIGTYPE_p_double in csnd6.jar.
I can’t understand how any kind of test could have passed java-compiler if tihs method
had been used in java-code.

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

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

Your problem is not with ScoreEvent, it is because you are not using CsoundMYFLTArray correctly. This is
in cs_glue.hpp.

I don’t know if you noticed but i wrote e.g. ScoreEvent.
The comment was a general one for all java-methods.

I can see the type of each argument of any method in Eclipse,
but what is the purpose of each argument ?
Even the names of the arguments could help to me guess what
and where to put which values.

–Risto

P.S. Concerning this specific argument I suppose that
I need to use index value 0 to point in the first element of the array
in order to get the correct pointer value.

ke 5.3.2025 klo 16.58 Victor Lazzarini (000010b17ddd988e-dmarc-request@listserv.heanet.ie) kirjoitti:

Your problem is not with ScoreEvent, it is because you are not using CsoundMYFLTArray correctly. This is
in cs_glue.hpp.

========================
Prof. Victor Lazzarini
Maynooth University
Ireland

OK, to get the whole Csound seemed to be very simple. Just download the appropriate .gz-file and so on.
(So I didn’t really do a checkout)

Now if I try to find what are the bindings from e.g. ScoreEvent java-method to the corresponding c+±functions
I still can’t find anything. It seems that csnd6.jar java source code is not here, but where is that ?
For a person that understands a bit of java the java source code would probably clarify things a bit
more than c++ only.
Neither cs_glue.hpp or .cpp includes anything related to ScoreEvent.

–Risto

ke 5.3.2025 klo 11.52 vlz (viclazzarini@gmail.com) kirjoitti:
Well, learning how to use git is a good idea since it’s ubiquitous, and checking out the sources is not that much of an effort and it doesn’t take too much space
either.

Alternatively, you can look at the file online, https://github.com/csound/csound/blob/csound6/interfaces/cs_glue.hpp

Or you can do neither of these things, it’s up to you. You asked for help and I am suggesting where you could search for it.

Still scratching my head …
At https://github.com/csound/csound I found:
" Anyone seeking the latest 6.x version please checkout the csound6 branch (or the master branch, containing the latest and final release of this version"

Literally this means I should checkout the whole csound 6.x source-code to my PC in order
to just get usage information of the java-interface… really?

I don’t have any experience on working in github-enviroment. I used to work in svn-environment still a few years ago,
but I suppose that doesn’t help me at all here.

–Risto

ke 5.3.2025 klo 8.43 Victor Lazzarini (000010b17ddd988e-dmarc-request@listserv.heanet.ie) kirjoitti:
I mean ./interfaces in the csound github repo,
csound6 branch.

Prof. Victor Lazzarini
Maynooth University
Ireland

./interfaces ?
Do you mean https://csound.com/docs/api/interfaces.html or what ? (this doesn’t exist)

At the main page https://csound.com/docs/api/index.html there is the following text:

“The Csound Application Programming Interface (API) reference is contained herein. The Csound API actually consists of several APIs:
• The basic Csound C API. Include csound.h and link with libcsound.a. This also includes the Cscore API (see below).
• The basic Csound C++ API. Include csound.hpp and link with libcsound.a.
• The interfaces API, includes a number of auxiliary C++ classes, which add functionality and support the wrapping of the Csound API by various languages (e.g. Python, Java, Lua).”
Unfortunately only the first two items have a link forward, but the “interfaces API” doesn’t have any.
I’m a bit confused where to go now ?

–Risto

ti 4.3.2025 klo 22.58 Victor Lazzarini (000010b17ddd988e-dmarc-request@listserv.heanet.ie) kirjoitti:
it’s in ./interfaces. Look there you’ll get the relevant method.

Prof. Victor Lazzarini
Maynooth University
Ireland

Sorry, but I really don’t understand:
a) Where can I find that c++ file (c++ I suppose), this page
https://csound.com/docs/api/files.html
lists only these files:

cscore.h
csdebug.h
csdl.h
csound.h
csound.hpp
csound_threaded.hpp
csoundCore.h

b) Now I noticed that to get java to know that the type SWIGTYPE_p_double exists, this additional import was required
(how could I know this, because it can’t be found in any of the examples)

import csnd6.SWIGTYPE_p_double;

Now I can do something like:
CsoundMYFLTArray pp = new CsoundMYFLTArray(3);
pp.SetValue(0, 2);
pp.SetValue(1, 0);
pp.SetValue(2, 3);

SWIGTYPE_p_double aa = pp.GetPtr(3);

and then use that this way:

pt.ScoreEvent(0, ‘i’,3, aa );

There is still one question mark here, the value 3. Is it correct in .GetPtr(3) (= number of elements) or should it
“point” to the fist element of the pp array ?

c) Any idea why Edge-Copilot could not give a correct example here ? Maybe this type of NHI is
not intelligent enough :slight_smile:

–Risto

ti 4.3.2025 klo 19.50 Victor Lazzarini (000010b17ddd988e-dmarc-request@listserv.heanet.ie) kirjoitti:
pp is a wrapper around the array, the API function take a pointer instead. Look at cs_glue.hpp to see how to get it.

Prof. Victor Lazzarini
Maynooth University
Ireland

Warning
This email originated from outside of Maynooth University’s Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
I tried to get an answer from HI (human intelligence) how to use ScoreEvent-method but
because of poor success I turned to NHI (non-human intelligence) in this case Edge-Copilot.

  1. I asked the following question:
    “can you find any example of java-code using csound-api ScoreEvent method?”
    And this was the answer:

import csnd6.csnd6;
import csnd6.Csound;
import csnd6.CsoundMYFLTArray;

public class CsoundExample {
public static void main(String args) {
csnd6.csoundInitialize(csnd6.CSOUNDINIT_NO_ATEXIT);

Csound csound = new Csound();
csound.CompileOrc(“instr 1\n a1 oscil p4, p5, 1\n out a1\n endin”);
csound.ReadScore(“i1 0 1 0.5 440”);

csound.Start();
csound.PerformKsmps();

// Create a score event
CsoundMYFLTArray pFields = new CsoundMYFLTArray(5);
pFields.SetValue(0, ‘i’);
pFields.SetValue(1, 1);
pFields.SetValue(2, 0);
pFields.SetValue(3, 1);
pFields.SetValue(4, 0.5);
pFields.SetValue(5, 440);

csound.ScoreEvent(‘i’, pFields, 6);

csound.PerformKsmps();
csound.Stop();
csound.Cleanup();
}
}

That looks actually quite clear, but it is related to Csound-type object.

  1. So asked another question:

“can you find any example of java-code using csound-api ScoreEvent method in the case of Performance thread ?”

Now the answer was this:

import csnd6.csnd6;
import csnd6.Csound;
import csnd6.CsoundPerformanceThread;
import csnd6.CsoundMYFLTArray;

public class CsoundPerformanceThreadExample {
public static void main(String args) {
csnd6.csoundInitialize(csnd6.CSOUNDINIT_NO_ATEXIT);

Csound csound = new Csound();
csound.CompileOrc(“instr 1\n a1 oscil p4, p5, 1\n out a1\n endin”);
csound.ReadScore(“i1 0 1 0.5 440”);

CsoundPerformanceThread perfThread = new CsoundPerformanceThread(csound);
perfThread.Play();

// Create a score event
CsoundMYFLTArray pFields = new CsoundMYFLTArray(5);
pFields.SetValue(0, ‘i’);
pFields.SetValue(1, 1);
pFields.SetValue(2, 0);
pFields.SetValue(3, 1);
pFields.SetValue(4, 0.5);
pFields.SetValue(5, 440);

perfThread.ScoreEvent(‘i’, pFields, 6);

// Wait for the performance to finish
perfThread.Join();
csound.Cleanup();
}
}

The actual syntax of the ScoreEvent-call seems to be the same in both cases.
It looks like Copilot gives here a wrong answer because there should be one additional
parameter in the call in the Performance-case.

Of course I tried both cases in java-code but without success.
I can define those p-field arrays but the problem is the actual method call.
When I try to utilise CsoundMYFLTArray-type parameter in the code:

CsoundMYFLTArray pp = new CsoundMYFLTArray(3);pp.SetValue(0, 2);
pp.SetValue(1, 0);
pp.SetValue(2, 3);

And then use the actual call like this (c is of type Csound):
c.ScoreEvent(‘i’, pp, 3 );

Now i get this error-message in Eclipse:

“The method ScoreEvent(char, SWIGTYPE_p_double, int) in the type Csound is not applicable
for the arguments (char, CsoundMYFLTArray, int)”

This clearly indicates that for some reason the definition in the API for the ScoreEvent is
somehow wrong. Copilot suggested Csound MYFLTArray, but it has been defined as SWIGTYPE_p_double in csnd6.jar.
I can’t understand how any kind of test could have passed java-compiler if tihs method
had been used in java-code.

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