Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] A student attempting to use the API

Date2006-07-14 01:29
From"Michael Gogins"
SubjectRe: [Cs-dev] A student attempting to use the API
Java all by itself is fast enough for some realtime audio. Java numerics can 
be as fast as C or C++. Java logic can be equally fast. Java bogs down with 
function calls and things that need permissions. Java ends up being roughly 
3x slower than optimized C, which is plenty fast.

I know, because I wrote a basic realtime audio synthesizer in pure Java. I 
haven't maintained it, but there are some other pure Java audio synthesizers 
that are actually in use and available online, e.g. 
http://www.cs.ubc.ca/spider/kvdoel/jass/, http://jmusic.ci.qut.edu.au/).

In other words, while I wouldn't write a rival to Csound in Java, and will 
keep using Csound, I do think it is reasonable to interface audio from Java 
programs with Csound through the API.

Regards,
Mike

----- Original Message ----- 
From: "Victor Lazzarini" 
To: "Developer discussions" 
Sent: Thursday, July 13, 2006 5:01 PM
Subject: Re: [Cs-dev] A student attempting to use the API


> These methods are only for k-rate signals. I am not
> sure whether it is a good idea to deal with audio
> signals in Java, probably very slow, usable only
> for very simple things.
>
> Victor
>
>>
>> I have a student who is attempting to use the Java API
>> acess to Csound, and in particular using the Software Bus
>> to get data in and out.  I am not up to speed on the API,
>> and know no Java, but what he sems to be saying is that he
>> annot get a-rate data out via the GetChannel and
>> SetChannel methods.  i woud appreciate hearing what he is
>> doing wrong
>>
>> ------- Start of forwarded message -------
>> Date: Wed, 12 Jul 2006 15:27:41 +0100
>> Subject: Csound Java API - difficulties with a-rate data
>>
>> I've been working with the Java API wuth some success, but
>> run into a fairly fundamental problem with accessing
>> a-rate data.
>>
>> k- and i- rate data are fine, using the chnset and chnget
>> opcodes and named (i.e . string indexed) channels. These
>> can be accessed through the API with the GetChannel and
>> SetChannel methods of the main Csound class.
>>
>> a-rate data must obviously work differently, since the
>> (Get|Set)Channel methods have a single return (whereas we
>> need ksmps returns). In any case, using something like:
>>
>> chnset a1, "output"
>>
>> (where a1 is a-rate data which also goes to "out")
>>
>> doesn't result in anything being passed to the named
>> channel "output".
>>
>> Annoyingly, I can see exactly how this works in the C API,
>> and the Java API does have methods for GetOutputBuffer and
>> GetSpout, both of which return an opaque type
>> SWIG_p_double, which I assume is a pointer to the first
>> MYFLT (of ksmpls MYFLTs) in the output buffer.
>> Unfortunately, I can't see a way to access it. Obviously
>> in Java there's no way to just dereference the pointer.
>>
>> The only other sensible looking approach is to use the
>> chano opcode. There are Java methods (e.g. ChanOAGet)
>> which take a SWIG_p_double (presumably a pointer to the
>> channel created with chano) and an integer (I presume an
>> index, as in the C function csoundChanOAGet). However, in
>> Java, all I have to work with is the function return (in
>> this case an integer, which seems to just be zero for a
>> successful call).
>>
>> ------- End of forwarded message -------
>>
>> ==John ffitch
>>
>>
>> ----------------------------------------------------------
>> --------------- Using Tomcat but need to do more? Need to
>> support web services, security? Get stuff done quickly
>> with pre-integrated technology to make your job easier
>> Download IBM WebSphere Application Server v.1.0.1 based on
>> Apache Geronimo
>>
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> --------------------------------------
>   This Email Was brought to you by
>               WebMail
>    A Netwin Web Based EMail Client
>  http://netwinsite.com/webmail/tag.htm
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job 
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel 



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net