Fwd: [Bluemusic-devel] Some feature requests to help me write LilyPond aware instruments

View: New views
4 Messages — Rating Filter:   Alert me  

Parent Message unknown Fwd: [Bluemusic-devel] Some feature requests to help me write LilyPond aware instruments

by Steven Yi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I ended up replying to this email only to Bernard, so am forwarding
this to the list as I thought it might be of interest to others.  He
replied that this would be a path worth checking out.  (Bernard,
please feel free to reply to this on list.)

Thanks!
steven

---------- Forwarded message ----------
From: Steven Yi <stevenyi@...>
Date: Wed, Apr 2, 2008 at 10:17 PM
Subject: Re: [Bluemusic-devel] Some feature requests to help me write
LilyPond aware instruments
To: bernard@...


Interesting, well, I certainly don't much like #defines or #ifdefs and
 would prefer using csound code for type safety, but either way is
 fine.

 I am thinking that for your other email request regarding <p3orig> or
 something like that, and for this too, you could maybe not even use
 csound to write the code, but rather, use blue to do it.  What I was
 thinking was creating a python noteprocessor and placing it on the
 root timeline (right-click the root object in the polyobject bar).
 When a note processor is run on the root timeline, it basically runs
 on all generated notes.  You get access to the notes as blue Note
 objects, and you can iterate through them as a list, using code like:

 for note in noteList:
  print note.pfield(2)

 That way, you'd get a lot of things to happen.  One, you'd cleanly
 separate your csound code and your Lilypond code, as your instruments
 wouldn't have any lilypond code.  Two, you'd get to do all your work
 in python, which you're already doing with the mixed csound code.
 Three, you'd get access to the notes after blue is finished processing
 them but before Csound applies anything due to t- statement, basically
 getting the values in the CSD and not what Csound does with it after
 the CSD.

 I think doing this might actually be the simplest solution.  Thoughts?

 steven




 On Wed, Apr 2, 2008 at 9:58 PM, Bernard Hurley <bernard@...> wrote:
 > Hi Steve,
 >
 >  Thanks! Why use macros when I could use UDO's? Well I don't think I
 >  could use UDO's. Essentially I want two radically different versions of
 >  Lily-aware instruments with code looking something like:
 >
 >  #ifdef  LilyWriter
 >  -- code that writes stuff to a python list that LilyWriter then uses --
 >  #else
 >  -- code that actually produces sound ---
 >  #end
 >
 >  This way I can change the behaviour of these instruments simply by
 >  toggling the activation of the LilyWriter instrument. Also the
 >  instruments could be used as is in Blue projects that did not contain
 >  LilyWriter.
 >
 >  There _are_ other ways of achieving this, but all of them seem quite
 >  messy to me and are not as efficient at run time. Also the #ifdef
 >  construct makes it visually clear which code goes with which version of
 >  the instrument.
 >
 >  Regards,
 >
 >  Bernard
 >
 >
 >
 >  On Wed, 2008-04-02 at 21:18 -0700, Steven Yi wrote:
 >  > Hi Bernard,
 >  >
 >  > Thanks for mentioning the bug with the pre block processing (number
 >  > 1).  I took a look and have fixed the processing.  It is now passing
 >  > the lines with original formatting (it was previously trimming all
 >  > lines).  This is in CVS and I have placed  a build at:
 >  >
 >  > http://www.kunstmusik.com/blue_0.123.0_beta_installer.jar
 >  > http://www.kunstmusik.com/blue_0.123.0_beta.zip
 >  >
 >  > As for 2, I'm not sure I could get to anything like that anytime soon.
 >  >
 >  > Number 3, well, I could probably add something like a top.  As a side
 >  > note, what I'm wondering is, why use macros when you could use UDO's?
 >  >
 >  > Thanks,
 >  > steven
 >
 >

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Bluemusic-users mailing list
Bluemusic-users@...
https://lists.sourceforge.net/lists/listinfo/bluemusic-users

Re: Fwd: [Bluemusic-devel] Some feature requests to help me write LilyPond aware instruments

by Bernard Hurley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have been looking at the idea of using a Python noteprocessor. I've had a quick look through the java code of blue and it looks to me as if Python noteprocessors, objects and instruments all use the same instance of a Python interpreter. Is this true? If it is true is there any way for them to communicate with each other? If so I could make things like the LilyPond name of an instrument known to the note processor.

Thanks,

Bernard

Steven Yi wrote:
 I am thinking that for your other email request regarding <p3orig> or
 something like that, and for this too, you could maybe not even use
 csound to write the code, but rather, use blue to do it.  What I was
 thinking was creating a python noteprocessor and placing it on the
 root timeline (right-click the root object in the polyobject bar).
 When a note processor is run on the root timeline, it basically runs
 on all generated notes.  You get access to the notes as blue Note
 objects,

Re: Fwd: [Bluemusic-devel] Some feature requests to help me write LilyPond aware instruments

by Bernard Hurley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Forget about whether the scripts can communicate - it looks as if I can get access to everything simply by putting

     import blue

     blueData = blue.BlueSystem.getCurrentBlueData()

in my note processor. This is going to work!

One small gripe: To edit the noteprocessor I have to right click on "root", choose "Edit NoteProcessors", click on the noteprocessor in the list that appears and then click the edit button. I can then edit it in a window that appears. It would be nice I could test it at this point, but I can't - I have to shut down the window and the list of noteprocessors before I can run the project or generate CSD.

Cheers,

Bernard

Bernard Hurley wrote:
I have been looking at the idea of using a Python noteprocessor. I've had a quick look through the java code of blue and it looks to me as if Python noteprocessors, objects and instruments all use the same instance of a Python interpreter. Is this true? If it is true is there any way for them to communicate with each other? If so I could make things like the LilyPond name of an instrument known to the note processor.

Re: Fwd: [Bluemusic-devel] Some feature requests to help me write LilyPond aware instruments

by Steven Yi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Bernard,

Regarding your previous email, yes, blue uses the same interpreter for
processing all python objects.  This is intentional as it allows
defining functions in one object and then using them elsewhere, much
like one would see the definition of performance methods (symbols) at
the beginning of modern music scores, then see those symbols used
throughout the score.

The aspect using noteProcessors on root PolyObject isn't ideal, but
I'm not sure a really good solution for that UI interaction.  However,
because of the processing order, you might be able to do:

-create PythonObject on timeline
-in this pythonObject, create a function that takes in a noteList and
processes it
-in a python noteProcessor, add to root timeline and call the function
you created on the timeline

Due to the processing order, the pythonObject on the timeline should
get run before the the noteProcessor.  So you could have you function
definition on the timeline where it's easy to edit and do the calling
of it up top.

I did a quick test and this will work.

One thing about using:

blueData = blue.BlueSystem.getCurrentBlueData()

I would be very carefula bout making edits to the current blueData as
this is the active project and modifications may not be undoable.
However, reading data from the current blueData is fine, though
calling things like generateScore and other methods that contribute to
CSD generation is not safe to call, as current blue assumes changes
are allowed.  What you could do is clone the blueData though and then
do whatever you want, as that is safe and blue does itself when
generated CSD's.

Hope that helps!
steven

On Fri, Apr 4, 2008 at 2:03 AM, Bernard Hurley <bernard@...> wrote:

>
>  Forget about whether the scripts can communicate - it looks as if I can get
>  access to everything simply by putting
>
>      import blue
>
>      blueData = blue.BlueSystem.getCurrentBlueData()
>
>  in my note processor. This is going to work!
>
>  One small gripe: To edit the noteprocessor I have to right click on "root",
>  choose "Edit NoteProcessors", click on the noteprocessor in the list that
>  appears and then click the edit button. I can then edit it in a window that
>  appears. It would be nice I could test it at this point, but I can't - I
>  have to shut down the window and the list of noteprocessors before I can run
>  the project or generate CSD.
>
>  Cheers,
>
>  Bernard
>
>
>
>  Bernard Hurley wrote:
>  >
>  > I have been looking at the idea of using a Python noteprocessor. I've had
>  > a quick look through the java code of blue and it looks to me as if Python
>  > noteprocessors, objects and instruments all use the same instance of a
>  > Python interpreter. Is this true? If it is true is there any way for them
>  > to communicate with each other? If so I could make things like the
>  > LilyPond name of an instrument known to the note processor.
>  >
>
>  --
>  View this message in context: http://www.nabble.com/Fwd%3A--Bluemusic-devel--Some-feature-requests-to-help-me-write-LilyPond-aware-instruments-tp16467891p16489241.html
>
>
> Sent from the Csound - Blue - User mailing list archive at Nabble.com.
>
>
>  -------------------------------------------------------------------------
>  Check out the new SourceForge.net Marketplace.
>  It's the best place to buy or sell services for
>  just about anything Open Source.
>  http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
>  _______________________________________________
>  Bluemusic-users mailing list
>  Bluemusic-users@...
>  https://lists.sourceforge.net/lists/listinfo/bluemusic-users
>

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Bluemusic-users mailing list
Bluemusic-users@...
https://lists.sourceforge.net/lists/listinfo/bluemusic-users
LightInTheBox - Buy quality products at wholesale price