Home Forums Macros Trim Main Looper/Insert Looper start and end point (not by selection)

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #6344

    Hello,

    I have been looking for a way to “trim” a loop (Main looper and Insert Looper) by setting a new start and end date via a macro. I don’t want to use the selection functionality, I want to trim the entire loop because this action should be final and I want to be able to do all actions on this new trimmed loop, and not be limited to a selected part of the loop. I am looking for e.g. editing the TrackLoopBeginAt/TrackLoopEndAt variables. Is there already functions for this that I haven’t found?
    Thanks!

    #6346
    Philippe OllivierPhilippe
    Keymaster

    Hi Daniel,
    I am sorry I don’t understand your question.
    If you can, I will be happy to have an example of what you want to do.

    You can also search the forum and you’ll find some examples of using TrackLoopBeginAt and TrackLoopEndAt.
    Philippe

    #6353

    Hello,

    I was probably a bit unclear. I should not have used to TrackLoopBegin/EndAt variables since they are actually used for setting the selection of a loop, which is not what I am looking for. I am look for a way to actually modify the recorded file itself. So if the recorded file (or loop) has a length of 80000.0 samples I might want to trim it so that i ends 5000.0 samples earlier and the file (loop) has now got a length of 75000.0 samples. And from this there would be no going back of course. Is there such a function? Thanks

    #6354
    Philippe OllivierPhilippe
    Keymaster

    Hi Daniel,
    Ok, I understand now !

    You can’t do that in the Main Looper and will probably never be able to do it there…
    But that’s possible to do it in the modular loopers.
    Try this for example :

    //*****************************************************
    // Select a part of the loop
    InsertSendMessage fx1 1 SelectionIn 0
    InsertSendMessage fx1 1 SelectionOut {$Looper_fx1_rank1_current_length$ / 2}

    WaitDuration 10

    // Copy your selection
    InsertSendMessage fx1 1 AudioMessages Copy

    WaitDuration 200
    // Paste your selection and this will replace
    // the content of the looper by you selection
    InsertSendMessage fx1 1 AudioMessages Paste
    //*****************************************************

    Best,
    Philippe

    #6356

    Hello!

    I tried your proposal above and it works for all the cases where the SelectionIn = 0 and the modification is done to the SelectionOut. But as soon as I add a value in SelectionIn strange things are done that I do not understand. I think the strange thing happens during defining the selection. A have the below macro code

    —–
    InsertSendMessage fx1 1 SelectionIn 40000
    InsertSendMessage fx1 1 SelectionOut {$Looper_fx1_rank1_current_length$}
    WaitDuration 10
    InsertSendMessage fx1 1 AudioMessages Copy
    WaitDuration 200
    InsertSendMessage fx1 1 AudioMessages Paste
    —–

    Before Macro Length = 88000
    After Macro Length = 66000 (I was expecting 48000 since we should have removed 40000 samples from the start)

    When I run the above macro without Copy and Paste to see what happens using SelectionIn/SelectionOut this is the values i see in the Insert Looper:

    Begin: 22000
    End: 110000
    Length: 88000

    I cannot make any sense of the above values. Why is the Begin 22000 and not 40000? And should End really be able to have a value AFTER Length?

    Thanks

    #6357
    Philippe OllivierPhilippe
    Keymaster

    I tried this macro which is your macro plus a record line.

    InsertSendMessage fx1 1 Record 88000
    WaitUserAction

    // Select a part of the loop
    InsertSendMessage fx1 1 SelectionIn 40000
    InsertSendMessage fx1 1 SelectionOut $Looper_fx1_rank1_current_length$

    WaitDuration 10

    // Copy your selection
    InsertSendMessage fx1 1 AudioMessages Copy

    WaitDuration 200
    // Paste your selection and this will replace
    // the content of the looper by you selection
    InsertSendMessage fx1 1 AudioMessages Paste

    End everything is ok here.
    I cannot understand your 66000 result…
    Philippe

    #6361

    I now found the issue. It was the Synchro = 4 setting on Insert Looper that gave the strange result above. I now set Synchro = “Free” and it works.

    #6370
    Stephane LE DROStephane LE DRO
    Participant

    Bonjour Philippe,
    Je suis aussi intéressé par la fonctionnalité de copier une sélection à l’intérieur d’un Looper et de la recopier sur ce même Looper ou sur un autre, mais le code que tu as écris ne fonctionne pas (ou très aléatoirement) sur ma machine. J’ai recopié exactement, et même en rajoutant des pauses, rien n’y fait.
    J’ai souvent des erreurs qui s’affichent dans la console :
    bzhtec.splayerx~: MspPlayerPoly: bad begin/end 50240 50239
    Je ne vois pas pourquoi ça ne marche pas chez moi :/
    Stéphane

    #6371
    Philippe OllivierPhilippe
    Keymaster

    Salut Stéphane,

    Ce message d’erreur dans la console indique que le looper ne peut pas lire la zone car le point de début se trouve après le point d’arrivée : 50240 > 50239
    Il doit donc y avoir une erreur dans la macro, peux-tu me la mettre ici dans un post stp?

    J’ai fait un autre exemple de macro qui copie et colle dans la même looper.
    Cette fois-ci je prends le point de début et fin au hasard en utilisant la variable de durée de la boucle actuelle.

    //******************************** Copy and Paste a random selection to the same looper *********************************
    Declare Local Once int $selectionBeginPosition$ = 0
    Declare Local Once int $selectionEndPosition$ = 0

    // get random value from the current loop length
    $selectionBeginPosition$ = {randomScaleInt(0,$Looper_fx1_rank1_current_length$)}
    $selectionEndPosition$ = {randomScaleInt($selectionBeginPosition$,$Looper_fx1_rank1_current_length$)}

    // Select a part of the loop using the random values
    InsertSendMessage fx1 1 SelectionIn $selectionBeginPosition$
    InsertSendMessage fx1 1 SelectionOut $selectionEndPosition$

    WaitDuration 10

    // Copy your selection
    InsertSendMessage fx1 1 AudioMessages Copy

    WaitDuration 200
    // Paste your selection and this will replace
    // the content of the looper by you selection
    InsertSendMessage fx1 1 AudioMessages Paste
    //******************************************************** End *********************************************************

    Si tu souhaites copier dans le looper qui est en fx1 et coller dans un autre en fx2, la macro devient :

    //******************************** Copy and Paste a random selection to the same looper *********************************
    Declare Local Once int $selectionBeginPosition$ = 0
    Declare Local Once int $selectionEndPosition$ = 0

    // get random value from the current loop length
    $selectionBeginPosition$ = {randomScaleInt(0,$Looper_fx1_rank1_current_length$)}
    $selectionEndPosition$ = {randomScaleInt($selectionBeginPosition$,$Looper_fx1_rank1_current_length$)}

    // Select a part of the loop using the random values
    InsertSendMessage fx1 1 SelectionIn $selectionBeginPosition$
    InsertSendMessage fx1 1 SelectionOut $selectionEndPosition$

    WaitDuration 10

    // Copy your selection
    InsertSendMessage fx1 1 AudioMessages Copy

    WaitDuration 200
    // Paste your selection and this will replace
    // the content of the looper by you selection
    InsertSendMessage fx2 1 AudioMessages Paste
    InsertSendMessage fx1 1 SelectionReset
    //******************************************************** End *********************************************************

    On pourrait encore améliorer un peu, mais ici ça fonctionne dans tous les cas.
    Philippe

    #6379
    Stephane LE DROStephane LE DRO
    Participant

    Bonjour Philippe,

    Merci pour ta réponse. Effectivement ton script fonctionne chez moi aussi. La différence avec le mien était simplement dans les valeurs choisies pour $selectionBeginPosition$ et $selectionEndPosition$. Par exemple, si j’utilisais la valeur 0 pour begin ça ne fonctionnait pas. J’ai investigué et j’ai remarqué qu’il y avait un décalage entre les valeurs affichées de $selectionBeginSelection$ et $selectionEndPosition$ et la sélection réelle dans la loop (tu devrais constater le même décalage chez toi) . Presque par hasard j’ai trouvé ce rapport :

    $realBeginning =  $selectionEndPosition$ - $selectionBeginSelection$
    $realEnding =  $selectionEndPosition$ + $selectionBeginSelection$ 

    Du coup j’ai réécrit un script et maintenant ça fonctionne bien chez moi, je peux sélectionner la bonne partie de la boucle et la recopier dans le second looper:

    //******************************** Copy and Paste a selection to a second looper *********************************
    Declare Local Once int $selectionBeginPosition$ = 0
    Declare Local Once int $selectionEndPosition$ = 0
    
    Declare Local Once int $numberOfBeats$ = 8 // for example we divide loop in 8 equal parts
    Declare Local Once int $stepLengthInSample$ = {$Looper_fx1_rank1_current_length$ / $numberOfBeats$}
    Declare Local Once int $beginningBeat$ = 2 // We want to start selection at beat 2
    Declare Local Once int $endingBeat$ = 4 // We want to stop selection at end of beat 4
    
    //------- calculate  $selectionBeginPosition$ and $selectionEndPosition$ -----
    // realBegin = (beginningBeat-1) * stepLengthInSample
    // realEnd = endingBeat * stepLengthInSample
    // selectionEndPosition = (realBegin + realEnd ) /2 = ((beginningBeat-1) + endingBeat) * stepLengthInSample / 2
    // selectionBeginPosition = (realEnd - realBegin ) / 2 = (endingBeat - (beginningBeat-1)) * stepLengthInSample / 2
    
    $selectionBeginPosition$ = {(($endingBeat$) - ($beginningBeat$-1) ) * $stepLengthInSample$ / 2}
    $selectionEndPosition$ = {(($beginningBeat$-1) + ($endingBeat$) ) * $stepLengthInSample$ / 2}
    
    InsertSendMessage fx1 1 SelectionIn $selectionBeginPosition$
    InsertSendMessage fx1 1 SelectionOut $selectionEndPosition$
    
    WaitDuration 10
    
    // Copy your selection
    InsertSendMessage fx1 1 AudioMessages Copy
    
    WaitDuration 200
    // Paste your selection and this will replace
    // the content of the looper by you selection
    InsertSendMessage fx2 1 AudioMessages Paste
    InsertSendMessage fx1 1 SelectionReset

    Stéphane

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.