duplicate parts

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

duplicate parts

by jean legrand :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everyone,
I'm new to Beast 0.7.1 and I'd like to know if the parts in a loop range can be
duplicated such that the content of the new parts is the same but the names of the
new parts are different.
For the moment, when I use Tool/Song/Duplicate parts, the new parts are only
aliases of the original ones, and when I make a change in the new parts, the original
ones are changed too (and I don't want that).
Thanks.


__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités
http://mail.yahoo.fr Yahoo! Mail
_______________________________________________
beast mailing list
beast@...
http://mail.gnome.org/mailman/listinfo/beast

Re : duplicate parts

by jean legrand :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

with some effort (missing docs), I have written this solution. Sorry in advance for the identation.
I've left the loop range idea away and the script only copies the content of a part into another, both parts given in arguments.
I'm not very happy with the constant 2147483647 but I don't know how to say "find for all times".
Also, I think there is a more elegant way to find a part from its name but I can't find out which one.

Can you help me improve this code ?


(bse-script-register 'dub-part
                     ""
                     (N_ "/Song/Dub a part")
                     (N_ "Copies the content of a source part into an existing destination part. "
                         "\n"
                         "Note overlaps can occur if the destination part is not empty. "
                         "\n"
                         "The names for the source and destination parts are the usual ones, "
                         "for instance Part-10.")
                     "Jean Legrand"
                     "GNU General Public License"
                     (bse-param-song (N_ "Song") )
                     (bse-param-string (N_ "Source Part") "")
                     (bse-param-string (N_ "Destination Part") ""))

(define (dub-part song src-name dest-name)
        (let* ((song-name (bse-item-get-name song))
               (project   (bse-item-get-project song ))
               (src       (bse-project-find-item project (string-append (string-append song-name ":") src-name)))
               (test-1    (if (not (bse-is-part src))   (bse-exit-error 'text1 (_ "Wrong name for source part"))))
               (dest      (bse-project-find-item project (string-append (string-append song-name ":") dest-name)))
               (test-2    (if (not (bse-is-part dest))   (bse-exit-error 'text1 (_ "Wrong name for destination part"))))
               (notes     (bse-part-list-notes-crossing src 0 2147483647))
               (copy-note (lambda (note)
                                  (bse-part-insert-note-auto dest
                                                             (bse-rec-get note 'tick)
                                                             (bse-rec-get note 'duration)
                                                             (bse-rec-get note 'note)
                                                             (bse-rec-get note 'fine-tune)
                                                             (bse-rec-get note 'velocity)))))
              (begin
                (bse-item-group-undo song "dubbing-part")
                (for-each copy-note notes)
                (bse-item-ungroup-undo song))))
 
--- En date de : Jeu 8.10.09, jean legrand <kkwweett@...> a écrit :

> De: jean legrand <kkwweett@...>
> Objet: duplicate parts
> À: beast@...
> Date: Jeudi 8 Octobre 2009, 22h36
> Hi everyone,
> I'm new to Beast 0.7.1 and I'd like to know if the parts in
> a loop range can be
> duplicated such that the content of the new parts is the
> same but the names of the
> new parts are different.
> For the moment, when I use Tool/Song/Duplicate parts, the
> new parts are only
> aliases of the original ones, and when I make a change in
> the new parts, the original
> ones are changed too (and I don't want that).
> Thanks.
>



     
_______________________________________________
beast mailing list
beast@...
http://mail.gnome.org/mailman/listinfo/beast

Re: Re : duplicate parts

by Stefan Westerfeld :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

   Hi!

On Sat, Oct 10, 2009 at 05:42:18PM -0700, jean legrand wrote:
> with some effort (missing docs), I have written this solution. Sorry in advance for the identation.
> I've left the loop range idea away and the script only copies the content of a part into another, both parts given in arguments.
> I'm not very happy with the constant 2147483647 but I don't know how to say "find for all times".
> Also, I think there is a more elegant way to find a part from its name but I can't find out which one.
>
> Can you help me improve this code ?

That looks nice already. However, please make sure that you do not only copy
the notes but also the events (such as stereo panning or modulation depth).

Another improvement that is - I think - required is to replace the string
based specification of the part with an object based one. That is, the user
should get a dropdown list of all possible source parts.

I would have expected that the only thing that needs to be changed for this
to work is replacing (bse-param-string ...) with (bse-param-part ...). However
this did not work when I tried it, and some time spent debugging did only
reveal so far that bseparam-proxy.* is responsible for the necessary magic,
but I didn't figure out how to make it work. So I'll do a bit more
debugging.

Also I'd like it better if the script would not silently create overlapping
stuff when the destination part does not have enough space, but fail with
an error message.

I don't think the constant 2147... is terribly problematic, other than it
could be defined as constant somewhere.

   Cu... Stefan
--
Stefan Westerfeld, Hamburg/Germany, http://space.twc.de/~stefan
_______________________________________________
beast mailing list
beast@...
http://mail.gnome.org/mailman/listinfo/beast