Csound Csound-dev Csound-tekno Search About

[Csnd] athenaCL within Csound

Date2013-01-29 20:21
Frommenno
Subject[Csnd] athenaCL within Csound
Hi all,

i want to use values returned by AthenaCL for note generation and such, from
within Csound.
I know about the article "Python at the Control Rate: athenaCL Generators as
Csound Signals" from the Csound Journal. In that article there is only one
note played and athenaCL Generators can be used to for example to change the
cutoff frequency of a filter - all at k rate.
What i would like to know if it is possible to generate the notes itself or
use the produces values for other purposes.
Can this be done somehow with "event"?

I was trying this example, where i use the string method
(http://www.flexatone.org/static/docs/athenacl/www/sect-python-generator.htm). 
Python runs, but no value is returned.

Any ideas?



; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac          ; -iadc    ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o system.wav -W ;;; for file output any platform



sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

instr 1
; Waits for command to execute before continuing
kres system 1,{{     
	python
	from athenaCL.libATH.libPmtr import parameter
	po = parameter.factory(['ws','t',6,0,-1,1])
	po(1)	
        }}, 1
printk2 kres
turnoff
endin



i 1 0 2

e

 





--
View this message in context: http://csound.1045644.n5.nabble.com/athenaCL-within-Csound-tp5719687.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-01-30 07:12
FromOeyvind Brandtsegg
SubjectRe: [Csnd] athenaCL within Csound
Hi menno,
I have wanted to look into using athenaCL from within Csound too, but haven't got around to it yet.
Briefly, I think that the system opcode will not return anything useful in your context, it only returns the exit code of the process (e.g. sucess or failure) as far as I can see.
Perhaps you can use the regular python opcodes (pyrun, pycall) to import athenaCL?

pseudo-ish code:

(in global instr)
pyruni "import athenaCL.libATH.libPmtr"
pyruni "po = parameter.factory(['ws','t',6,0,-1,1])"

instr 1
k1 pycalli "po", 1
endin


As I said, never got around to trying it, so it's a shot in the dark...
Oeyvind

2013/1/29 menno <nabob_cd@yahoo.com>
Hi all,

i want to use values returned by AthenaCL for note generation and such, from
within Csound.
I know about the article "Python at the Control Rate: athenaCL Generators as
Csound Signals" from the Csound Journal. In that article there is only one
note played and athenaCL Generators can be used to for example to change the
cutoff frequency of a filter - all at k rate.
What i would like to know if it is possible to generate the notes itself or
use the produces values for other purposes.
Can this be done somehow with "event"?

I was trying this example, where i use the string method
(http://www.flexatone.org/static/docs/athenacl/www/sect-python-generator.htm).
Python runs, but no value is returned.

Any ideas?

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac          ; -iadc    ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o system.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

instr 1
; Waits for command to execute before continuing
kres system 1,{{
        python
        from athenaCL.libATH.libPmtr import parameter
        po = parameter.factory(['ws','t',6,0,-1,1])
        po(1)
        }}, 1
printk2 kres
turnoff
endin
</CsInstruments>
<CsScore>

i 1 0 2

e
</CsScore>
</CsoundSynthesizer>





--
View this message in context: http://csound.1045644.n5.nabble.com/athenaCL-within-Csound-tp5719687.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




--

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp

Date2013-01-30 13:53
FromMichael Gogins
SubjectRe: [Csnd] athenaCL within Csound
Before trying to answer your question, it would be helpful to know
more about what you are trying to do. Do you want to generate a score?
Control performance? (i.e. set up control channel values). Then, do
you need to do this before performance, during performance, or both?

There are examples of doing various sorts of this kinds of things with
both Python and Lua in the csound/examples/opcode_demos directory.

On Wed, Jan 30, 2013 at 2:12 AM, Oeyvind Brandtsegg
 wrote:
> Hi menno,
> I have wanted to look into using athenaCL from within Csound too, but
> haven't got around to it yet.
> Briefly, I think that the system opcode will not return anything useful in
> your context, it only returns the exit code of the process (e.g. sucess or
> failure) as far as I can see.
> Perhaps you can use the regular python opcodes (pyrun, pycall) to import
> athenaCL?
>
> pseudo-ish code:
>
> (in global instr)
> pyruni "import athenaCL.libATH.libPmtr"
> pyruni "po = parameter.factory(['ws','t',6,0,-1,1])"
>
> instr 1
> k1 pycalli "po", 1
> endin
>
>
> As I said, never got around to trying it, so it's a shot in the dark...
> Oeyvind
>
> 2013/1/29 menno 
>>
>> Hi all,
>>
>> i want to use values returned by AthenaCL for note generation and such,
>> from
>> within Csound.
>> I know about the article "Python at the Control Rate: athenaCL Generators
>> as
>> Csound Signals" from the Csound Journal. In that article there is only one
>> note played and athenaCL Generators can be used to for example to change
>> the
>> cutoff frequency of a filter - all at k rate.
>> What i would like to know if it is possible to generate the notes itself
>> or
>> use the produces values for other purposes.
>> Can this be done somehow with "event"?
>>
>> I was trying this example, where i use the string method
>>
>> (http://www.flexatone.org/static/docs/athenacl/www/sect-python-generator.htm).
>> Python runs, but no value is returned.
>>
>> Any ideas?
>>
>> 
>> 
>> ; Select audio/midi flags here according to platform
>> ; Audio out   Audio in
>> -odac          ; -iadc    ;;;RT audio I/O
>> ; For Non-realtime ouput leave only the line below:
>> ; -o system.wav -W ;;; for file output any platform
>> 
>> 
>>
>> sr = 44100
>> kr = 4410
>> ksmps = 10
>> nchnls = 1
>>
>> instr 1
>> ; Waits for command to execute before continuing
>> kres system 1,{{
>>         python
>>         from athenaCL.libATH.libPmtr import parameter
>>         po = parameter.factory(['ws','t',6,0,-1,1])
>>         po(1)
>>         }}, 1
>> printk2 kres
>> turnoff
>> endin
>> 
>> 
>>
>> i 1 0 2
>>
>> e
>> 
>> 
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://csound.1045644.n5.nabble.com/athenaCL-within-Csound-tp5719687.html
>> Sent from the Csound - General mailing list archive at Nabble.com.
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>
>
>
> --
>
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
>
> http://flyndresang.no/
> http://www.partikkelaudio.com/
> http://soundcloud.com/brandtsegg
> http://soundcloud.com/t-emp



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

Date2013-01-30 14:03
Frommenno
Subject[Csnd] Re: athenaCL within Csound
Sound logic, Oeyvind, but perhaps too logic: it does not work :)
I get a segmentation fault AND 0 errors.

This was my try:



; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac          ; -iadc    ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o system.wav -W ;;; for file output any platform



sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

pyruni "import athenaCL.libATH.libPmtr"
pyruni "po = parameter.factory(['ws','t',6,0,-1,1])"

instr 1

k1 pycall1 "po", 1
printk2 k1

endin



i 1 0 2

e

 

thanks for your idea, i'll experiment some more,





--
View this message in context: http://csound.1045644.n5.nabble.com/athenaCL-within-Csound-tp5719687p5719705.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-01-30 14:35
FromOeyvind Brandtsegg
SubjectRe: [Csnd] Re: athenaCL within Csound
Sorry for not being able to provide a secure and tested solution...
but can you test the same statements in Python, to see that it does not produce an error there?
If it works in Python but not within Csound, it might be that the search path for python modules differs between the two.
To include the current working dir in the search path, I routinely do this:

    pyinit
    pyruni "import sys"
    pyruni "import os"
    pyruni "sys.path.append(os.getcwd())"
    pyruni "import mymodule_residing_in_cwd"

... perhaps you need to do something similar, pointing to the path for the athena modules?

The above code requires you to run Csound from the terminal, and being situated in the directory where the csd and py files reside (cd to that directory).
If you run Csound from Qt or other frontend, the current working directory may be something else than the directory where the csd file resides, and the above won't work.

best
Oeyvind

Oeyvind




2013/1/30 menno <nabob_cd@yahoo.com>
Sound logic, Oeyvind, but perhaps too logic: it does not work :)
I get a segmentation fault AND 0 errors.

This was my try:

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac          ; -iadc    ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o system.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

pyruni "import athenaCL.libATH.libPmtr"
pyruni "po = parameter.factory(['ws','t',6,0,-1,1])"

instr 1

k1 pycall1 "po", 1
printk2 k1

endin
</CsInstruments>
<CsScore>

i 1 0 2

e
</CsScore>
</CsoundSynthesizer>

thanks for your idea, i'll experiment some more,





--
View this message in context: http://csound.1045644.n5.nabble.com/athenaCL-within-Csound-tp5719687p5719705.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




--

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp

Date2013-01-30 14:49
Frommenno
Subject[Csnd] Re: athenaCL within Csound
The article that Ariza wrote for the Csound Journal 9 explains how you can
use the returned values of (sections of) athenaCL. The returned values can
be used - at k rate - to change filters or frequency within ONE note's
duration.
That's great and i'm greatful.
What i also want is: let AthenaCL generate notes. And amps for those notes,
and rhythmic distributions with those notes and everything else that
AthenaCL can do as a standalone program. All that i want to have embedded
within a csd.

Personally don't need its pitch analysis system.

AthenaCL is very nice. It gives me positive feedback because of the
algorithmic nature of the textures, but it produces a fixed end result while
i would like to be able to change and adapt the produced values within a
csd. That is why i want AthenaCL to function within a csd.
And the final goal is to use AthenaCL as an instrument within Blue, so it
can be used in the composition. 

Those are my humble wishes :)



--
View this message in context: http://csound.1045644.n5.nabble.com/athenaCL-within-Csound-tp5719687p5719707.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-01-30 14:55
FromOeyvind Brandtsegg
SubjectRe: [Csnd] Re: athenaCL within Csound
Here's a simple example of using python data to generate instrument events with varying rhytm and pitch.
Perhaps it can be used as a basis for what you want to do?
Oeyvind


;*********************************************************************
; generate a melody by calling python to get note data
;*********************************************************************
    instr 2

    kindex        init p4                            ; where in the note series to start
    ioffset        = p5                            ; note offset (octave or other offset)
    kbpm        = p6                            ; tempo in beats per minute
    ktempo        = kbpm/60                        ; tempo in ticks per second
    kRhythm        init 1                            ; rhytm multiplier value (f.ex. 4 will be a quarter note)
    kmetrofreq    = ktempo*kRhythm                    ; calculate rhythm as metronome frequency
    kTrig        metro kmetrofreq                    ; generate metronome pulse
   
    kNote, kRhythm    pycall2t kTrig, "serial2_rhythm.getNextNote", kindex    ; get note (both note number and rhythm multiplier)

    if kTrig == 0 kgoto done
    kDur        = (1/(ktempo*kRhythm)) * 0.9                    ; here, note duration is 90% of the time until the next note
    kAmp        = -10
    instrNum    = 31                            ; select instrument for playback
    event        "i", instrNum, 0, kDur, kAmp, kNote+ioffset        ; trigger csound audio synthesis instrument

    done:
    endin



2013/1/30 menno <nabob_cd@yahoo.com>
The article that Ariza wrote for the Csound Journal 9 explains how you can
use the returned values of (sections of) athenaCL. The returned values can
be used - at k rate - to change filters or frequency within ONE note's
duration.
That's great and i'm greatful.
What i also want is: let AthenaCL generate notes. And amps for those notes,
and rhythmic distributions with those notes and everything else that
AthenaCL can do as a standalone program. All that i want to have embedded
within a csd.

Personally don't need its pitch analysis system.

AthenaCL is very nice. It gives me positive feedback because of the
algorithmic nature of the textures, but it produces a fixed end result while
i would like to be able to change and adapt the produced values within a
csd. That is why i want AthenaCL to function within a csd.
And the final goal is to use AthenaCL as an instrument within Blue, so it
can be used in the composition.

Those are my humble wishes :)



--
View this message in context: http://csound.1045644.n5.nabble.com/athenaCL-within-Csound-tp5719687p5719707.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




--

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp

Date2013-01-30 15:04
FromMichael Gogins
SubjectRe: [Csnd] Re: athenaCL within Csound
Thanks Menno, I'll be getting back to you with some suggestions about
generating notes. Again, are notes to be generated prior to
performance, or during performance in response to other events? Or
both?

Regards,
Mike

On Wed, Jan 30, 2013 at 9:55 AM, Oeyvind Brandtsegg
 wrote:
> Here's a simple example of using python data to generate instrument events
> with varying rhytm and pitch.
> Perhaps it can be used as a basis for what you want to do?
> Oeyvind
>
>
> ;*********************************************************************
> ; generate a melody by calling python to get note data
> ;*********************************************************************
>     instr 2
>
>     kindex        init p4                            ; where in the note
> series to start
>     ioffset        = p5                            ; note offset (octave or
> other offset)
>     kbpm        = p6                            ; tempo in beats per minute
>     ktempo        = kbpm/60                        ; tempo in ticks per
> second
>     kRhythm        init 1                            ; rhytm multiplier
> value (f.ex. 4 will be a quarter note)
>     kmetrofreq    = ktempo*kRhythm                    ; calculate rhythm as
> metronome frequency
>     kTrig        metro kmetrofreq                    ; generate metronome
> pulse
>
>     kNote, kRhythm    pycall2t kTrig, "serial2_rhythm.getNextNote", kindex
> ; get note (both note number and rhythm multiplier)
>
>     if kTrig == 0 kgoto done
>     kDur        = (1/(ktempo*kRhythm)) * 0.9                    ; here, note
> duration is 90% of the time until the next note
>     kAmp        = -10
>     instrNum    = 31                            ; select instrument for
> playback
>     event        "i", instrNum, 0, kDur, kAmp, kNote+ioffset        ;
> trigger csound audio synthesis instrument
>
>     done:
>     endin
>
>
>
> 2013/1/30 menno 
>>
>> The article that Ariza wrote for the Csound Journal 9 explains how you can
>> use the returned values of (sections of) athenaCL. The returned values can
>> be used - at k rate - to change filters or frequency within ONE note's
>> duration.
>> That's great and i'm greatful.
>> What i also want is: let AthenaCL generate notes. And amps for those
>> notes,
>> and rhythmic distributions with those notes and everything else that
>> AthenaCL can do as a standalone program. All that i want to have embedded
>> within a csd.
>>
>> Personally don't need its pitch analysis system.
>>
>> AthenaCL is very nice. It gives me positive feedback because of the
>> algorithmic nature of the textures, but it produces a fixed end result
>> while
>> i would like to be able to change and adapt the produced values within a
>> csd. That is why i want AthenaCL to function within a csd.
>> And the final goal is to use AthenaCL as an instrument within Blue, so it
>> can be used in the composition.
>>
>> Those are my humble wishes :)
>>
>>
>>
>> --
>> View this message in context:
>> http://csound.1045644.n5.nabble.com/athenaCL-within-Csound-tp5719687p5719707.html
>> Sent from the Csound - General mailing list archive at Nabble.com.
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>
>
>
> --
>
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
>
> http://flyndresang.no/
> http://www.partikkelaudio.com/
> http://soundcloud.com/brandtsegg
> http://soundcloud.com/t-emp



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

Date2013-01-30 15:09
Frommenno
Subject[Csnd] Re: athenaCL within Csound
some progress here:



; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac          ; -iadc    ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o system.wav -W ;;; for file output any platform



sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

pyinit
pyruni "from athenaCL.libATH.libPmtr import parameter"
pyruni "po = parameter.factory(['ws','t',6,0,-1,1])"

instr 1

k1 pycall1 "po", 1
printk2 k1

endin



i 1 0 2

e

 

result is: i1 0.86603

giant leap for mankind...well for me at least...

Oeyvind, i want to use AthenaCL, not python as such. Using python would mean
that i have to learn that language as well and i am trying to focus on
composing now.
I know AthenaCL pretty well so i was hoping to build on that knowledge and
use it within Csound/Blue.
This result looks promising!





--
View this message in context: http://csound.1045644.n5.nabble.com/athenaCL-within-Csound-tp5719687p5719711.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-01-30 15:46
FromSteven Yi
SubjectRe: [Csnd] Re: athenaCL within Csound
AttachmentsathenaTest.zip  
Hi Menno,

Regarding AthenaCL and Blue, you can run AthenaCL from within a Blue
ExternalObject or ObjectBuilder object.  It would have to run a
system-installed python interpreter with AthenaCL installed with that
Python.  I tried a long time ago with Jython (the java version of
Python that is included with Blue), but there's a large data file used
as a class in AthenaCL that can not be compiled down to a Java class
so it can not run. (Haven't checked in a long time though).

However, I did get AthenaCL to run via ExternalObject a long while
back though. I had to look in my email archive and found a discussion
I had with Christopher Ariza about it from about 2005.  I have
attached a .blue and .py file that work together to run AthenaCL to
produce some score. I don't have AthenaCL installed at the moment so I
can't test it, but I imagine it would either work or be a good start
for how to integrate the two.

Cheers!
steven

On Wed, Jan 30, 2013 at 2:49 PM, menno  wrote:
> The article that Ariza wrote for the Csound Journal 9 explains how you can
> use the returned values of (sections of) athenaCL. The returned values can
> be used - at k rate - to change filters or frequency within ONE note's
> duration.
> That's great and i'm greatful.
> What i also want is: let AthenaCL generate notes. And amps for those notes,
> and rhythmic distributions with those notes and everything else that
> AthenaCL can do as a standalone program. All that i want to have embedded
> within a csd.
>
> Personally don't need its pitch analysis system.
>
> AthenaCL is very nice. It gives me positive feedback because of the
> algorithmic nature of the textures, but it produces a fixed end result while
> i would like to be able to change and adapt the produced values within a
> csd. That is why i want AthenaCL to function within a csd.
> And the final goal is to use AthenaCL as an instrument within Blue, so it
> can be used in the composition.
>
> Those are my humble wishes :)
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/athenaCL-within-Csound-tp5719687p5719707.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>