pwgl-users: BPF-Score in ENP-score windows

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

pwgl-users: BPF-Score in ENP-score windows

by mauricio rodriguez-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi there,

I am wonder if there exist a way to add user-defined templates to the library of  BPF-score (something equivalent to the predefined: bpf Library/basics/Ramp-up available in the menu-option of the BPF-score). When having complex BPF-scores associated to a note or a group o notes it is very hard to edit the bpf coordinates by hand (things could be easier through algorithmic generation). The scenario is worst if one try to clone a given BPF associated to another note(s). It will be great having the possibility of storing user-defined BPF templates, as it happens with the other visual-tools such a as Note-head Designer and Expression-Designer and quote them in different locations of the ENP-score window.

Does anyone has tried and/or solved a similar task? Please let me know...

Mauricio


_________________________________________________________________
P.D. Checa las nuevas fotos de mi Space
http://home.services.spaces.live.com/

Re: pwgl-users: BPF-Score in ENP-score windows

by Mika Kuuskankare :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

For copying, use the following (for autoloading save it into PWGL-
Users/ENP/autoloads/somefilename.lisp) to copy-paste expressions (to  
chords at the moment).

(in-package :ccl)

#-copy-expressions
(defmethod paste-ENP-object((copied-object CONS) (object-type  
expression) (target CHORD))
   (dolist (obj copied-object)
     (insert-expression target obj)))

For adding to the BPF library you can use the following code  
(autoloading as above). This is a quick hack for the moment... I try  
to polish this for the future and add it to the kernel ... all you  
would need to do is to create new score-bpf-prototype methods as in  
the example.

(in-package :ccl)

#-add-bpf-from-menu
(defmethod add-bpf-from-menu ((score score) (bpf bpf) function)
   (pushr (score-bpf-prototype bpf function t (calc-BPF-start-time  
bpf) (calc-BPF-end-time bpf) (min-val bpf) (max-val bpf)  (BPF-Type  
bpf) (val-type bpf))
          (break-point-functions bpf))
   (setf (break-point-functions-pointer bpf) (1- (length (break-point-
functions bpf))))
   (redraw (subview score)))

#-add-bpf-from-menu
(make-ENP-key-event #\l "Add bpf from a library"
   (let ((functions (loop for m in (generic-function-methods #'score-
bpf-prototype)
                          when (let ((item (second (clos::method-
specializers m))))
                                 (when (listp item) (second item)))
                          collect it)))
     (when-let (fn (capi::prompt-with-list functions "Select"))
       (mapc #'(lambda(x) (when (eql (type-of x) 'bpf) (add-bpf-from-
menu self x fn))) selected-objects))))

;************************************************************************************
; create a new proto - example
;************************************************************************************

(defmethod score-bpf-prototype ((self bpf) (name (eql :random))  
(category t) start-time end-time min-val max-val BPF-Type val-type)
   start-time end-time min-val max-val BPF-Type val-type
;; the arguments should be quite self-explanatory - points is a list  
of lists as in '((0.0 0.5) (0.4 0.2) ...) ascending x-wise
   (make-instance 'C-break-point-function :points (loop for x from  
start-time to end-time by (/ (abs (- end-time start-time)) 10.0)  
collect (list x (random (+ min-val (- max-val min-val)))))
                  :r 0.0  :g 0.0 :b 0.0))  ;;<- color



Mika

On 21.9.2008, at 0:45, mauricio rodriguez wrote:

>
> Hi there,
>
> I am wonder if there exist a way to add user-defined templates to  
> the library of  BPF-score (something equivalent to the predefined:  
> bpf Library/basics/Ramp-up available in the menu-option of the BPF-
> score). When having complex BPF-scores associated to a note or a  
> group o notes it is very hard to edit the bpf coordinates by hand  
> (things could be easier through algorithmic generation). The  
> scenario is worst if one try to clone a given BPF associated to  
> another note(s). It will be great having the possibility of storing  
> user-defined BPF templates, as it happens with the other visual-
> tools such a as Note-head Designer and Expression-Designer and quote  
> them in different locations of the ENP-score window.
>
> Does anyone has tried and/or solved a similar task? Please let me  
> know...
>
> Mauricio
>
>
> _________________________________________________________________
> P.D. Checa las nuevas fotos de mi Space
> http://home.services.spaces.live.com/

Dr. Mika Kuuskankare
Researcher
Centre for Music & Technology
Sibelius Academy

Henkilökohtainen postiosoite/Personal post address
PL 342 - PO Box 342
FIN-00121 Helsinki, FINLAND
Tel: +358 (0)40 5415 233
Skype: mkuuskan
personal home page: www.siba.fi/~mkuuskan
project home page: www.siba.fi/PWGL






Parent Message unknown Re: pwgl-users: BPF-Score in ENP-score windows

by Mika Kuuskankare :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mauricio,

yes, at least my documentation was close to NIL...

First of all, make sure that you are using the latest version (rc-11).

I have attached the code now as a zip file. Maybe something happened  
during transfer... anyway I changed some things to avoid syntax  
changes in the future. Put these files to PWGL-User/ENP/autoloads/

DOC:

If you want to add a new bpf proto you:

(1) create it with the "def-score-bpf-prototype" macro as in the  
example (see bpf-protos.lisp). With "name" you give the NAME of you  
prototype. Category is ignored at the moment... fn is anything that in  
the end creates and returns an instance of "C-break-point-function". x/
y points should be fitted inside the ranges, i.e.,  start-time, end-
time, min-val, and max-val. The example doesn't do this ;-)

GUI USAGE:

In the score editor:

(1) add a score-bpf as before

(2) select score-bpf(s) and type l (= lower case L)

(3) choose from the list


-Mika









On 22.9.2008, at 7:25, mauricio rodriguez wrote:

>
> Hi Mika,
>
> Thank you for your very fast reply. I saved the text you sent me on  
> the “autoloads” file in PWGL-user and whenever I try launching PWGL  
> either of the following messages appear in the terminal:
>
>
> Error: In a call to FIND-CLASS: (LET ((FUNCTIONS #)) (WHEN-LET (FN  
> #) (MAPC # SELECTED-OBJECTS))) is not of type CLOS::SYMBOLS.
>
> ENP-KEY-EVENT already defined in /Users/mikaellaurson/PWGLXP/PWGL-
> code/enp/key-events/general.lisp
>
> As you see, there is an erratic behavior implied in the function  
> call ENP-KEY-EVENT. I checked the syntax of the function and  
> everything seems to be correct (I just matched the wrong variable in  
> the loop part with the right one) but still I do not see what the  
> problem can be.
>
>
> To just check the bpf method you sent me as example, I did not  
> succeed in making and instance of the it (to call the 'C-break-point-
> function object) I assume I have to call it with some arguments such  
> as:
>
> (score-bpf-prototype 'bpf 'random t 0.0 1.0 0 1.0 'default 'float)  
> or something alike but not good luck so far.
>
> Can you give me some hints to solve the puzzle?
>
> Best,
>
> Mauricio
>
>
> ----------------------------------------
>> From: mkuuskan@...
>> To: pwgl-users@...
>> Subject: Re: pwgl-users: BPF-Score in ENP-score windows
>> Date: Sun, 21 Sep 2008 13:07:37 +0200
>>
>> For copying, use the following (for autoloading save it into PWGL-
>> Users/ENP/autoloads/somefilename.lisp) to copy-paste expressions (to
>> chords at the moment).
>>
>> (in-package :ccl)
>>
>> #-copy-expressions
>> (defmethod paste-ENP-object((copied-object CONS) (object-type
>> expression) (target CHORD))
>>   (dolist (obj copied-object)
>>     (insert-expression target obj)))
>>
>> For adding to the BPF library you can use the following code
>> (autoloading as above). This is a quick hack for the moment... I try
>> to polish this for the future and add it to the kernel ... all you
>> would need to do is to create new score-bpf-prototype methods as in
>> the example.
>>
>> (in-package :ccl)
>>
>> #-add-bpf-from-menu
>> (defmethod add-bpf-from-menu ((score score) (bpf bpf) function)
>>   (pushr (score-bpf-prototype bpf function t (calc-BPF-start-time
>> bpf) (calc-BPF-end-time bpf) (min-val bpf) (max-val bpf)  (BPF-Type
>> bpf) (val-type bpf))
>>          (break-point-functions bpf))
>>   (setf (break-point-functions-pointer bpf) (1- (length (break-point-
>> functions bpf))))
>>   (redraw (subview score)))
>>
>> #-add-bpf-from-menu
>> (make-ENP-key-event #\l "Add bpf from a library"
>>   (let ((functions (loop for m in (generic-function-methods #'score-
>> bpf-prototype)
>>                          when (let ((item (second (clos::method-
>> specializers m))))
>>                                 (when (listp item) (second item)))
>>                          collect it)))
>>     (when-let (fn (capi::prompt-with-list functions "Select"))
>>       (mapc #'(lambda(x) (when (eql (type-of x) 'bpf) (add-bpf-from-
>> menu self x fn))) selected-objects))))
>>
>> ;************************************************************************************
>> ; create a new proto - example
>> ;************************************************************************************
>>
>> (defmethod score-bpf-prototype ((self bpf) (name (eql :random))
>> (category t) start-time end-time min-val max-val BPF-Type val-type)
>>   start-time end-time min-val max-val BPF-Type val-type
>> ;; the arguments should be quite self-explanatory - points is a list
>> of lists as in '((0.0 0.5) (0.4 0.2) ...) ascending x-wise
>>   (make-instance 'C-break-point-function :points (loop for x from
>> start-time to end-time by (/ (abs (- end-time start-time)) 10.0)
>> collect (list x (random (+ min-val (- max-val min-val)))))
>>                  :r 0.0  :g 0.0 :b 0.0))  ;;<- color
>>
>>
>>
>> Mika
>>
>> On 21.9.2008, at 0:45, mauricio rodriguez wrote:
>>
>>>
>>> Hi there,
>>>
>>> I am wonder if there exist a way to add user-defined templates to
>>> the library of  BPF-score (something equivalent to the predefined:
>>> bpf Library/basics/Ramp-up available in the menu-option of the BPF-
>>> score). When having complex BPF-scores associated to a note or a
>>> group o notes it is very hard to edit the bpf coordinates by hand
>>> (things could be easier through algorithmic generation). The
>>> scenario is worst if one try to clone a given BPF associated to
>>> another note(s). It will be great having the possibility of storing
>>> user-defined BPF templates, as it happens with the other visual-
>>> tools such a as Note-head Designer and Expression-Designer and quote
>>> them in different locations of the ENP-score window.
>>>
>>> Does anyone has tried and/or solved a similar task? Please let me
>>> know...
>>>
>>> Mauricio
>>>
>>>
>>> _________________________________________________________________
>>> P.D. Checa las nuevas fotos de mi Space
>>> http://home.services.spaces.live.com/
>>
>> Dr. Mika Kuuskankare
>> Researcher
>> Centre for Music & Technology
>> Sibelius Academy
>>
>> Henkilökohtainen postiosoite/Personal post address
>> PL 342 - PO Box 342
>> FIN-00121 Helsinki, FINLAND
>> Tel: +358 (0)40 5415 233
>> Skype: mkuuskan
>> personal home page: www.siba.fi/~mkuuskan
>> project home page: www.siba.fi/PWGL
>>
>>
>>
>>
>>
> _________________________________________________________________
> Live Search premia tus búsquedas, llévate hasta ¡Un Auto!
> http://www.ganabuscando.com/Default.aspx
Dr. Mika Kuuskankare
Researcher
Centre for Music & Technology
Sibelius Academy

Henkilökohtainen postiosoite/Personal post address
PL 342 - PO Box 342
FIN-00121 Helsinki, FINLAND
Tel: +358 (0)40 5415 233
Skype: mkuuskan
personal home page: www.siba.fi/~mkuuskan
project home page: www.siba.fi/PWGL





Archive.zip (2K) Download Attachment