Csound Csound-dev Csound-tekno Search About

[Cs-dev] accessing a numbered channel using a wrapped language

Date2010-02-09 21:39
FromVictor Lazzarini
Subject[Cs-dev] accessing a numbered channel using a wrapped language
And the floatArray (or doubleArray) provides a solution for accessing  
numbered channels, as they take a float * instead of float ** (or  
double).

Here's an example in Python, which should be transferable to Java.

====================
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()
=====================

So I guess things might be possible with the current system.

Victor



------------------------------------------------------------------------------
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-14 15:25
Fromedexter5
SubjectRe: [Cs-dev] accessing a numbered channel using a wrapped language
It would be cool to see that in the "examples" in the next version.



Victor Lazzarini wrote:
> 
> And the floatArray (or doubleArray) provides a solution for accessing  
> numbered channels, as they take a float * instead of float ** (or  
> double).
> 
> Here's an example in Python, which should be transferable to Java.
> 
> ====================
> 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()
> =====================
> 
> So I guess things might be possible with the current system.
> 
> Victor
> 
> 
> 
> ------------------------------------------------------------------------------
> 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
> 
> 

-- 
View this message in context: http://old.nabble.com/accessing-a-numbered-channel-using-a-wrapped-language-tp27522507p27584016.html
Sent from the Csound - Dev mailing list archive at Nabble.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