Csound Csound-dev Csound-tekno Search About

[Cs-dev] accessing spout etc from a wrapper

Date2010-02-09 17:57
FromVictor Lazzarini
Subject[Cs-dev] accessing spout etc from a wrapper
Dear all,

about half a year ago, there was some complaint that the access to  
spout/spin etc is not possible from a wrapped language. This seemed to  
have been demonstrated in Java.

Now, I am not sure about the specific case of Java, but I knew this  
was possible in Python. At the time, I did not have the chance to test  
it and show how it's done. Mike Gogins offered to add API functions to  
facilitate this, but I had the impression this was not needed  
(although desirable).

I just had some moments today to look into this question. Here's a  
script that demonstrates access to spout. I thought I'd post it here  
so it can be searched if anyone wants to attempt it.

======
from csnd import *
from pylab import *

cs = Csound()
res = cs.Compile("sine.csd", "-n")
spoutlen = cs.GetKsmps()*cs.GetNchnls()
spout = CsoundMYFLTArray();
spout.SetPtr(cs.GetSpout())

a = []
while(res==0):
   res = cs.PerformKsmps()
   for i in range(0, spoutlen):
         a.append(spout.GetValue(i))

t = arange(len(a))

plot(t[0:100]/cs.GetSr(), a[0:100])
show()

========
and we get a nice signal plot.

Now why a similar code is not possible in Java escapes me.

Regards

Victor

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-09 18:03
FromMichael Gogins
SubjectRe: [Cs-dev] accessing spout etc from a wrapper
As a matter of fact, it is possible to access spout using the existing
API, but it is not obvious or convenient.

I have promised to implement convenient, obvious samplewise access to
spin, spout, and numbered channels. I got distracted... I may actually
have done this... I will check and see how far along I got, and finish
the work if it needs to be finished.

Regards,
Mike

On Tue, Feb 9, 2010 at 12:57 PM, Victor Lazzarini
 wrote:
> Dear all,
>
> about half a year ago, there was some complaint that the access to
> spout/spin etc is not possible from a wrapped language. This seemed to
> have been demonstrated in Java.
>
> Now, I am not sure about the specific case of Java, but I knew this
> was possible in Python. At the time, I did not have the chance to test
> it and show how it's done. Mike Gogins offered to add API functions to
> facilitate this, but I had the impression this was not needed
> (although desirable).
>
> I just had some moments today to look into this question. Here's a
> script that demonstrates access to spout. I thought I'd post it here
> so it can be searched if anyone wants to attempt it.
>
> ======
> from csnd import *
> from pylab import *
>
> cs = Csound()
> res = cs.Compile("sine.csd", "-n")
> spoutlen = cs.GetKsmps()*cs.GetNchnls()
> spout = CsoundMYFLTArray();
> spout.SetPtr(cs.GetSpout())
>
> a = []
> while(res==0):
>   res = cs.PerformKsmps()
>   for i in range(0, spoutlen):
>         a.append(spout.GetValue(i))
>
> t = arange(len(a))
>
> plot(t[0:100]/cs.GetSr(), a[0:100])
> show()
>
> ========
> and we get a nice signal plot.
>
> Now why a similar code is not possible in Java escapes me.
>
> Regards
>
> Victor
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-09 18:14
FromVictor Lazzarini
SubjectRe: [Cs-dev] accessing spout etc from a wrapper
But can you explain why there seem to have been a problem in doing  
this from
Java?

Victor
On 9 Feb 2010, at 18:03, Michael Gogins wrote:

> As a matter of fact, it is possible to access spout using the existing
> API, but it is not obvious or convenient.
>
> I have promised to implement convenient, obvious samplewise access to
> spin, spout, and numbered channels. I got distracted... I may actually
> have done this... I will check and see how far along I got, and finish
> the work if it needs to be finished.
>
> Regards,
> Mike
>
> On Tue, Feb 9, 2010 at 12:57 PM, Victor Lazzarini
>  wrote:
>> Dear all,
>>
>> about half a year ago, there was some complaint that the access to
>> spout/spin etc is not possible from a wrapped language. This seemed  
>> to
>> have been demonstrated in Java.
>>
>> Now, I am not sure about the specific case of Java, but I knew this
>> was possible in Python. At the time, I did not have the chance to  
>> test
>> it and show how it's done. Mike Gogins offered to add API functions  
>> to
>> facilitate this, but I had the impression this was not needed
>> (although desirable).
>>
>> I just had some moments today to look into this question. Here's a
>> script that demonstrates access to spout. I thought I'd post it here
>> so it can be searched if anyone wants to attempt it.
>>
>> ======
>> from csnd import *
>> from pylab import *
>>
>> cs = Csound()
>> res = cs.Compile("sine.csd", "-n")
>> spoutlen = cs.GetKsmps()*cs.GetNchnls()
>> spout = CsoundMYFLTArray();
>> spout.SetPtr(cs.GetSpout())
>>
>> a = []
>> while(res==0):
>>   res = cs.PerformKsmps()
>>   for i in range(0, spoutlen):
>>         a.append(spout.GetValue(i))
>>
>> t = arange(len(a))
>>
>> plot(t[0:100]/cs.GetSr(), a[0:100])
>> show()
>>
>> ========
>> and we get a nice signal plot.
>>
>> Now why a similar code is not possible in Java escapes me.
>>
>> Regards
>>
>> Victor
>>
>> ------------------------------------------------------------------------------
>> The Planet: dedicated and managed hosting, cloud storage, colocation
>> Stay online with enterprise data centers and the best network in  
>> the business
>> Choose flexible plans and management services without long-term  
>> contracts
>> Personal 24x7 support from experience hosting pros just a phone  
>> call away.
>> http://p.sf.net/sfu/theplanet-com
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
>
> -- 
> Michael Gogins
> Irreducible Productions
> http://www.michael-gogins.com
> Michael dot Gogins at gmail dot com
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the  
> business
> Choose flexible plans and management services without long-term  
> contracts
> Personal 24x7 support from experience hosting pros just a phone call  
> away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-09 18:34
FromMichael Gogins
SubjectRe: [Cs-dev] accessing spout etc from a wrapper
You could ready access spout from Java. Peter Brinkmann's jReality
package has code for doing it that he developed with my help. But you
couldn't (as far as I know) access bus channels from SWIG wrappers.

However, the current code DOES have code, by me, for setting
individual samples in spout, reading individual samples from spin, and
accessing individual samples from numbered bus channels. This code
evidently compiles on all platforms since nobody has complained about
it, but it has not yet been tested (as far as I know).

It might well work. Let us know what happens if you try it.

Obviously, you would need a complete SWIG cleanup and rebuild to see
these functions in the wrappers. You can get the API docs just by
running doxygen in the Csound root directory.

Regards,
Mike

On Tue, Feb 9, 2010 at 1:14 PM, Victor Lazzarini
 wrote:
> But can you explain why there seem to have been a problem in doing
> this from
> Java?
>
> Victor
> On 9 Feb 2010, at 18:03, Michael Gogins wrote:
>
>> As a matter of fact, it is possible to access spout using the existing
>> API, but it is not obvious or convenient.
>>
>> I have promised to implement convenient, obvious samplewise access to
>> spin, spout, and numbered channels. I got distracted... I may actually
>> have done this... I will check and see how far along I got, and finish
>> the work if it needs to be finished.
>>
>> Regards,
>> Mike
>>
>> On Tue, Feb 9, 2010 at 12:57 PM, Victor Lazzarini
>>  wrote:
>>> Dear all,
>>>
>>> about half a year ago, there was some complaint that the access to
>>> spout/spin etc is not possible from a wrapped language. This seemed
>>> to
>>> have been demonstrated in Java.
>>>
>>> Now, I am not sure about the specific case of Java, but I knew this
>>> was possible in Python. At the time, I did not have the chance to
>>> test
>>> it and show how it's done. Mike Gogins offered to add API functions
>>> to
>>> facilitate this, but I had the impression this was not needed
>>> (although desirable).
>>>
>>> I just had some moments today to look into this question. Here's a
>>> script that demonstrates access to spout. I thought I'd post it here
>>> so it can be searched if anyone wants to attempt it.
>>>
>>> ======
>>> from csnd import *
>>> from pylab import *
>>>
>>> cs = Csound()
>>> res = cs.Compile("sine.csd", "-n")
>>> spoutlen = cs.GetKsmps()*cs.GetNchnls()
>>> spout = CsoundMYFLTArray();
>>> spout.SetPtr(cs.GetSpout())
>>>
>>> a = []
>>> while(res==0):
>>>   res = cs.PerformKsmps()
>>>   for i in range(0, spoutlen):
>>>         a.append(spout.GetValue(i))
>>>
>>> t = arange(len(a))
>>>
>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>> show()
>>>
>>> ========
>>> and we get a nice signal plot.
>>>
>>> Now why a similar code is not possible in Java escapes me.
>>>
>>> Regards
>>>
>>> Victor
>>>
>>> ------------------------------------------------------------------------------
>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>> Stay online with enterprise data centers and the best network in
>>> the business
>>> Choose flexible plans and management services without long-term
>>> contracts
>>> Personal 24x7 support from experience hosting pros just a phone
>>> call away.
>>> http://p.sf.net/sfu/theplanet-com
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>
>>
>>
>> --
>> Michael Gogins
>> Irreducible Productions
>> http://www.michael-gogins.com
>> Michael dot Gogins at gmail dot com
>>
>> ------------------------------------------------------------------------------
>> The Planet: dedicated and managed hosting, cloud storage, colocation
>> Stay online with enterprise data centers and the best network in the
>> business
>> Choose flexible plans and management services without long-term
>> contracts
>> Personal 24x7 support from experience hosting pros just a phone call
>> away.
>> http://p.sf.net/sfu/theplanet-com
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-09 18:49
FromVictor Lazzarini
SubjectRe: [Cs-dev] accessing spout etc from a wrapper
I'm not trying to do it in Java, just pointing out that it should be  
possible to do that. I don't program in that language, so it's just  
curiosity.

Victor
On 9 Feb 2010, at 18:34, Michael Gogins wrote:

> You could ready access spout from Java. Peter Brinkmann's jReality
> package has code for doing it that he developed with my help. But you
> couldn't (as far as I know) access bus channels from SWIG wrappers.
>
> However, the current code DOES have code, by me, for setting
> individual samples in spout, reading individual samples from spin, and
> accessing individual samples from numbered bus channels. This code
> evidently compiles on all platforms since nobody has complained about
> it, but it has not yet been tested (as far as I know).
>
> It might well work. Let us know what happens if you try it.
>
> Obviously, you would need a complete SWIG cleanup and rebuild to see
> these functions in the wrappers. You can get the API docs just by
> running doxygen in the Csound root directory.
>
> Regards,
> Mike
>
> On Tue, Feb 9, 2010 at 1:14 PM, Victor Lazzarini
>  wrote:
>> But can you explain why there seem to have been a problem in doing
>> this from
>> Java?
>>
>> Victor
>> On 9 Feb 2010, at 18:03, Michael Gogins wrote:
>>
>>> As a matter of fact, it is possible to access spout using the  
>>> existing
>>> API, but it is not obvious or convenient.
>>>
>>> I have promised to implement convenient, obvious samplewise access  
>>> to
>>> spin, spout, and numbered channels. I got distracted... I may  
>>> actually
>>> have done this... I will check and see how far along I got, and  
>>> finish
>>> the work if it needs to be finished.
>>>
>>> Regards,
>>> Mike
>>>
>>> On Tue, Feb 9, 2010 at 12:57 PM, Victor Lazzarini
>>>  wrote:
>>>> Dear all,
>>>>
>>>> about half a year ago, there was some complaint that the access to
>>>> spout/spin etc is not possible from a wrapped language. This seemed
>>>> to
>>>> have been demonstrated in Java.
>>>>
>>>> Now, I am not sure about the specific case of Java, but I knew this
>>>> was possible in Python. At the time, I did not have the chance to
>>>> test
>>>> it and show how it's done. Mike Gogins offered to add API functions
>>>> to
>>>> facilitate this, but I had the impression this was not needed
>>>> (although desirable).
>>>>
>>>> I just had some moments today to look into this question. Here's a
>>>> script that demonstrates access to spout. I thought I'd post it  
>>>> here
>>>> so it can be searched if anyone wants to attempt it.
>>>>
>>>> ======
>>>> from csnd import *
>>>> from pylab import *
>>>>
>>>> cs = Csound()
>>>> res = cs.Compile("sine.csd", "-n")
>>>> spoutlen = cs.GetKsmps()*cs.GetNchnls()
>>>> spout = CsoundMYFLTArray();
>>>> spout.SetPtr(cs.GetSpout())
>>>>
>>>> a = []
>>>> while(res==0):
>>>>   res = cs.PerformKsmps()
>>>>   for i in range(0, spoutlen):
>>>>         a.append(spout.GetValue(i))
>>>>
>>>> t = arange(len(a))
>>>>
>>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>>> show()
>>>>
>>>> ========
>>>> and we get a nice signal plot.
>>>>
>>>> Now why a similar code is not possible in Java escapes me.
>>>>
>>>> Regards
>>>>
>>>> Victor
>>>>
>>>> ------------------------------------------------------------------------------
>>>> The Planet: dedicated and managed hosting, cloud storage,  
>>>> colocation
>>>> Stay online with enterprise data centers and the best network in
>>>> the business
>>>> Choose flexible plans and management services without long-term
>>>> contracts
>>>> Personal 24x7 support from experience hosting pros just a phone
>>>> call away.
>>>> http://p.sf.net/sfu/theplanet-com
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>>
>>>
>>> --
>>> Michael Gogins
>>> Irreducible Productions
>>> http://www.michael-gogins.com
>>> Michael dot Gogins at gmail dot com
>>>
>>> ------------------------------------------------------------------------------
>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>> Stay online with enterprise data centers and the best network in the
>>> business
>>> Choose flexible plans and management services without long-term
>>> contracts
>>> Personal 24x7 support from experience hosting pros just a phone call
>>> away.
>>> http://p.sf.net/sfu/theplanet-com
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> The Planet: dedicated and managed hosting, cloud storage, colocation
>> Stay online with enterprise data centers and the best network in  
>> the business
>> Choose flexible plans and management services without long-term  
>> contracts
>> Personal 24x7 support from experience hosting pros just a phone  
>> call away.
>> http://p.sf.net/sfu/theplanet-com
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
>
> -- 
> Michael Gogins
> Irreducible Productions
> http://www.michael-gogins.com
> Michael dot Gogins at gmail dot com
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the  
> business
> Choose flexible plans and management services without long-term  
> contracts
> Personal 24x7 support from experience hosting pros just a phone call  
> away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-09 19:05
FromDavidW
SubjectRe: [Cs-dev] accessing spout etc from a wrapper
JAVA = Just Another Version of Awfulness ?     :-)

D.

On 10/02/2010, at 5:49 AM, Victor Lazzarini wrote:

> I'm not trying to do it in Java, just pointing out that it should be
> possible to do that. I don't program in that language, so it's just
> curiosity.
>

________________________________________________
Dr David Worrall.
- Experimental Polymedia:	  worrall.avatar.com.au
- Sonification: www.sonifiction.com.au
- Education for Financial Independence: www.mindthemarkets.com.au







------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-09 19:41
FromVictor Lazzarini
SubjectRe: [Cs-dev] accessing spout etc from a wrapper
It seems possible to get a numbered channel (rather than a named one).
I''l prepare an example.

Victor
On 9 Feb 2010, at 18:34, Michael Gogins wrote:

> You could ready access spout from Java. Peter Brinkmann's jReality
> package has code for doing it that he developed with my help. But you
> couldn't (as far as I know) access bus channels from SWIG wrappers.
>
> However, the current code DOES have code, by me, for setting
> individual samples in spout, reading individual samples from spin, and
> accessing individual samples from numbered bus channels. This code
> evidently compiles on all platforms since nobody has complained about
> it, but it has not yet been tested (as far as I know).
>
> It might well work. Let us know what happens if you try it.
>
> Obviously, you would need a complete SWIG cleanup and rebuild to see
> these functions in the wrappers. You can get the API docs just by
> running doxygen in the Csound root directory.
>
> Regards,
> Mike
>
> On Tue, Feb 9, 2010 at 1:14 PM, Victor Lazzarini
>  wrote:
>> But can you explain why there seem to have been a problem in doing
>> this from
>> Java?
>>
>> Victor
>> On 9 Feb 2010, at 18:03, Michael Gogins wrote:
>>
>>> As a matter of fact, it is possible to access spout using the  
>>> existing
>>> API, but it is not obvious or convenient.
>>>
>>> I have promised to implement convenient, obvious samplewise access  
>>> to
>>> spin, spout, and numbered channels. I got distracted... I may  
>>> actually
>>> have done this... I will check and see how far along I got, and  
>>> finish
>>> the work if it needs to be finished.
>>>
>>> Regards,
>>> Mike
>>>
>>> On Tue, Feb 9, 2010 at 12:57 PM, Victor Lazzarini
>>>  wrote:
>>>> Dear all,
>>>>
>>>> about half a year ago, there was some complaint that the access to
>>>> spout/spin etc is not possible from a wrapped language. This seemed
>>>> to
>>>> have been demonstrated in Java.
>>>>
>>>> Now, I am not sure about the specific case of Java, but I knew this
>>>> was possible in Python. At the time, I did not have the chance to
>>>> test
>>>> it and show how it's done. Mike Gogins offered to add API functions
>>>> to
>>>> facilitate this, but I had the impression this was not needed
>>>> (although desirable).
>>>>
>>>> I just had some moments today to look into this question. Here's a
>>>> script that demonstrates access to spout. I thought I'd post it  
>>>> here
>>>> so it can be searched if anyone wants to attempt it.
>>>>
>>>> ======
>>>> from csnd import *
>>>> from pylab import *
>>>>
>>>> cs = Csound()
>>>> res = cs.Compile("sine.csd", "-n")
>>>> spoutlen = cs.GetKsmps()*cs.GetNchnls()
>>>> spout = CsoundMYFLTArray();
>>>> spout.SetPtr(cs.GetSpout())
>>>>
>>>> a = []
>>>> while(res==0):
>>>>   res = cs.PerformKsmps()
>>>>   for i in range(0, spoutlen):
>>>>         a.append(spout.GetValue(i))
>>>>
>>>> t = arange(len(a))
>>>>
>>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>>> show()
>>>>
>>>> ========
>>>> and we get a nice signal plot.
>>>>
>>>> Now why a similar code is not possible in Java escapes me.
>>>>
>>>> Regards
>>>>
>>>> Victor
>>>>
>>>> ------------------------------------------------------------------------------
>>>> The Planet: dedicated and managed hosting, cloud storage,  
>>>> colocation
>>>> Stay online with enterprise data centers and the best network in
>>>> the business
>>>> Choose flexible plans and management services without long-term
>>>> contracts
>>>> Personal 24x7 support from experience hosting pros just a phone
>>>> call away.
>>>> http://p.sf.net/sfu/theplanet-com
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>>
>>>
>>> --
>>> Michael Gogins
>>> Irreducible Productions
>>> http://www.michael-gogins.com
>>> Michael dot Gogins at gmail dot com
>>>
>>> ------------------------------------------------------------------------------
>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>> Stay online with enterprise data centers and the best network in the
>>> business
>>> Choose flexible plans and management services without long-term
>>> contracts
>>> Personal 24x7 support from experience hosting pros just a phone call
>>> away.
>>> http://p.sf.net/sfu/theplanet-com
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> The Planet: dedicated and managed hosting, cloud storage, colocation
>> Stay online with enterprise data centers and the best network in  
>> the business
>> Choose flexible plans and management services without long-term  
>> contracts
>> Personal 24x7 support from experience hosting pros just a phone  
>> call away.
>> http://p.sf.net/sfu/theplanet-com
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
>
> -- 
> Michael Gogins
> Irreducible Productions
> http://www.michael-gogins.com
> Michael dot Gogins at gmail dot com
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the  
> business
> Choose flexible plans and management services without long-term  
> contracts
> Personal 24x7 support from experience hosting pros just a phone call  
> away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-09 20:18
FromVictor Lazzarini
Subject[Cs-dev] accessing a channel using a wrapped language
Actually, it's possible to access "named" channels too, through  
Python. So it should be possible in Java too. Can't see what the fuss  
was all about then, can you?

Here's the code.
=============
from csnd import *
from pylab import *

cs = Csound()
res = cs.Compile("sine.csd", "-n")
ksmps = cs.GetKsmps()
channel = CsoundMYFLTArray(ksmps);

a = []
while(res==0):
   res = cs.PerformKsmps()
   cs.GetChannelPtr(channel.GetPtr(), "out", CSOUND_AUDIO_CHANNEL |  
CSOUND_OUTPUT_CHANNEL)
   for i in range(0, ksmps):
         a.append(channel.GetValue(i))

t = arange(len(a))

plot(t[0:100]/cs.GetSr(), a[0:100])
show()
===============================

A similar code should be possible in Java.

Victor


On 9 Feb 2010, at 19:41, Victor Lazzarini wrote:

> It seems possible to get a numbered channel (rather than a named one).
> I''l prepare an example.
>
> Victor
> On 9 Feb 2010, at 18:34, Michael Gogins wrote:
>
>> You could ready access spout from Java. Peter Brinkmann's jReality
>> package has code for doing it that he developed with my help. But you
>> couldn't (as far as I know) access bus channels from SWIG wrappers.
>>
>> However, the current code DOES have code, by me, for setting
>> individual samples in spout, reading individual samples from spin,  
>> and
>> accessing individual samples from numbered bus channels. This code
>> evidently compiles on all platforms since nobody has complained about
>> it, but it has not yet been tested (as far as I know).
>>
>> It might well work. Let us know what happens if you try it.
>>
>> Obviously, you would need a complete SWIG cleanup and rebuild to see
>> these functions in the wrappers. You can get the API docs just by
>> running doxygen in the Csound root directory.
>>
>> Regards,
>> Mike
>>
>> On Tue, Feb 9, 2010 at 1:14 PM, Victor Lazzarini
>>  wrote:
>>> But can you explain why there seem to have been a problem in doing
>>> this from
>>> Java?
>>>
>>> Victor
>>> On 9 Feb 2010, at 18:03, Michael Gogins wrote:
>>>
>>>> As a matter of fact, it is possible to access spout using the
>>>> existing
>>>> API, but it is not obvious or convenient.
>>>>
>>>> I have promised to implement convenient, obvious samplewise access
>>>> to
>>>> spin, spout, and numbered channels. I got distracted... I may
>>>> actually
>>>> have done this... I will check and see how far along I got, and
>>>> finish
>>>> the work if it needs to be finished.
>>>>
>>>> Regards,
>>>> Mike
>>>>
>>>> On Tue, Feb 9, 2010 at 12:57 PM, Victor Lazzarini
>>>>  wrote:
>>>>> Dear all,
>>>>>
>>>>> about half a year ago, there was some complaint that the access to
>>>>> spout/spin etc is not possible from a wrapped language. This  
>>>>> seemed
>>>>> to
>>>>> have been demonstrated in Java.
>>>>>
>>>>> Now, I am not sure about the specific case of Java, but I knew  
>>>>> this
>>>>> was possible in Python. At the time, I did not have the chance to
>>>>> test
>>>>> it and show how it's done. Mike Gogins offered to add API  
>>>>> functions
>>>>> to
>>>>> facilitate this, but I had the impression this was not needed
>>>>> (although desirable).
>>>>>
>>>>> I just had some moments today to look into this question. Here's a
>>>>> script that demonstrates access to spout. I thought I'd post it
>>>>> here
>>>>> so it can be searched if anyone wants to attempt it.
>>>>>
>>>>> ======
>>>>> from csnd import *
>>>>> from pylab import *
>>>>>
>>>>> cs = Csound()
>>>>> res = cs.Compile("sine.csd", "-n")
>>>>> spoutlen = cs.GetKsmps()*cs.GetNchnls()
>>>>> spout = CsoundMYFLTArray();
>>>>> spout.SetPtr(cs.GetSpout())
>>>>>
>>>>> a = []
>>>>> while(res==0):
>>>>>  res = cs.PerformKsmps()
>>>>>  for i in range(0, spoutlen):
>>>>>        a.append(spout.GetValue(i))
>>>>>
>>>>> t = arange(len(a))
>>>>>
>>>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>>>> show()
>>>>>
>>>>> ========
>>>>> and we get a nice signal plot.
>>>>>
>>>>> Now why a similar code is not possible in Java escapes me.
>>>>>
>>>>> Regards
>>>>>
>>>>> Victor
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>> colocation
>>>>> Stay online with enterprise data centers and the best network in
>>>>> the business
>>>>> Choose flexible plans and management services without long-term
>>>>> contracts
>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>> call away.
>>>>> http://p.sf.net/sfu/theplanet-com
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Michael Gogins
>>>> Irreducible Productions
>>>> http://www.michael-gogins.com
>>>> Michael dot Gogins at gmail dot com
>>>>
>>>> ------------------------------------------------------------------------------
>>>> The Planet: dedicated and managed hosting, cloud storage,  
>>>> colocation
>>>> Stay online with enterprise data centers and the best network in  
>>>> the
>>>> business
>>>> Choose flexible plans and management services without long-term
>>>> contracts
>>>> Personal 24x7 support from experience hosting pros just a phone  
>>>> call
>>>> away.
>>>> http://p.sf.net/sfu/theplanet-com
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>> Stay online with enterprise data centers and the best network in
>>> the business
>>> Choose flexible plans and management services without long-term
>>> contracts
>>> Personal 24x7 support from experience hosting pros just a phone
>>> call away.
>>> http://p.sf.net/sfu/theplanet-com
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>
>>
>>
>> -- 
>> Michael Gogins
>> Irreducible Productions
>> http://www.michael-gogins.com
>> Michael dot Gogins at gmail dot com
>>
>> ------------------------------------------------------------------------------
>> The Planet: dedicated and managed hosting, cloud storage, colocation
>> Stay online with enterprise data centers and the best network in the
>> business
>> Choose flexible plans and management services without long-term
>> contracts
>> Personal 24x7 support from experience hosting pros just a phone call
>> away.
>> http://p.sf.net/sfu/theplanet-com
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as  
> DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-09 20:23
FromMichael Gogins
SubjectRe: [Cs-dev] accessing a channel using a wrapped language
Well, it's not obvious!... I mean the GetChannelPtr(channel.GetPtr()
part in particular:

channel = CsoundMYFLTArray(ksmps);
res = cs.PerformKsmps()

cs.GetChannelPtr(channel.GetPtr(), "out", CSOUND_AUDIO_CHANNEL |
CSOUND_OUTPUT_CHANNEL)

Thanks,
Mike

On Tue, Feb 9, 2010 at 3:18 PM, Victor Lazzarini
 wrote:
> Actually, it's possible to access "named" channels too, through
> Python. So it should be possible in Java too. Can't see what the fuss
> was all about then, can you?
>
> Here's the code.
> =============
> from csnd import *
> from pylab import *
>
> cs = Csound()
> res = cs.Compile("sine.csd", "-n")
> ksmps = cs.GetKsmps()
> channel = CsoundMYFLTArray(ksmps);
>
> a = []
> while(res==0):
>   res = cs.PerformKsmps()
>   cs.GetChannelPtr(channel.GetPtr(), "out", CSOUND_AUDIO_CHANNEL |
> CSOUND_OUTPUT_CHANNEL)
>   for i in range(0, ksmps):
>         a.append(channel.GetValue(i))
>
> t = arange(len(a))
>
> plot(t[0:100]/cs.GetSr(), a[0:100])
> show()
> ===============================
>
> A similar code should be possible in Java.
>
> Victor
>
>
> On 9 Feb 2010, at 19:41, Victor Lazzarini wrote:
>
>> It seems possible to get a numbered channel (rather than a named one).
>> I''l prepare an example.
>>
>> Victor
>> On 9 Feb 2010, at 18:34, Michael Gogins wrote:
>>
>>> You could ready access spout from Java. Peter Brinkmann's jReality
>>> package has code for doing it that he developed with my help. But you
>>> couldn't (as far as I know) access bus channels from SWIG wrappers.
>>>
>>> However, the current code DOES have code, by me, for setting
>>> individual samples in spout, reading individual samples from spin,
>>> and
>>> accessing individual samples from numbered bus channels. This code
>>> evidently compiles on all platforms since nobody has complained about
>>> it, but it has not yet been tested (as far as I know).
>>>
>>> It might well work. Let us know what happens if you try it.
>>>
>>> Obviously, you would need a complete SWIG cleanup and rebuild to see
>>> these functions in the wrappers. You can get the API docs just by
>>> running doxygen in the Csound root directory.
>>>
>>> Regards,
>>> Mike
>>>
>>> On Tue, Feb 9, 2010 at 1:14 PM, Victor Lazzarini
>>>  wrote:
>>>> But can you explain why there seem to have been a problem in doing
>>>> this from
>>>> Java?
>>>>
>>>> Victor
>>>> On 9 Feb 2010, at 18:03, Michael Gogins wrote:
>>>>
>>>>> As a matter of fact, it is possible to access spout using the
>>>>> existing
>>>>> API, but it is not obvious or convenient.
>>>>>
>>>>> I have promised to implement convenient, obvious samplewise access
>>>>> to
>>>>> spin, spout, and numbered channels. I got distracted... I may
>>>>> actually
>>>>> have done this... I will check and see how far along I got, and
>>>>> finish
>>>>> the work if it needs to be finished.
>>>>>
>>>>> Regards,
>>>>> Mike
>>>>>
>>>>> On Tue, Feb 9, 2010 at 12:57 PM, Victor Lazzarini
>>>>>  wrote:
>>>>>> Dear all,
>>>>>>
>>>>>> about half a year ago, there was some complaint that the access to
>>>>>> spout/spin etc is not possible from a wrapped language. This
>>>>>> seemed
>>>>>> to
>>>>>> have been demonstrated in Java.
>>>>>>
>>>>>> Now, I am not sure about the specific case of Java, but I knew
>>>>>> this
>>>>>> was possible in Python. At the time, I did not have the chance to
>>>>>> test
>>>>>> it and show how it's done. Mike Gogins offered to add API
>>>>>> functions
>>>>>> to
>>>>>> facilitate this, but I had the impression this was not needed
>>>>>> (although desirable).
>>>>>>
>>>>>> I just had some moments today to look into this question. Here's a
>>>>>> script that demonstrates access to spout. I thought I'd post it
>>>>>> here
>>>>>> so it can be searched if anyone wants to attempt it.
>>>>>>
>>>>>> ======
>>>>>> from csnd import *
>>>>>> from pylab import *
>>>>>>
>>>>>> cs = Csound()
>>>>>> res = cs.Compile("sine.csd", "-n")
>>>>>> spoutlen = cs.GetKsmps()*cs.GetNchnls()
>>>>>> spout = CsoundMYFLTArray();
>>>>>> spout.SetPtr(cs.GetSpout())
>>>>>>
>>>>>> a = []
>>>>>> while(res==0):
>>>>>>  res = cs.PerformKsmps()
>>>>>>  for i in range(0, spoutlen):
>>>>>>        a.append(spout.GetValue(i))
>>>>>>
>>>>>> t = arange(len(a))
>>>>>>
>>>>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>>>>> show()
>>>>>>
>>>>>> ========
>>>>>> and we get a nice signal plot.
>>>>>>
>>>>>> Now why a similar code is not possible in Java escapes me.
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>> Victor
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>>> colocation
>>>>>> Stay online with enterprise data centers and the best network in
>>>>>> the business
>>>>>> Choose flexible plans and management services without long-term
>>>>>> contracts
>>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>>> call away.
>>>>>> http://p.sf.net/sfu/theplanet-com
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Michael Gogins
>>>>> Irreducible Productions
>>>>> http://www.michael-gogins.com
>>>>> Michael dot Gogins at gmail dot com
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>> colocation
>>>>> Stay online with enterprise data centers and the best network in
>>>>> the
>>>>> business
>>>>> Choose flexible plans and management services without long-term
>>>>> contracts
>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>> call
>>>>> away.
>>>>> http://p.sf.net/sfu/theplanet-com
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>>> Stay online with enterprise data centers and the best network in
>>>> the business
>>>> Choose flexible plans and management services without long-term
>>>> contracts
>>>> Personal 24x7 support from experience hosting pros just a phone
>>>> call away.
>>>> http://p.sf.net/sfu/theplanet-com
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>>
>>>
>>> --
>>> Michael Gogins
>>> Irreducible Productions
>>> http://www.michael-gogins.com
>>> Michael dot Gogins at gmail dot com
>>>
>>> ------------------------------------------------------------------------------
>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>> Stay online with enterprise data centers and the best network in the
>>> business
>>> Choose flexible plans and management services without long-term
>>> contracts
>>> Personal 24x7 support from experience hosting pros just a phone call
>>> away.
>>> http://p.sf.net/sfu/theplanet-com
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> SOLARIS 10 is the OS for Data Centers - provides features such as
>> DTrace,
>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>> http://p.sf.net/sfu/solaris-dev2dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-09 20:28
FromSteven Yi
SubjectRe: [Cs-dev] accessing a channel using a wrapped language
I just took a quick look, the CsoundMYFLTArray.getPtr() returns a
SWIGTYPE_P_P_double while csound.getChannelPtr() is expecting an arg
of SWIGTYPE_P_double.  Might be an difference between python and java
bindings.

On Tue, Feb 9, 2010 at 3:18 PM, Victor Lazzarini
 wrote:
> Actually, it's possible to access "named" channels too, through
> Python. So it should be possible in Java too. Can't see what the fuss
> was all about then, can you?
>
> Here's the code.
> =============
> from csnd import *
> from pylab import *
>
> cs = Csound()
> res = cs.Compile("sine.csd", "-n")
> ksmps = cs.GetKsmps()
> channel = CsoundMYFLTArray(ksmps);
>
> a = []
> while(res==0):
>   res = cs.PerformKsmps()
>   cs.GetChannelPtr(channel.GetPtr(), "out", CSOUND_AUDIO_CHANNEL |
> CSOUND_OUTPUT_CHANNEL)
>   for i in range(0, ksmps):
>         a.append(channel.GetValue(i))
>
> t = arange(len(a))
>
> plot(t[0:100]/cs.GetSr(), a[0:100])
> show()
> ===============================
>
> A similar code should be possible in Java.
>
> Victor
>
>
> On 9 Feb 2010, at 19:41, Victor Lazzarini wrote:
>
>> It seems possible to get a numbered channel (rather than a named one).
>> I''l prepare an example.
>>
>> Victor
>> On 9 Feb 2010, at 18:34, Michael Gogins wrote:
>>
>>> You could ready access spout from Java. Peter Brinkmann's jReality
>>> package has code for doing it that he developed with my help. But you
>>> couldn't (as far as I know) access bus channels from SWIG wrappers.
>>>
>>> However, the current code DOES have code, by me, for setting
>>> individual samples in spout, reading individual samples from spin,
>>> and
>>> accessing individual samples from numbered bus channels. This code
>>> evidently compiles on all platforms since nobody has complained about
>>> it, but it has not yet been tested (as far as I know).
>>>
>>> It might well work. Let us know what happens if you try it.
>>>
>>> Obviously, you would need a complete SWIG cleanup and rebuild to see
>>> these functions in the wrappers. You can get the API docs just by
>>> running doxygen in the Csound root directory.
>>>
>>> Regards,
>>> Mike
>>>
>>> On Tue, Feb 9, 2010 at 1:14 PM, Victor Lazzarini
>>>  wrote:
>>>> But can you explain why there seem to have been a problem in doing
>>>> this from
>>>> Java?
>>>>
>>>> Victor
>>>> On 9 Feb 2010, at 18:03, Michael Gogins wrote:
>>>>
>>>>> As a matter of fact, it is possible to access spout using the
>>>>> existing
>>>>> API, but it is not obvious or convenient.
>>>>>
>>>>> I have promised to implement convenient, obvious samplewise access
>>>>> to
>>>>> spin, spout, and numbered channels. I got distracted... I may
>>>>> actually
>>>>> have done this... I will check and see how far along I got, and
>>>>> finish
>>>>> the work if it needs to be finished.
>>>>>
>>>>> Regards,
>>>>> Mike
>>>>>
>>>>> On Tue, Feb 9, 2010 at 12:57 PM, Victor Lazzarini
>>>>>  wrote:
>>>>>> Dear all,
>>>>>>
>>>>>> about half a year ago, there was some complaint that the access to
>>>>>> spout/spin etc is not possible from a wrapped language. This
>>>>>> seemed
>>>>>> to
>>>>>> have been demonstrated in Java.
>>>>>>
>>>>>> Now, I am not sure about the specific case of Java, but I knew
>>>>>> this
>>>>>> was possible in Python. At the time, I did not have the chance to
>>>>>> test
>>>>>> it and show how it's done. Mike Gogins offered to add API
>>>>>> functions
>>>>>> to
>>>>>> facilitate this, but I had the impression this was not needed
>>>>>> (although desirable).
>>>>>>
>>>>>> I just had some moments today to look into this question. Here's a
>>>>>> script that demonstrates access to spout. I thought I'd post it
>>>>>> here
>>>>>> so it can be searched if anyone wants to attempt it.
>>>>>>
>>>>>> ======
>>>>>> from csnd import *
>>>>>> from pylab import *
>>>>>>
>>>>>> cs = Csound()
>>>>>> res = cs.Compile("sine.csd", "-n")
>>>>>> spoutlen = cs.GetKsmps()*cs.GetNchnls()
>>>>>> spout = CsoundMYFLTArray();
>>>>>> spout.SetPtr(cs.GetSpout())
>>>>>>
>>>>>> a = []
>>>>>> while(res==0):
>>>>>>  res = cs.PerformKsmps()
>>>>>>  for i in range(0, spoutlen):
>>>>>>        a.append(spout.GetValue(i))
>>>>>>
>>>>>> t = arange(len(a))
>>>>>>
>>>>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>>>>> show()
>>>>>>
>>>>>> ========
>>>>>> and we get a nice signal plot.
>>>>>>
>>>>>> Now why a similar code is not possible in Java escapes me.
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>> Victor
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>>> colocation
>>>>>> Stay online with enterprise data centers and the best network in
>>>>>> the business
>>>>>> Choose flexible plans and management services without long-term
>>>>>> contracts
>>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>>> call away.
>>>>>> http://p.sf.net/sfu/theplanet-com
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Michael Gogins
>>>>> Irreducible Productions
>>>>> http://www.michael-gogins.com
>>>>> Michael dot Gogins at gmail dot com
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>> colocation
>>>>> Stay online with enterprise data centers and the best network in
>>>>> the
>>>>> business
>>>>> Choose flexible plans and management services without long-term
>>>>> contracts
>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>> call
>>>>> away.
>>>>> http://p.sf.net/sfu/theplanet-com
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>>> Stay online with enterprise data centers and the best network in
>>>> the business
>>>> Choose flexible plans and management services without long-term
>>>> contracts
>>>> Personal 24x7 support from experience hosting pros just a phone
>>>> call away.
>>>> http://p.sf.net/sfu/theplanet-com
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>>
>>>
>>> --
>>> Michael Gogins
>>> Irreducible Productions
>>> http://www.michael-gogins.com
>>> Michael dot Gogins at gmail dot com
>>>
>>> ------------------------------------------------------------------------------
>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>> Stay online with enterprise data centers and the best network in the
>>> business
>>> Choose flexible plans and management services without long-term
>>> contracts
>>> Personal 24x7 support from experience hosting pros just a phone call
>>> away.
>>> http://p.sf.net/sfu/theplanet-com
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> SOLARIS 10 is the OS for Data Centers - provides features such as
>> DTrace,
>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>> http://p.sf.net/sfu/solaris-dev2dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-09 20:37
FromMichael Gogins
SubjectRe: [Cs-dev] accessing a channel using a wrapped language
Well, that's why I thought it didn't work.

I wonder if Victor tested his example!

It is quite possible that there is a significant difference between
what the SWIG code generator does for Java and what it does for
Python.

In any event, the code should be easier to use, although perhaps not
quite as efficient.

Regards,
Mike

On Tue, Feb 9, 2010 at 3:28 PM, Steven Yi  wrote:
> I just took a quick look, the CsoundMYFLTArray.getPtr() returns a
> SWIGTYPE_P_P_double while csound.getChannelPtr() is expecting an arg
> of SWIGTYPE_P_double.  Might be an difference between python and java
> bindings.
>
> On Tue, Feb 9, 2010 at 3:18 PM, Victor Lazzarini
>  wrote:
>> Actually, it's possible to access "named" channels too, through
>> Python. So it should be possible in Java too. Can't see what the fuss
>> was all about then, can you?
>>
>> Here's the code.
>> =============
>> from csnd import *
>> from pylab import *
>>
>> cs = Csound()
>> res = cs.Compile("sine.csd", "-n")
>> ksmps = cs.GetKsmps()
>> channel = CsoundMYFLTArray(ksmps);
>>
>> a = []
>> while(res==0):
>>   res = cs.PerformKsmps()
>>   cs.GetChannelPtr(channel.GetPtr(), "out", CSOUND_AUDIO_CHANNEL |
>> CSOUND_OUTPUT_CHANNEL)
>>   for i in range(0, ksmps):
>>         a.append(channel.GetValue(i))
>>
>> t = arange(len(a))
>>
>> plot(t[0:100]/cs.GetSr(), a[0:100])
>> show()
>> ===============================
>>
>> A similar code should be possible in Java.
>>
>> Victor
>>
>>
>> On 9 Feb 2010, at 19:41, Victor Lazzarini wrote:
>>
>>> It seems possible to get a numbered channel (rather than a named one).
>>> I''l prepare an example.
>>>
>>> Victor
>>> On 9 Feb 2010, at 18:34, Michael Gogins wrote:
>>>
>>>> You could ready access spout from Java. Peter Brinkmann's jReality
>>>> package has code for doing it that he developed with my help. But you
>>>> couldn't (as far as I know) access bus channels from SWIG wrappers.
>>>>
>>>> However, the current code DOES have code, by me, for setting
>>>> individual samples in spout, reading individual samples from spin,
>>>> and
>>>> accessing individual samples from numbered bus channels. This code
>>>> evidently compiles on all platforms since nobody has complained about
>>>> it, but it has not yet been tested (as far as I know).
>>>>
>>>> It might well work. Let us know what happens if you try it.
>>>>
>>>> Obviously, you would need a complete SWIG cleanup and rebuild to see
>>>> these functions in the wrappers. You can get the API docs just by
>>>> running doxygen in the Csound root directory.
>>>>
>>>> Regards,
>>>> Mike
>>>>
>>>> On Tue, Feb 9, 2010 at 1:14 PM, Victor Lazzarini
>>>>  wrote:
>>>>> But can you explain why there seem to have been a problem in doing
>>>>> this from
>>>>> Java?
>>>>>
>>>>> Victor
>>>>> On 9 Feb 2010, at 18:03, Michael Gogins wrote:
>>>>>
>>>>>> As a matter of fact, it is possible to access spout using the
>>>>>> existing
>>>>>> API, but it is not obvious or convenient.
>>>>>>
>>>>>> I have promised to implement convenient, obvious samplewise access
>>>>>> to
>>>>>> spin, spout, and numbered channels. I got distracted... I may
>>>>>> actually
>>>>>> have done this... I will check and see how far along I got, and
>>>>>> finish
>>>>>> the work if it needs to be finished.
>>>>>>
>>>>>> Regards,
>>>>>> Mike
>>>>>>
>>>>>> On Tue, Feb 9, 2010 at 12:57 PM, Victor Lazzarini
>>>>>>  wrote:
>>>>>>> Dear all,
>>>>>>>
>>>>>>> about half a year ago, there was some complaint that the access to
>>>>>>> spout/spin etc is not possible from a wrapped language. This
>>>>>>> seemed
>>>>>>> to
>>>>>>> have been demonstrated in Java.
>>>>>>>
>>>>>>> Now, I am not sure about the specific case of Java, but I knew
>>>>>>> this
>>>>>>> was possible in Python. At the time, I did not have the chance to
>>>>>>> test
>>>>>>> it and show how it's done. Mike Gogins offered to add API
>>>>>>> functions
>>>>>>> to
>>>>>>> facilitate this, but I had the impression this was not needed
>>>>>>> (although desirable).
>>>>>>>
>>>>>>> I just had some moments today to look into this question. Here's a
>>>>>>> script that demonstrates access to spout. I thought I'd post it
>>>>>>> here
>>>>>>> so it can be searched if anyone wants to attempt it.
>>>>>>>
>>>>>>> ======
>>>>>>> from csnd import *
>>>>>>> from pylab import *
>>>>>>>
>>>>>>> cs = Csound()
>>>>>>> res = cs.Compile("sine.csd", "-n")
>>>>>>> spoutlen = cs.GetKsmps()*cs.GetNchnls()
>>>>>>> spout = CsoundMYFLTArray();
>>>>>>> spout.SetPtr(cs.GetSpout())
>>>>>>>
>>>>>>> a = []
>>>>>>> while(res==0):
>>>>>>>  res = cs.PerformKsmps()
>>>>>>>  for i in range(0, spoutlen):
>>>>>>>        a.append(spout.GetValue(i))
>>>>>>>
>>>>>>> t = arange(len(a))
>>>>>>>
>>>>>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>>>>>> show()
>>>>>>>
>>>>>>> ========
>>>>>>> and we get a nice signal plot.
>>>>>>>
>>>>>>> Now why a similar code is not possible in Java escapes me.
>>>>>>>
>>>>>>> Regards
>>>>>>>
>>>>>>> Victor
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>>>> colocation
>>>>>>> Stay online with enterprise data centers and the best network in
>>>>>>> the business
>>>>>>> Choose flexible plans and management services without long-term
>>>>>>> contracts
>>>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>>>> call away.
>>>>>>> http://p.sf.net/sfu/theplanet-com
>>>>>>> _______________________________________________
>>>>>>> Csound-devel mailing list
>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Michael Gogins
>>>>>> Irreducible Productions
>>>>>> http://www.michael-gogins.com
>>>>>> Michael dot Gogins at gmail dot com
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>>> colocation
>>>>>> Stay online with enterprise data centers and the best network in
>>>>>> the
>>>>>> business
>>>>>> Choose flexible plans and management services without long-term
>>>>>> contracts
>>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>>> call
>>>>>> away.
>>>>>> http://p.sf.net/sfu/theplanet-com
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>>>> Stay online with enterprise data centers and the best network in
>>>>> the business
>>>>> Choose flexible plans and management services without long-term
>>>>> contracts
>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>> call away.
>>>>> http://p.sf.net/sfu/theplanet-com
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Michael Gogins
>>>> Irreducible Productions
>>>> http://www.michael-gogins.com
>>>> Michael dot Gogins at gmail dot com
>>>>
>>>> ------------------------------------------------------------------------------
>>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>>> Stay online with enterprise data centers and the best network in the
>>>> business
>>>> Choose flexible plans and management services without long-term
>>>> contracts
>>>> Personal 24x7 support from experience hosting pros just a phone call
>>>> away.
>>>> http://p.sf.net/sfu/theplanet-com
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>> DTrace,
>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>> http://p.sf.net/sfu/solaris-dev2dev
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>> http://p.sf.net/sfu/solaris-dev2dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-09 21:21
FromVictor Lazzarini
SubjectRe: [Cs-dev] accessing a channel using a wrapped language
I tested alright. Note this:

 >>> import csnd
 >>> a = csnd.CsoundMYFLTArray(10)
 >>> a.GetPtr()

 >>>

and

  PUBLIC int csoundGetChannelPtr(CSOUND *,
                                  MYFLT **p, const char *name, int  
type);

so, the two should go together alright. I'm not sure why the Java  
wrapper is different, since it comes from the same C (or C++) code.

Victor



On 9 Feb 2010, at 20:37, Michael Gogins wrote:

> Well, that's why I thought it didn't work.
>
> I wonder if Victor tested his example!
>
> It is quite possible that there is a significant difference between
> what the SWIG code generator does for Java and what it does for
> Python.
>
> In any event, the code should be easier to use, although perhaps not
> quite as efficient.
>
> Regards,
> Mike
>
> On Tue, Feb 9, 2010 at 3:28 PM, Steven Yi  wrote:
>> I just took a quick look, the CsoundMYFLTArray.getPtr() returns a
>> SWIGTYPE_P_P_double while csound.getChannelPtr() is expecting an arg
>> of SWIGTYPE_P_double.  Might be an difference between python and java
>> bindings.
>>
>> On Tue, Feb 9, 2010 at 3:18 PM, Victor Lazzarini
>>  wrote:
>>> Actually, it's possible to access "named" channels too, through
>>> Python. So it should be possible in Java too. Can't see what the  
>>> fuss
>>> was all about then, can you?
>>>
>>> Here's the code.
>>> =============
>>> from csnd import *
>>> from pylab import *
>>>
>>> cs = Csound()
>>> res = cs.Compile("sine.csd", "-n")
>>> ksmps = cs.GetKsmps()
>>> channel = CsoundMYFLTArray(ksmps);
>>>
>>> a = []
>>> while(res==0):
>>>   res = cs.PerformKsmps()
>>>   cs.GetChannelPtr(channel.GetPtr(), "out", CSOUND_AUDIO_CHANNEL |
>>> CSOUND_OUTPUT_CHANNEL)
>>>   for i in range(0, ksmps):
>>>         a.append(channel.GetValue(i))
>>>
>>> t = arange(len(a))
>>>
>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>> show()
>>> ===============================
>>>
>>> A similar code should be possible in Java.
>>>
>>> Victor
>>>
>>>
>>> On 9 Feb 2010, at 19:41, Victor Lazzarini wrote:
>>>
>>>> It seems possible to get a numbered channel (rather than a named  
>>>> one).
>>>> I''l prepare an example.
>>>>
>>>> Victor
>>>> On 9 Feb 2010, at 18:34, Michael Gogins wrote:
>>>>
>>>>> You could ready access spout from Java. Peter Brinkmann's jReality
>>>>> package has code for doing it that he developed with my help.  
>>>>> But you
>>>>> couldn't (as far as I know) access bus channels from SWIG  
>>>>> wrappers.
>>>>>
>>>>> However, the current code DOES have code, by me, for setting
>>>>> individual samples in spout, reading individual samples from spin,
>>>>> and
>>>>> accessing individual samples from numbered bus channels. This code
>>>>> evidently compiles on all platforms since nobody has complained  
>>>>> about
>>>>> it, but it has not yet been tested (as far as I know).
>>>>>
>>>>> It might well work. Let us know what happens if you try it.
>>>>>
>>>>> Obviously, you would need a complete SWIG cleanup and rebuild to  
>>>>> see
>>>>> these functions in the wrappers. You can get the API docs just by
>>>>> running doxygen in the Csound root directory.
>>>>>
>>>>> Regards,
>>>>> Mike
>>>>>
>>>>> On Tue, Feb 9, 2010 at 1:14 PM, Victor Lazzarini
>>>>>  wrote:
>>>>>> But can you explain why there seem to have been a problem in  
>>>>>> doing
>>>>>> this from
>>>>>> Java?
>>>>>>
>>>>>> Victor
>>>>>> On 9 Feb 2010, at 18:03, Michael Gogins wrote:
>>>>>>
>>>>>>> As a matter of fact, it is possible to access spout using the
>>>>>>> existing
>>>>>>> API, but it is not obvious or convenient.
>>>>>>>
>>>>>>> I have promised to implement convenient, obvious samplewise  
>>>>>>> access
>>>>>>> to
>>>>>>> spin, spout, and numbered channels. I got distracted... I may
>>>>>>> actually
>>>>>>> have done this... I will check and see how far along I got, and
>>>>>>> finish
>>>>>>> the work if it needs to be finished.
>>>>>>>
>>>>>>> Regards,
>>>>>>> Mike
>>>>>>>
>>>>>>> On Tue, Feb 9, 2010 at 12:57 PM, Victor Lazzarini
>>>>>>>  wrote:
>>>>>>>> Dear all,
>>>>>>>>
>>>>>>>> about half a year ago, there was some complaint that the  
>>>>>>>> access to
>>>>>>>> spout/spin etc is not possible from a wrapped language. This
>>>>>>>> seemed
>>>>>>>> to
>>>>>>>> have been demonstrated in Java.
>>>>>>>>
>>>>>>>> Now, I am not sure about the specific case of Java, but I knew
>>>>>>>> this
>>>>>>>> was possible in Python. At the time, I did not have the  
>>>>>>>> chance to
>>>>>>>> test
>>>>>>>> it and show how it's done. Mike Gogins offered to add API
>>>>>>>> functions
>>>>>>>> to
>>>>>>>> facilitate this, but I had the impression this was not needed
>>>>>>>> (although desirable).
>>>>>>>>
>>>>>>>> I just had some moments today to look into this question.  
>>>>>>>> Here's a
>>>>>>>> script that demonstrates access to spout. I thought I'd post it
>>>>>>>> here
>>>>>>>> so it can be searched if anyone wants to attempt it.
>>>>>>>>
>>>>>>>> ======
>>>>>>>> from csnd import *
>>>>>>>> from pylab import *
>>>>>>>>
>>>>>>>> cs = Csound()
>>>>>>>> res = cs.Compile("sine.csd", "-n")
>>>>>>>> spoutlen = cs.GetKsmps()*cs.GetNchnls()
>>>>>>>> spout = CsoundMYFLTArray();
>>>>>>>> spout.SetPtr(cs.GetSpout())
>>>>>>>>
>>>>>>>> a = []
>>>>>>>> while(res==0):
>>>>>>>>  res = cs.PerformKsmps()
>>>>>>>>  for i in range(0, spoutlen):
>>>>>>>>        a.append(spout.GetValue(i))
>>>>>>>>
>>>>>>>> t = arange(len(a))
>>>>>>>>
>>>>>>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>>>>>>> show()
>>>>>>>>
>>>>>>>> ========
>>>>>>>> and we get a nice signal plot.
>>>>>>>>
>>>>>>>> Now why a similar code is not possible in Java escapes me.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>>
>>>>>>>> Victor
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>>>>> colocation
>>>>>>>> Stay online with enterprise data centers and the best network  
>>>>>>>> in
>>>>>>>> the business
>>>>>>>> Choose flexible plans and management services without long-term
>>>>>>>> contracts
>>>>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>>>>> call away.
>>>>>>>> http://p.sf.net/sfu/theplanet-com
>>>>>>>> _______________________________________________
>>>>>>>> Csound-devel mailing list
>>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Michael Gogins
>>>>>>> Irreducible Productions
>>>>>>> http://www.michael-gogins.com
>>>>>>> Michael dot Gogins at gmail dot com
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>>>> colocation
>>>>>>> Stay online with enterprise data centers and the best network in
>>>>>>> the
>>>>>>> business
>>>>>>> Choose flexible plans and management services without long-term
>>>>>>> contracts
>>>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>>>> call
>>>>>>> away.
>>>>>>> http://p.sf.net/sfu/theplanet-com
>>>>>>> _______________________________________________
>>>>>>> Csound-devel mailing list
>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> The Planet: dedicated and managed hosting, cloud storage,  
>>>>>> colocation
>>>>>> Stay online with enterprise data centers and the best network in
>>>>>> the business
>>>>>> Choose flexible plans and management services without long-term
>>>>>> contracts
>>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>>> call away.
>>>>>> http://p.sf.net/sfu/theplanet-com
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Michael Gogins
>>>>> Irreducible Productions
>>>>> http://www.michael-gogins.com
>>>>> Michael dot Gogins at gmail dot com
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> The Planet: dedicated and managed hosting, cloud storage,  
>>>>> colocation
>>>>> Stay online with enterprise data centers and the best network in  
>>>>> the
>>>>> business
>>>>> Choose flexible plans and management services without long-term
>>>>> contracts
>>>>> Personal 24x7 support from experience hosting pros just a phone  
>>>>> call
>>>>> away.
>>>>> http://p.sf.net/sfu/theplanet-com
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>>> DTrace,
>>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>>> http://p.sf.net/sfu/solaris-dev2dev
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> SOLARIS 10 is the OS for Data Centers - provides features such as  
>>> DTrace,
>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>> http://p.sf.net/sfu/solaris-dev2dev
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>
>> ------------------------------------------------------------------------------
>> SOLARIS 10 is the OS for Data Centers - provides features such as  
>> DTrace,
>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>> http://p.sf.net/sfu/solaris-dev2dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
>
> -- 
> Michael Gogins
> Irreducible Productions
> http://www.michael-gogins.com
> Michael dot Gogins at gmail dot com
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as  
> DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-09 21:31
FromVictor Lazzarini
SubjectRe: [Cs-dev] accessing a channel using a wrapped language
But, the Csound class has a different definition:

  virtual int GetChannelPtr(MYFLT* &p, const char *name, int type)
   {
     MYFLT *tmp;
     int   retval;
     retval = csoundGetChannelPtr(csound, &tmp, name, type);
     p = tmp;
     return retval;
   }

using a reference. I guess it becomes a MYFLT ** in Python, but not
in Java.

Is there a csoundGetChannelPtr() function in the Java wrapper? That  
should
match.

Another solution, easier; use floatArray or doubleArray

 >>> a = csnd.floatArray(10)
 >>> a.cast()


This should do the trick.

Victor



On 9 Feb 2010, at 21:21, Victor Lazzarini wrote:

> I tested alright. Note this:
>
>>>> import csnd
>>>> a = csnd.CsoundMYFLTArray(10)
>>>> a.GetPtr()
> 
>>>>
>
> and
>
>  PUBLIC int csoundGetChannelPtr(CSOUND *,
>                                  MYFLT **p, const char *name, int
> type);
>
> so, the two should go together alright. I'm not sure why the Java
> wrapper is different, since it comes from the same C (or C++) code.
>
> Victor
>
>
>
> On 9 Feb 2010, at 20:37, Michael Gogins wrote:
>
>> Well, that's why I thought it didn't work.
>>
>> I wonder if Victor tested his example!
>>
>> It is quite possible that there is a significant difference between
>> what the SWIG code generator does for Java and what it does for
>> Python.
>>
>> In any event, the code should be easier to use, although perhaps not
>> quite as efficient.
>>
>> Regards,
>> Mike
>>
>> On Tue, Feb 9, 2010 at 3:28 PM, Steven Yi  wrote:
>>> I just took a quick look, the CsoundMYFLTArray.getPtr() returns a
>>> SWIGTYPE_P_P_double while csound.getChannelPtr() is expecting an arg
>>> of SWIGTYPE_P_double.  Might be an difference between python and  
>>> java
>>> bindings.
>>>
>>> On Tue, Feb 9, 2010 at 3:18 PM, Victor Lazzarini
>>>  wrote:
>>>> Actually, it's possible to access "named" channels too, through
>>>> Python. So it should be possible in Java too. Can't see what the
>>>> fuss
>>>> was all about then, can you?
>>>>
>>>> Here's the code.
>>>> =============
>>>> from csnd import *
>>>> from pylab import *
>>>>
>>>> cs = Csound()
>>>> res = cs.Compile("sine.csd", "-n")
>>>> ksmps = cs.GetKsmps()
>>>> channel = CsoundMYFLTArray(ksmps);
>>>>
>>>> a = []
>>>> while(res==0):
>>>>  res = cs.PerformKsmps()
>>>>  cs.GetChannelPtr(channel.GetPtr(), "out", CSOUND_AUDIO_CHANNEL |
>>>> CSOUND_OUTPUT_CHANNEL)
>>>>  for i in range(0, ksmps):
>>>>        a.append(channel.GetValue(i))
>>>>
>>>> t = arange(len(a))
>>>>
>>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>>> show()
>>>> ===============================
>>>>
>>>> A similar code should be possible in Java.
>>>>
>>>> Victor
>>>>
>>>>
>>>> On 9 Feb 2010, at 19:41, Victor Lazzarini wrote:
>>>>
>>>>> It seems possible to get a numbered channel (rather than a named
>>>>> one).
>>>>> I''l prepare an example.
>>>>>
>>>>> Victor
>>>>> On 9 Feb 2010, at 18:34, Michael Gogins wrote:
>>>>>
>>>>>> You could ready access spout from Java. Peter Brinkmann's  
>>>>>> jReality
>>>>>> package has code for doing it that he developed with my help.
>>>>>> But you
>>>>>> couldn't (as far as I know) access bus channels from SWIG
>>>>>> wrappers.
>>>>>>
>>>>>> However, the current code DOES have code, by me, for setting
>>>>>> individual samples in spout, reading individual samples from  
>>>>>> spin,
>>>>>> and
>>>>>> accessing individual samples from numbered bus channels. This  
>>>>>> code
>>>>>> evidently compiles on all platforms since nobody has complained
>>>>>> about
>>>>>> it, but it has not yet been tested (as far as I know).
>>>>>>
>>>>>> It might well work. Let us know what happens if you try it.
>>>>>>
>>>>>> Obviously, you would need a complete SWIG cleanup and rebuild to
>>>>>> see
>>>>>> these functions in the wrappers. You can get the API docs just by
>>>>>> running doxygen in the Csound root directory.
>>>>>>
>>>>>> Regards,
>>>>>> Mike
>>>>>>
>>>>>> On Tue, Feb 9, 2010 at 1:14 PM, Victor Lazzarini
>>>>>>  wrote:
>>>>>>> But can you explain why there seem to have been a problem in
>>>>>>> doing
>>>>>>> this from
>>>>>>> Java?
>>>>>>>
>>>>>>> Victor
>>>>>>> On 9 Feb 2010, at 18:03, Michael Gogins wrote:
>>>>>>>
>>>>>>>> As a matter of fact, it is possible to access spout using the
>>>>>>>> existing
>>>>>>>> API, but it is not obvious or convenient.
>>>>>>>>
>>>>>>>> I have promised to implement convenient, obvious samplewise
>>>>>>>> access
>>>>>>>> to
>>>>>>>> spin, spout, and numbered channels. I got distracted... I may
>>>>>>>> actually
>>>>>>>> have done this... I will check and see how far along I got, and
>>>>>>>> finish
>>>>>>>> the work if it needs to be finished.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Mike
>>>>>>>>
>>>>>>>> On Tue, Feb 9, 2010 at 12:57 PM, Victor Lazzarini
>>>>>>>>  wrote:
>>>>>>>>> Dear all,
>>>>>>>>>
>>>>>>>>> about half a year ago, there was some complaint that the
>>>>>>>>> access to
>>>>>>>>> spout/spin etc is not possible from a wrapped language. This
>>>>>>>>> seemed
>>>>>>>>> to
>>>>>>>>> have been demonstrated in Java.
>>>>>>>>>
>>>>>>>>> Now, I am not sure about the specific case of Java, but I knew
>>>>>>>>> this
>>>>>>>>> was possible in Python. At the time, I did not have the
>>>>>>>>> chance to
>>>>>>>>> test
>>>>>>>>> it and show how it's done. Mike Gogins offered to add API
>>>>>>>>> functions
>>>>>>>>> to
>>>>>>>>> facilitate this, but I had the impression this was not needed
>>>>>>>>> (although desirable).
>>>>>>>>>
>>>>>>>>> I just had some moments today to look into this question.
>>>>>>>>> Here's a
>>>>>>>>> script that demonstrates access to spout. I thought I'd post  
>>>>>>>>> it
>>>>>>>>> here
>>>>>>>>> so it can be searched if anyone wants to attempt it.
>>>>>>>>>
>>>>>>>>> ======
>>>>>>>>> from csnd import *
>>>>>>>>> from pylab import *
>>>>>>>>>
>>>>>>>>> cs = Csound()
>>>>>>>>> res = cs.Compile("sine.csd", "-n")
>>>>>>>>> spoutlen = cs.GetKsmps()*cs.GetNchnls()
>>>>>>>>> spout = CsoundMYFLTArray();
>>>>>>>>> spout.SetPtr(cs.GetSpout())
>>>>>>>>>
>>>>>>>>> a = []
>>>>>>>>> while(res==0):
>>>>>>>>> res = cs.PerformKsmps()
>>>>>>>>> for i in range(0, spoutlen):
>>>>>>>>>       a.append(spout.GetValue(i))
>>>>>>>>>
>>>>>>>>> t = arange(len(a))
>>>>>>>>>
>>>>>>>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>>>>>>>> show()
>>>>>>>>>
>>>>>>>>> ========
>>>>>>>>> and we get a nice signal plot.
>>>>>>>>>
>>>>>>>>> Now why a similar code is not possible in Java escapes me.
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>>
>>>>>>>>> Victor
>>>>>>>>>
>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>>>>>> colocation
>>>>>>>>> Stay online with enterprise data centers and the best network
>>>>>>>>> in
>>>>>>>>> the business
>>>>>>>>> Choose flexible plans and management services without long- 
>>>>>>>>> term
>>>>>>>>> contracts
>>>>>>>>> Personal 24x7 support from experience hosting pros just a  
>>>>>>>>> phone
>>>>>>>>> call away.
>>>>>>>>> http://p.sf.net/sfu/theplanet-com
>>>>>>>>> _______________________________________________
>>>>>>>>> Csound-devel mailing list
>>>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Michael Gogins
>>>>>>>> Irreducible Productions
>>>>>>>> http://www.michael-gogins.com
>>>>>>>> Michael dot Gogins at gmail dot com
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>>>>> colocation
>>>>>>>> Stay online with enterprise data centers and the best network  
>>>>>>>> in
>>>>>>>> the
>>>>>>>> business
>>>>>>>> Choose flexible plans and management services without long-term
>>>>>>>> contracts
>>>>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>>>>> call
>>>>>>>> away.
>>>>>>>> http://p.sf.net/sfu/theplanet-com
>>>>>>>> _______________________________________________
>>>>>>>> Csound-devel mailing list
>>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>>>> colocation
>>>>>>> Stay online with enterprise data centers and the best network in
>>>>>>> the business
>>>>>>> Choose flexible plans and management services without long-term
>>>>>>> contracts
>>>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>>>> call away.
>>>>>>> http://p.sf.net/sfu/theplanet-com
>>>>>>> _______________________________________________
>>>>>>> Csound-devel mailing list
>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Michael Gogins
>>>>>> Irreducible Productions
>>>>>> http://www.michael-gogins.com
>>>>>> Michael dot Gogins at gmail dot com
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>>> colocation
>>>>>> Stay online with enterprise data centers and the best network in
>>>>>> the
>>>>>> business
>>>>>> Choose flexible plans and management services without long-term
>>>>>> contracts
>>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>>> call
>>>>>> away.
>>>>>> http://p.sf.net/sfu/theplanet-com
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>>>> DTrace,
>>>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>>>> http://p.sf.net/sfu/solaris-dev2dev
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>>> DTrace,
>>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>>> http://p.sf.net/sfu/solaris-dev2dev
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>> ------------------------------------------------------------------------------
>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>> DTrace,
>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>> http://p.sf.net/sfu/solaris-dev2dev
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>
>>
>>
>> -- 
>> Michael Gogins
>> Irreducible Productions
>> http://www.michael-gogins.com
>> Michael dot Gogins at gmail dot com
>>
>> ------------------------------------------------------------------------------
>> SOLARIS 10 is the OS for Data Centers - provides features such as
>> DTrace,
>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>> http://p.sf.net/sfu/solaris-dev2dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as  
> DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-09 21:45
FromSteven Yi
SubjectRe: [Cs-dev] accessing a channel using a wrapped language
I found csnd.csnd.csoundGetChannelPtr() and it looks like it will take
in a double pointer. I had only looked at the Csound class up until
now. It looks like you can use it by doing:

csnd.csnd.csoundGetChannelPtr(csound.getCsound(), channel.getPtr(), ...);

where csound is a Csound object.  I haven't tried it, but my guess is
that it should work. Nice find!

This looks like a viable workaround, though it would be nice to find a
way to get it working with the Csound object too.

On Tue, Feb 9, 2010 at 4:31 PM, Victor Lazzarini
 wrote:
> But, the Csound class has a different definition:
>
>  virtual int GetChannelPtr(MYFLT* &p, const char *name, int type)
>   {
>     MYFLT *tmp;
>     int   retval;
>     retval = csoundGetChannelPtr(csound, &tmp, name, type);
>     p = tmp;
>     return retval;
>   }
>
> using a reference. I guess it becomes a MYFLT ** in Python, but not
> in Java.
>
> Is there a csoundGetChannelPtr() function in the Java wrapper? That
> should
> match.
>
> Another solution, easier; use floatArray or doubleArray
>
>  >>> a = csnd.floatArray(10)
>  >>> a.cast()
> 
>
> This should do the trick.
>
> Victor
>
>
>
> On 9 Feb 2010, at 21:21, Victor Lazzarini wrote:
>
>> I tested alright. Note this:
>>
>>>>> import csnd
>>>>> a = csnd.CsoundMYFLTArray(10)
>>>>> a.GetPtr()
>> 
>>>>>
>>
>> and
>>
>>  PUBLIC int csoundGetChannelPtr(CSOUND *,
>>                                  MYFLT **p, const char *name, int
>> type);
>>
>> so, the two should go together alright. I'm not sure why the Java
>> wrapper is different, since it comes from the same C (or C++) code.
>>
>> Victor
>>
>>
>>
>> On 9 Feb 2010, at 20:37, Michael Gogins wrote:
>>
>>> Well, that's why I thought it didn't work.
>>>
>>> I wonder if Victor tested his example!
>>>
>>> It is quite possible that there is a significant difference between
>>> what the SWIG code generator does for Java and what it does for
>>> Python.
>>>
>>> In any event, the code should be easier to use, although perhaps not
>>> quite as efficient.
>>>
>>> Regards,
>>> Mike
>>>
>>> On Tue, Feb 9, 2010 at 3:28 PM, Steven Yi  wrote:
>>>> I just took a quick look, the CsoundMYFLTArray.getPtr() returns a
>>>> SWIGTYPE_P_P_double while csound.getChannelPtr() is expecting an arg
>>>> of SWIGTYPE_P_double.  Might be an difference between python and
>>>> java
>>>> bindings.
>>>>
>>>> On Tue, Feb 9, 2010 at 3:18 PM, Victor Lazzarini
>>>>  wrote:
>>>>> Actually, it's possible to access "named" channels too, through
>>>>> Python. So it should be possible in Java too. Can't see what the
>>>>> fuss
>>>>> was all about then, can you?
>>>>>
>>>>> Here's the code.
>>>>> =============
>>>>> from csnd import *
>>>>> from pylab import *
>>>>>
>>>>> cs = Csound()
>>>>> res = cs.Compile("sine.csd", "-n")
>>>>> ksmps = cs.GetKsmps()
>>>>> channel = CsoundMYFLTArray(ksmps);
>>>>>
>>>>> a = []
>>>>> while(res==0):
>>>>>  res = cs.PerformKsmps()
>>>>>  cs.GetChannelPtr(channel.GetPtr(), "out", CSOUND_AUDIO_CHANNEL |
>>>>> CSOUND_OUTPUT_CHANNEL)
>>>>>  for i in range(0, ksmps):
>>>>>        a.append(channel.GetValue(i))
>>>>>
>>>>> t = arange(len(a))
>>>>>
>>>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>>>> show()
>>>>> ===============================
>>>>>
>>>>> A similar code should be possible in Java.
>>>>>
>>>>> Victor
>>>>>
>>>>>
>>>>> On 9 Feb 2010, at 19:41, Victor Lazzarini wrote:
>>>>>
>>>>>> It seems possible to get a numbered channel (rather than a named
>>>>>> one).
>>>>>> I''l prepare an example.
>>>>>>
>>>>>> Victor
>>>>>> On 9 Feb 2010, at 18:34, Michael Gogins wrote:
>>>>>>
>>>>>>> You could ready access spout from Java. Peter Brinkmann's
>>>>>>> jReality
>>>>>>> package has code for doing it that he developed with my help.
>>>>>>> But you
>>>>>>> couldn't (as far as I know) access bus channels from SWIG
>>>>>>> wrappers.
>>>>>>>
>>>>>>> However, the current code DOES have code, by me, for setting
>>>>>>> individual samples in spout, reading individual samples from
>>>>>>> spin,
>>>>>>> and
>>>>>>> accessing individual samples from numbered bus channels. This
>>>>>>> code
>>>>>>> evidently compiles on all platforms since nobody has complained
>>>>>>> about
>>>>>>> it, but it has not yet been tested (as far as I know).
>>>>>>>
>>>>>>> It might well work. Let us know what happens if you try it.
>>>>>>>
>>>>>>> Obviously, you would need a complete SWIG cleanup and rebuild to
>>>>>>> see
>>>>>>> these functions in the wrappers. You can get the API docs just by
>>>>>>> running doxygen in the Csound root directory.
>>>>>>>
>>>>>>> Regards,
>>>>>>> Mike
>>>>>>>
>>>>>>> On Tue, Feb 9, 2010 at 1:14 PM, Victor Lazzarini
>>>>>>>  wrote:
>>>>>>>> But can you explain why there seem to have been a problem in
>>>>>>>> doing
>>>>>>>> this from
>>>>>>>> Java?
>>>>>>>>
>>>>>>>> Victor
>>>>>>>> On 9 Feb 2010, at 18:03, Michael Gogins wrote:
>>>>>>>>
>>>>>>>>> As a matter of fact, it is possible to access spout using the
>>>>>>>>> existing
>>>>>>>>> API, but it is not obvious or convenient.
>>>>>>>>>
>>>>>>>>> I have promised to implement convenient, obvious samplewise
>>>>>>>>> access
>>>>>>>>> to
>>>>>>>>> spin, spout, and numbered channels. I got distracted... I may
>>>>>>>>> actually
>>>>>>>>> have done this... I will check and see how far along I got, and
>>>>>>>>> finish
>>>>>>>>> the work if it needs to be finished.
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> Mike
>>>>>>>>>
>>>>>>>>> On Tue, Feb 9, 2010 at 12:57 PM, Victor Lazzarini
>>>>>>>>>  wrote:
>>>>>>>>>> Dear all,
>>>>>>>>>>
>>>>>>>>>> about half a year ago, there was some complaint that the
>>>>>>>>>> access to
>>>>>>>>>> spout/spin etc is not possible from a wrapped language. This
>>>>>>>>>> seemed
>>>>>>>>>> to
>>>>>>>>>> have been demonstrated in Java.
>>>>>>>>>>
>>>>>>>>>> Now, I am not sure about the specific case of Java, but I knew
>>>>>>>>>> this
>>>>>>>>>> was possible in Python. At the time, I did not have the
>>>>>>>>>> chance to
>>>>>>>>>> test
>>>>>>>>>> it and show how it's done. Mike Gogins offered to add API
>>>>>>>>>> functions
>>>>>>>>>> to
>>>>>>>>>> facilitate this, but I had the impression this was not needed
>>>>>>>>>> (although desirable).
>>>>>>>>>>
>>>>>>>>>> I just had some moments today to look into this question.
>>>>>>>>>> Here's a
>>>>>>>>>> script that demonstrates access to spout. I thought I'd post
>>>>>>>>>> it
>>>>>>>>>> here
>>>>>>>>>> so it can be searched if anyone wants to attempt it.
>>>>>>>>>>
>>>>>>>>>> ======
>>>>>>>>>> from csnd import *
>>>>>>>>>> from pylab import *
>>>>>>>>>>
>>>>>>>>>> cs = Csound()
>>>>>>>>>> res = cs.Compile("sine.csd", "-n")
>>>>>>>>>> spoutlen = cs.GetKsmps()*cs.GetNchnls()
>>>>>>>>>> spout = CsoundMYFLTArray();
>>>>>>>>>> spout.SetPtr(cs.GetSpout())
>>>>>>>>>>
>>>>>>>>>> a = []
>>>>>>>>>> while(res==0):
>>>>>>>>>> res = cs.PerformKsmps()
>>>>>>>>>> for i in range(0, spoutlen):
>>>>>>>>>>       a.append(spout.GetValue(i))
>>>>>>>>>>
>>>>>>>>>> t = arange(len(a))
>>>>>>>>>>
>>>>>>>>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>>>>>>>>> show()
>>>>>>>>>>
>>>>>>>>>> ========
>>>>>>>>>> and we get a nice signal plot.
>>>>>>>>>>
>>>>>>>>>> Now why a similar code is not possible in Java escapes me.
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>>
>>>>>>>>>> Victor
>>>>>>>>>>
>>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>>>>>>> colocation
>>>>>>>>>> Stay online with enterprise data centers and the best network
>>>>>>>>>> in
>>>>>>>>>> the business
>>>>>>>>>> Choose flexible plans and management services without long-
>>>>>>>>>> term
>>>>>>>>>> contracts
>>>>>>>>>> Personal 24x7 support from experience hosting pros just a
>>>>>>>>>> phone
>>>>>>>>>> call away.
>>>>>>>>>> http://p.sf.net/sfu/theplanet-com
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Csound-devel mailing list
>>>>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Michael Gogins
>>>>>>>>> Irreducible Productions
>>>>>>>>> http://www.michael-gogins.com
>>>>>>>>> Michael dot Gogins at gmail dot com
>>>>>>>>>
>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>>>>>> colocation
>>>>>>>>> Stay online with enterprise data centers and the best network
>>>>>>>>> in
>>>>>>>>> the
>>>>>>>>> business
>>>>>>>>> Choose flexible plans and management services without long-term
>>>>>>>>> contracts
>>>>>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>>>>>> call
>>>>>>>>> away.
>>>>>>>>> http://p.sf.net/sfu/theplanet-com
>>>>>>>>> _______________________________________________
>>>>>>>>> Csound-devel mailing list
>>>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>>>
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>>>>> colocation
>>>>>>>> Stay online with enterprise data centers and the best network in
>>>>>>>> the business
>>>>>>>> Choose flexible plans and management services without long-term
>>>>>>>> contracts
>>>>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>>>>> call away.
>>>>>>>> http://p.sf.net/sfu/theplanet-com
>>>>>>>> _______________________________________________
>>>>>>>> Csound-devel mailing list
>>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Michael Gogins
>>>>>>> Irreducible Productions
>>>>>>> http://www.michael-gogins.com
>>>>>>> Michael dot Gogins at gmail dot com
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> The Planet: dedicated and managed hosting, cloud storage,
>>>>>>> colocation
>>>>>>> Stay online with enterprise data centers and the best network in
>>>>>>> the
>>>>>>> business
>>>>>>> Choose flexible plans and management services without long-term
>>>>>>> contracts
>>>>>>> Personal 24x7 support from experience hosting pros just a phone
>>>>>>> call
>>>>>>> away.
>>>>>>> http://p.sf.net/sfu/theplanet-com
>>>>>>> _______________________________________________
>>>>>>> Csound-devel mailing list
>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>>>>> DTrace,
>>>>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>>>>> http://p.sf.net/sfu/solaris-dev2dev
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>>>> DTrace,
>>>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>>>> http://p.sf.net/sfu/solaris-dev2dev
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>>> DTrace,
>>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>>> http://p.sf.net/sfu/solaris-dev2dev
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>>
>>>
>>> --
>>> Michael Gogins
>>> Irreducible Productions
>>> http://www.michael-gogins.com
>>> Michael dot Gogins at gmail dot com
>>>
>>> ------------------------------------------------------------------------------
>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>> DTrace,
>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>> http://p.sf.net/sfu/solaris-dev2dev
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> SOLARIS 10 is the OS for Data Centers - provides features such as
>> DTrace,
>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>> http://p.sf.net/sfu/solaris-dev2dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-10 17:33
Fromjpff
SubjectRe: [Cs-dev] accessing spout etc from a wrapper
> It seems possible to get a numbered channel (rather than a named one).
> I'll prepare an example.

I look forward to it!  I have been failing to manage this for over a
year now.
  I do not write Java but the Agent platforms are in Java
==John ffitch

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-10 18:11
FromVictor Lazzarini
SubjectRe: [Cs-dev] accessing spout etc from a wrapper
Well, here it is again, if you missed it. It's Python, but should be  
easily transfered to Java
(by someone who knows what he is doing, I don't). The pylab bit is  
just there to show it works.

from csnd import *
from pylab import *

cs = Csound()
res = cs.Compile("sine.csd", "-n")
ksmps = cs.GetKsmps()
channel = floatArray(ksmps);

a = []
while(res==0):
   res = cs.PerformKsmps()
   cs.ChanOAGet(channel.cast(), 0)
   for i in range(0, ksmps):
         a.append(channel[i])

t = arange(len(a))

plot(t[0:100]/cs.GetSr(), a[0:100])
show()
==========================================
In addition the numbered bus channels have some other means to access  
then (they must be new, I only noticed them yesterday)

   PUBLIC MYFLT csoundChanOAGetSample(CSOUND *, int channel, int frame);

(I guess this is Mike Gogins' work?) They are not yet added to the  
Csound class, so are only available through the C API wrappers.

Victor










On 10 Feb 2010, at 17:33, jpff wrote:

>> It seems possible to get a numbered channel (rather than a named  
>> one).
>> I'll prepare an example.
>
> I look forward to it!  I have been failing to manage this for over a
> year now.
>  I do not write Java but the Agent platforms are in Java
> ==John ffitch
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as  
> DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-10 18:40
From"Dr. Richard Boulanger"
SubjectRe: [Cs-dev] accessing spout etc from a wrapper
it's really great Victor!  Wow, the implications are huge.

-dB

On Feb 10, 2010, at 1:11 PM, Victor Lazzarini wrote:

> Well, here it is again, if you missed it. It's Python, but should be
> easily transfered to Java
> (by someone who knows what he is doing, I don't). The pylab bit is
> just there to show it works.
>
> from csnd import *
> from pylab import *
>
> cs = Csound()
> res = cs.Compile("sine.csd", "-n")
> ksmps = cs.GetKsmps()
> channel = floatArray(ksmps);
>
> a = []
> while(res==0):
>   res = cs.PerformKsmps()
>   cs.ChanOAGet(channel.cast(), 0)
>   for i in range(0, ksmps):
>         a.append(channel[i])
>
> t = arange(len(a))
>
> plot(t[0:100]/cs.GetSr(), a[0:100])
> show()
> ==========================================
> In addition the numbered bus channels have some other means to access
> then (they must be new, I only noticed them yesterday)
>
>   PUBLIC MYFLT csoundChanOAGetSample(CSOUND *, int channel, int  
> frame);
>
> (I guess this is Mike Gogins' work?) They are not yet added to the
> Csound class, so are only available through the C API wrappers.
>
> Victor
>
>
>
>
>
>
>
>
>
>
> On 10 Feb 2010, at 17:33, jpff wrote:
>
>>> It seems possible to get a numbered channel (rather than a named
>>> one).
>>> I'll prepare an example.
>>
>> I look forward to it!  I have been failing to manage this for over a
>> year now.
>> I do not write Java but the Agent platforms are in Java
>> ==John ffitch
>>
>> ------------------------------------------------------------------------------
>> SOLARIS 10 is the OS for Data Centers - provides features such as
>> DTrace,
>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>> http://p.sf.net/sfu/solaris-dev2dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as  
> DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-10 21:07
FromMichael Gogins
SubjectRe: [Cs-dev] accessing spout etc from a wrapper
Yes, what I missed to get this to work was the .cast() calls. Thanks!

I will add the missing stuff for my new simpler way of doing
samplewise access to the Csound class, also, so they will show up in
the wrappers.

Regards,
Mike

On Wed, Feb 10, 2010 at 1:40 PM, Dr. Richard Boulanger
 wrote:
> it's really great Victor!  Wow, the implications are huge.
>
> -dB
>
> On Feb 10, 2010, at 1:11 PM, Victor Lazzarini wrote:
>
>> Well, here it is again, if you missed it. It's Python, but should be
>> easily transfered to Java
>> (by someone who knows what he is doing, I don't). The pylab bit is
>> just there to show it works.
>>
>> from csnd import *
>> from pylab import *
>>
>> cs = Csound()
>> res = cs.Compile("sine.csd", "-n")
>> ksmps = cs.GetKsmps()
>> channel = floatArray(ksmps);
>>
>> a = []
>> while(res==0):
>>   res = cs.PerformKsmps()
>>   cs.ChanOAGet(channel.cast(), 0)
>>   for i in range(0, ksmps):
>>         a.append(channel[i])
>>
>> t = arange(len(a))
>>
>> plot(t[0:100]/cs.GetSr(), a[0:100])
>> show()
>> ==========================================
>> In addition the numbered bus channels have some other means to access
>> then (they must be new, I only noticed them yesterday)
>>
>>   PUBLIC MYFLT csoundChanOAGetSample(CSOUND *, int channel, int
>> frame);
>>
>> (I guess this is Mike Gogins' work?) They are not yet added to the
>> Csound class, so are only available through the C API wrappers.
>>
>> Victor
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On 10 Feb 2010, at 17:33, jpff wrote:
>>
>>>> It seems possible to get a numbered channel (rather than a named
>>>> one).
>>>> I'll prepare an example.
>>>
>>> I look forward to it!  I have been failing to manage this for over a
>>> year now.
>>> I do not write Java but the Agent platforms are in Java
>>> ==John ffitch
>>>
>>> ------------------------------------------------------------------------------
>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>> DTrace,
>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>> http://p.sf.net/sfu/solaris-dev2dev
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> SOLARIS 10 is the OS for Data Centers - provides features such as
>> DTrace,
>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>> http://p.sf.net/sfu/solaris-dev2dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-10 21:17
FromVictor Lazzarini
SubjectRe: [Cs-dev] accessing spout etc from a wrapper
Thanks, that'll be nice.
I also want to see about adding 'native' support for Numpy arrays for  
the Python wrapper, which would make plotting and general manipulation  
of Csound output in scipy, pylab more efficient. It proves very useful  
in my sound synthesis research.

Regards

Victor

On 10 Feb 2010, at 21:07, Michael Gogins wrote:

> Yes, what I missed to get this to work was the .cast() calls. Thanks!
>
> I will add the missing stuff for my new simpler way of doing
> samplewise access to the Csound class, also, so they will show up in
> the wrappers.
>
> Regards,
> Mike
>
> On Wed, Feb 10, 2010 at 1:40 PM, Dr. Richard Boulanger
>  wrote:
>> it's really great Victor!  Wow, the implications are huge.
>>
>> -dB
>>
>> On Feb 10, 2010, at 1:11 PM, Victor Lazzarini wrote:
>>
>>> Well, here it is again, if you missed it. It's Python, but should be
>>> easily transfered to Java
>>> (by someone who knows what he is doing, I don't). The pylab bit is
>>> just there to show it works.
>>>
>>> from csnd import *
>>> from pylab import *
>>>
>>> cs = Csound()
>>> res = cs.Compile("sine.csd", "-n")
>>> ksmps = cs.GetKsmps()
>>> channel = floatArray(ksmps);
>>>
>>> a = []
>>> while(res==0):
>>>   res = cs.PerformKsmps()
>>>   cs.ChanOAGet(channel.cast(), 0)
>>>   for i in range(0, ksmps):
>>>         a.append(channel[i])
>>>
>>> t = arange(len(a))
>>>
>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>> show()
>>> ==========================================
>>> In addition the numbered bus channels have some other means to  
>>> access
>>> then (they must be new, I only noticed them yesterday)
>>>
>>>   PUBLIC MYFLT csoundChanOAGetSample(CSOUND *, int channel, int
>>> frame);
>>>
>>> (I guess this is Mike Gogins' work?) They are not yet added to the
>>> Csound class, so are only available through the C API wrappers.
>>>
>>> Victor
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On 10 Feb 2010, at 17:33, jpff wrote:
>>>
>>>>> It seems possible to get a numbered channel (rather than a named
>>>>> one).
>>>>> I'll prepare an example.
>>>>
>>>> I look forward to it!  I have been failing to manage this for  
>>>> over a
>>>> year now.
>>>> I do not write Java but the Agent platforms are in Java
>>>> ==John ffitch
>>>>
>>>> ------------------------------------------------------------------------------
>>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>>> DTrace,
>>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>>> http://p.sf.net/sfu/solaris-dev2dev
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>> DTrace,
>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>> http://p.sf.net/sfu/solaris-dev2dev
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> SOLARIS 10 is the OS for Data Centers - provides features such as  
>> DTrace,
>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>> http://p.sf.net/sfu/solaris-dev2dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
>
> -- 
> Michael Gogins
> Irreducible Productions
> http://www.michael-gogins.com
> Michael dot Gogins at gmail dot com
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as  
> DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-10 21:36
FromMichael Gogins
SubjectRe: [Cs-dev] accessing spout etc from a wrapper
The numpy support can be achieved in the Python SWIG .i file with some
typemaps. Getting buffers and arrays into and out of Csound (and
CsoundAC) as numpy arrays could indeed be quite useful in speeding up
some stuff.

Google for numpy typemap swig...

Regards,
Mike

On Wed, Feb 10, 2010 at 4:17 PM, Victor Lazzarini
 wrote:
> Thanks, that'll be nice.
> I also want to see about adding 'native' support for Numpy arrays for
> the Python wrapper, which would make plotting and general manipulation
> of Csound output in scipy, pylab more efficient. It proves very useful
> in my sound synthesis research.
>
> Regards
>
> Victor
>
> On 10 Feb 2010, at 21:07, Michael Gogins wrote:
>
>> Yes, what I missed to get this to work was the .cast() calls. Thanks!
>>
>> I will add the missing stuff for my new simpler way of doing
>> samplewise access to the Csound class, also, so they will show up in
>> the wrappers.
>>
>> Regards,
>> Mike
>>
>> On Wed, Feb 10, 2010 at 1:40 PM, Dr. Richard Boulanger
>>  wrote:
>>> it's really great Victor!  Wow, the implications are huge.
>>>
>>> -dB
>>>
>>> On Feb 10, 2010, at 1:11 PM, Victor Lazzarini wrote:
>>>
>>>> Well, here it is again, if you missed it. It's Python, but should be
>>>> easily transfered to Java
>>>> (by someone who knows what he is doing, I don't). The pylab bit is
>>>> just there to show it works.
>>>>
>>>> from csnd import *
>>>> from pylab import *
>>>>
>>>> cs = Csound()
>>>> res = cs.Compile("sine.csd", "-n")
>>>> ksmps = cs.GetKsmps()
>>>> channel = floatArray(ksmps);
>>>>
>>>> a = []
>>>> while(res==0):
>>>>   res = cs.PerformKsmps()
>>>>   cs.ChanOAGet(channel.cast(), 0)
>>>>   for i in range(0, ksmps):
>>>>         a.append(channel[i])
>>>>
>>>> t = arange(len(a))
>>>>
>>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>>> show()
>>>> ==========================================
>>>> In addition the numbered bus channels have some other means to
>>>> access
>>>> then (they must be new, I only noticed them yesterday)
>>>>
>>>>   PUBLIC MYFLT csoundChanOAGetSample(CSOUND *, int channel, int
>>>> frame);
>>>>
>>>> (I guess this is Mike Gogins' work?) They are not yet added to the
>>>> Csound class, so are only available through the C API wrappers.
>>>>
>>>> Victor
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 10 Feb 2010, at 17:33, jpff wrote:
>>>>
>>>>>> It seems possible to get a numbered channel (rather than a named
>>>>>> one).
>>>>>> I'll prepare an example.
>>>>>
>>>>> I look forward to it!  I have been failing to manage this for
>>>>> over a
>>>>> year now.
>>>>> I do not write Java but the Agent platforms are in Java
>>>>> ==John ffitch
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>>>> DTrace,
>>>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>>>> http://p.sf.net/sfu/solaris-dev2dev
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>>> DTrace,
>>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>>> http://p.sf.net/sfu/solaris-dev2dev
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>> DTrace,
>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>> http://p.sf.net/sfu/solaris-dev2dev
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>
>>
>>
>> --
>> Michael Gogins
>> Irreducible Productions
>> http://www.michael-gogins.com
>> Michael dot Gogins at gmail dot com
>>
>> ------------------------------------------------------------------------------
>> SOLARIS 10 is the OS for Data Centers - provides features such as
>> DTrace,
>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>> http://p.sf.net/sfu/solaris-dev2dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-02-10 21:45
FromVictor Lazzarini
SubjectRe: [Cs-dev] accessing spout etc from a wrapper
Thanks! I also have a student here who has done this and I might ask  
him some questions.

Victor
On 10 Feb 2010, at 21:36, Michael Gogins wrote:

> The numpy support can be achieved in the Python SWIG .i file with some
> typemaps. Getting buffers and arrays into and out of Csound (and
> CsoundAC) as numpy arrays could indeed be quite useful in speeding up
> some stuff.
>
> Google for numpy typemap swig...
>
> Regards,
> Mike
>
> On Wed, Feb 10, 2010 at 4:17 PM, Victor Lazzarini
>  wrote:
>> Thanks, that'll be nice.
>> I also want to see about adding 'native' support for Numpy arrays for
>> the Python wrapper, which would make plotting and general  
>> manipulation
>> of Csound output in scipy, pylab more efficient. It proves very  
>> useful
>> in my sound synthesis research.
>>
>> Regards
>>
>> Victor
>>
>> On 10 Feb 2010, at 21:07, Michael Gogins wrote:
>>
>>> Yes, what I missed to get this to work was the .cast() calls.  
>>> Thanks!
>>>
>>> I will add the missing stuff for my new simpler way of doing
>>> samplewise access to the Csound class, also, so they will show up in
>>> the wrappers.
>>>
>>> Regards,
>>> Mike
>>>
>>> On Wed, Feb 10, 2010 at 1:40 PM, Dr. Richard Boulanger
>>>  wrote:
>>>> it's really great Victor!  Wow, the implications are huge.
>>>>
>>>> -dB
>>>>
>>>> On Feb 10, 2010, at 1:11 PM, Victor Lazzarini wrote:
>>>>
>>>>> Well, here it is again, if you missed it. It's Python, but  
>>>>> should be
>>>>> easily transfered to Java
>>>>> (by someone who knows what he is doing, I don't). The pylab bit is
>>>>> just there to show it works.
>>>>>
>>>>> from csnd import *
>>>>> from pylab import *
>>>>>
>>>>> cs = Csound()
>>>>> res = cs.Compile("sine.csd", "-n")
>>>>> ksmps = cs.GetKsmps()
>>>>> channel = floatArray(ksmps);
>>>>>
>>>>> a = []
>>>>> while(res==0):
>>>>>   res = cs.PerformKsmps()
>>>>>   cs.ChanOAGet(channel.cast(), 0)
>>>>>   for i in range(0, ksmps):
>>>>>         a.append(channel[i])
>>>>>
>>>>> t = arange(len(a))
>>>>>
>>>>> plot(t[0:100]/cs.GetSr(), a[0:100])
>>>>> show()
>>>>> ==========================================
>>>>> In addition the numbered bus channels have some other means to
>>>>> access
>>>>> then (they must be new, I only noticed them yesterday)
>>>>>
>>>>>   PUBLIC MYFLT csoundChanOAGetSample(CSOUND *, int channel, int
>>>>> frame);
>>>>>
>>>>> (I guess this is Mike Gogins' work?) They are not yet added to the
>>>>> Csound class, so are only available through the C API wrappers.
>>>>>
>>>>> Victor
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 10 Feb 2010, at 17:33, jpff wrote:
>>>>>
>>>>>>> It seems possible to get a numbered channel (rather than a named
>>>>>>> one).
>>>>>>> I'll prepare an example.
>>>>>>
>>>>>> I look forward to it!  I have been failing to manage this for
>>>>>> over a
>>>>>> year now.
>>>>>> I do not write Java but the Agent platforms are in Java
>>>>>> ==John ffitch
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>>>>> DTrace,
>>>>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>>>>> http://p.sf.net/sfu/solaris-dev2dev
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>>>> DTrace,
>>>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>>>> http://p.sf.net/sfu/solaris-dev2dev
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>>> DTrace,
>>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>>> http://p.sf.net/sfu/solaris-dev2dev
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>>
>>>
>>> --
>>> Michael Gogins
>>> Irreducible Productions
>>> http://www.michael-gogins.com
>>> Michael dot Gogins at gmail dot com
>>>
>>> ------------------------------------------------------------------------------
>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>> DTrace,
>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>> http://p.sf.net/sfu/solaris-dev2dev
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> SOLARIS 10 is the OS for Data Centers - provides features such as  
>> DTrace,
>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>> http://p.sf.net/sfu/solaris-dev2dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
>
> -- 
> Michael Gogins
> Irreducible Productions
> http://www.michael-gogins.com
> Michael dot Gogins at gmail dot com
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as  
> DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net