Old 12-06-2009, 12:50 PM   #41
MikeLacey
Human being with feelings
 
Join Date: Dec 2006
Location: UK
Posts: 789
Default

Always a pleasure Jed
__________________
Mike Lacey, Leicestershire, UK
MikeLacey is offline   Reply With Quote
Old 12-15-2009, 02:49 PM   #42
jedstar2000
Human being with feelings
 
jedstar2000's Avatar
 
Join Date: Apr 2009
Location: Bristol uk
Posts: 1,006
Default

Small fix .

You can now capture any items on any tracks for use for quantize.

http://www.screencast.com/users/Jeds...5-dfa398e8e10f

And have started a page in Tips and tricks to try get some beta testers.
http://forum.cockos.com/showthread.p...958#post422958

Code:
# Captures Grove quantize
#
# Stiched together by Jedstar2000
# ..........USE AT YOUR OWN RICK.................

@Array = ();

# Get number of items currently selected
$Item_Count = RPR_CountSelectedMediaItems(0);
$Item_Index = 0;

# Update Position for each selected item
while ($Item_Index < $Item_Count) {
	# Get ID for current item index
	$Item_ID = RPR_GetSelectedMediaItem(0, $Item_Index);

	# Get Position value for current item
	$D_POSITION = RPR_GetMediaItemInfo_Value($Item_ID, "D_POSITION");
        
        # Add Position value to end of array 
        push(@Array, "$D_POSITION");       
	$Item_Index++;
}
        # This is used to make the first and last items work when calculating 
        push(@Array, 999999999);
        push(@Array, 0);

        @Array = sort(@Array);
	
        RPR_ShowConsoleMsg("Item states stored to DATA file\n");                
        RPR_ShowConsoleMsg("@Array\n");
 
# Create txt file DAT       
open(DAT,">C:/GQDATA.txt");

foreach $var (@Array){
    print DAT "$var\n";   
} 
close(DAT);
Am adding a config file using RPR_GetUserInputs which should allow to get out the loop

I need however to round down

i.e 2.78989898 would equal 2
43.7663453 would equal 43 etc

Is this easy to do in perl.
__________________
...............Reaper the DIY DAW.....................
MultiTrack Editing Macros http://forum.cockos.com/showthread.php?t=50111
Hybrid Theme http://forum.cockos.com/showthread.php?t=131090
jedstar2000 is offline   Reply With Quote
Old 12-16-2009, 08:16 AM   #43
shakey.oberon
Human being with feelings
 
Join Date: Sep 2009
Posts: 996
Default

that's really clever, nice one
shakey.oberon is offline   Reply With Quote
Old 12-16-2009, 01:14 PM   #44
MikeLacey
Human being with feelings
 
Join Date: Dec 2006
Location: UK
Posts: 789
Default

As the man said Jed, nice one...

Your question though, an easy one - use int() - like this:
PHP Code:
# round.pl

print int(2.78989898), "\n";

print 
int(43.7663453), "\n"
It prints

2
43

The int() function returns the integer portion of the number you give it, so it always rounds down.
__________________
Mike Lacey, Leicestershire, UK
MikeLacey is offline   Reply With Quote
Old 12-17-2009, 11:03 AM   #45
jedstar2000
Human being with feelings
 
jedstar2000's Avatar
 
Join Date: Apr 2009
Location: Bristol uk
Posts: 1,006
Default

Sweet thanks mike.

I have figured out the last bit of the puzzle.

This is how to get which bar an item is in .

D_Position is first converted to beats .

D_Position -1 /4 Remove decimal Point x 4 + 1

This will return the value for the first beat of the bar the item is located in.

This can be used as an offset

Add this offset to the quantize values will move the quantize value from bar to bar with no need for lengthy arrays.

2 bar loops can be used using (2x4) instead of 4 etc.

I already have the code to capture quantize equate to zero and convert to beats. And a config page for amount , max quantize, quantize length.

Hopefully get some time to put this all together.
__________________
...............Reaper the DIY DAW.....................
MultiTrack Editing Macros http://forum.cockos.com/showthread.php?t=50111
Hybrid Theme http://forum.cockos.com/showthread.php?t=131090
jedstar2000 is offline   Reply With Quote
Old 12-17-2009, 02:29 PM   #46
MikeLacey
Human being with feelings
 
Join Date: Dec 2006
Location: UK
Posts: 789
Default

Nice... Stick with it, Groove Quantization is a hot topic at the moment.
__________________
Mike Lacey, Leicestershire, UK
MikeLacey is offline   Reply With Quote
Old 12-22-2009, 03:00 PM   #47
jedstar2000
Human being with feelings
 
jedstar2000's Avatar
 
Join Date: Apr 2009
Location: Bristol uk
Posts: 1,006
Default Year Groove quantize uta da loop...........

Year Year year....

These scripts will take any selected items convert them to beats and start the array from zero. Then find which bar an item is in and apply the corect offset and apply the groove quantize, anyware in the time line at any tempo........I have only ran a few tests but all seems to be working................Let me know if anyone finds any bugs ........

Code:
# Captures Grove quantize
#
# Stiched together by Jedstar2000
# ..........USE AT YOUR OWN RICK.................
# 23/12/09  

my ($bpm, $bpi);

($bpm, $bpi) = RPR_GetProjectTimeSignature($bpm, $bpi); 

# Get number of items currently selected
$Item_Count = RPR_CountSelectedMediaItems(0);
$Item_Index = 0;

# Update Position for each selected item
while ($Item_Index < $Item_Count) {
	# Get ID for current item index
	$Item_ID = RPR_GetSelectedMediaItem(0, $Item_Index);

	# Get Position value for current item
	$D_POSITION = RPR_GetMediaItemInfo_Value($Item_ID, "D_POSITION");
        
        # Add Position value to end of array 
        push(@Array, "$D_POSITION");       
	$Item_Index++;
}

#Sort Array
@Array = sort(@Array);

# Add Ofset
$OFSET = $Array[0];
foreach $var (@Array){
    $var = $var - $OFSET;
    push(@Array2, "$var");
}  

#Covert to Beats
foreach $var2 (@Array2){
    $var2 = $var2 /60 * $bpm + 1;
    push(@Array3, "$var2");
} 

# Create txt file DAT       
open(DAT,">C:/GQDATA.txt");

foreach $var (@Array3){
    print DAT "$var\n";   
} 
close(DAT); 

RPR_ShowConsoleMsg("Item states stored to GQDATA file \n");
Code:
# Applys Grove quantize
#
# Stiched together by Jedstar2000
# ..........USE AT YOUR OWN RICK.................

# use strict;     # these two lines keep you out of loads of trouble
# use warnings;

# Get bpm
my ($bpm, $bpi);
($bpm, $bpi) = RPR_GetProjectTimeSignature($bpm, $bpi); 

# Get Quantize
$BEAT = 60 / $bpm;
# Chose quantize length 1, half=0.5, quarter=0.25, 8th=0.125, 16th=0.0625, 32th=0.03125
$QUANT_LENGTH = 0.125;
$QUANTIZE = $BEAT * $QUANT_LENGTH;

#Amount sets amount of grove quantize Values between 0-1 ,0=0% 0.5=50%  1=100% etc
$AMOUNT = 1;

# Retrive Array from DATA txt
my @Array;
my $value;
open(DAT,"C:/GQDATA.txt") || die;
while(<DAT>){
  chomp($_);           
  $value = $_;         
  push(@Array,$value); 
}
close(DAT); 

#Convert Array to seconds
foreach $var (@Array){
    $var = ($var - 1) / $bpm * 60;
    push(@Array2, "$var");
}
push(@Array2, 999999999);
push(@Array2, 0);

# Get number of items currently selected
my $Item_Count = RPR_CountSelectedMediaItems(0);
my $Item_Index = 0;
my $Array_Value = $Array2[0] - 2;

# Update Position for each selected item
while ($Item_Index < $Item_Count) {
    # Get ID for current item index
    my $Item_ID = RPR_GetSelectedMediaItem(0, $Item_Index);

    # Get Position value for current item
    my $D_POSITION = RPR_GetMediaItemInfo_Value($Item_ID, "D_POSITION"); 

    #Find which bar D_Position is in
    $OFSET = $D_POSITION;
    $OFSET = $OFSET /60 * $bpm + 1;
    $OFSET = ($OFSET - 1) / 4;
    $OFSET = int($OFSET); 
    $OFSET = ($OFSET * 4) + 1;
    $OFSET = (($OFSET - 1) / $bpm) * 60;
 
    # Find position left and right of Item position
    my $i=0;
    while(($Array2[$i] + $OFSET) < $D_POSITION ){ 
        $i++;                            
    }
    my $L_POSITION = $Array2[$i-1] + $OFSET;
    my $R_POSITION = $Array2[$i] + $OFSET; 

    # Comparison to find closest of the two quantize point
    if(($D_POSITION - $L_POSITION) <= ($R_POSITION - $D_POSITION)){
          if(($D_POSITION - $L_POSITION) > $QUANTIZE){
          } else {
              $L_POSITION = $D_POSITION - (($D_POSITION - $L_POSITION) * $AMOUNT);
              RPR_SetMediaItemInfo_Value($Item_ID, "D_POSITION", $L_POSITION);
          }
    } else {
          if(($R_POSITION - $D_POSITION) > $QUANTIZE){
          } else {
              $R_POSITION = $D_POSITION + (($R_POSITION - $D_POSITION) * $AMOUNT);
              RPR_SetMediaItemInfo_Value($Item_ID, "D_POSITION", $R_POSITION);
          }

    }
    $Item_Index++;

}
If anyone fancies turning this into an extension so more people can use it please feel free.....

I would love to add midi but the whole chunk thing looks a bit more involving than I have time for at the moment.

Anyway have a great xmas Jed.........
__________________
...............Reaper the DIY DAW.....................
MultiTrack Editing Macros http://forum.cockos.com/showthread.php?t=50111
Hybrid Theme http://forum.cockos.com/showthread.php?t=131090

Last edited by jedstar2000; 12-23-2009 at 01:44 PM. Reason: Edit Updated script
jedstar2000 is offline   Reply With Quote
Old 12-23-2009, 01:49 PM   #48
jedstar2000
Human being with feelings
 
jedstar2000's Avatar
 
Join Date: Apr 2009
Location: Bristol uk
Posts: 1,006
Default

Edited scripts above.
You can now select any items on any tracks when capturing quantize.

Enjoy
__________________
...............Reaper the DIY DAW.....................
MultiTrack Editing Macros http://forum.cockos.com/showthread.php?t=50111
Hybrid Theme http://forum.cockos.com/showthread.php?t=131090
jedstar2000 is offline   Reply With Quote
Old 12-23-2009, 02:09 PM   #49
Kundalinguist
Human being with feelings
 
Kundalinguist's Avatar
 
Join Date: Nov 2008
Location: Toronto, Canada
Posts: 4,630
Default

Thank you Jedstar (and his Super Friends)
__________________
Success is just one more plugin away! And happiness is as close as your next upgrade. (On the interweb: www.rolandk.ca / www.auroraskypublishing.com)
Kundalinguist is offline   Reply With Quote
Old 12-23-2009, 03:09 PM   #50
MikeLacey
Human being with feelings
 
Join Date: Dec 2006
Location: UK
Posts: 789
Default

These just keep getting better.

thx Jed.

Oh, and happy Christmas/Holidays
__________________
Mike Lacey, Leicestershire, UK
MikeLacey is offline   Reply With Quote
Old 12-30-2009, 03:53 AM   #51
jedstar2000
Human being with feelings
 
jedstar2000's Avatar
 
Join Date: Apr 2009
Location: Bristol uk
Posts: 1,006
Default

Happy holidays Mike hope you've had a nice relaxing one ,I sure have

I installed komodo which has made the process far more enjoyable.

I nearly have everything I set out completed now apart from Midi implementation and Loading files.

I have a horrible feeling there is going to be no elegant way of browsing and loading files in perl but I would be very happy if you tell me otherwise.

Hears the code so far.

There is now a config page which uses a septate array to give more control over the quantize.

Everything appears to be working as expected but if it doesn't please report back.

http://screencast.com/t/NWFmNzFiZmU

EDIT.................IMPORTANT.................... ...
YOU NEED TO RUN CONFIG ONCE TO CREATE THE CONFIG.TXT BEFORE YOU CAN USE APPLY.
EDIT..................

Capture
Code:
# Captures Grove quantize
#
# Stiched together by Jedstar2000
# ..........USE AT YOUR OWN RICK.................
# 23/12/09  

my ($bpm, $bpi);

($bpm, $bpi) = RPR_GetProjectTimeSignature($bpm, $bpi); 

# Get number of items currently selected
$Item_Count = RPR_CountSelectedMediaItems(0);
$Item_Index = 0;

# Update Position for each selected item
while ($Item_Index < $Item_Count) {
	# Get ID for current item index
	$Item_ID = RPR_GetSelectedMediaItem(0, $Item_Index);

	# Get Position value for current item
	$D_POSITION = RPR_GetMediaItemInfo_Value($Item_ID, "D_POSITION");
        
        # Add Position value to end of array 
        push(@Array, "$D_POSITION");       
	$Item_Index++;
}

#Sort Array
@Array = sort(@Array);

# Add Ofset
$OFSET = $Array[0];
foreach $var (@Array){
    $var = $var - $OFSET;
    push(@Array2, "$var");
}  

#Covert to Beats
foreach $var2 (@Array2){
    $var2 = $var2 /60 * $bpm + 1;
    push(@Array3, "$var2");
} 

# Create txt file DAT       
open(DAT,">C:/GQDATA.txt");

foreach $var (@Array3){
    print DAT "$var\n";   
} 
close(DAT); 

RPR_ShowConsoleMsg("Item states stored to GQDATA file \n");
Apply

Code:
# Applys Grove quantize
#
# Stiched together by Jedstar2000
# ..........USE AT YOUR OWN RICK.................

use strict;     
use warnings;

my @Array;
my @Array2;
my @Array3;
my ($bpm, $bpi);
my $BEAT;
my $QUANT_LENGTH;
my $value;
my $var;
my $value3;
my $QUANTIZE;
my $AMOUNT;
my $OFSET;
my $Start_Ofset;
my $Beats_Number;

# Get bpm
($bpm, $bpi) = RPR_GetProjectTimeSignature($bpm, $bpi);

# Retrive Array from GQCONFIG txt
open(DAT,"C:/GQCONFIG.txt") || die;
while(<DAT>){
  chomp($_);           
  $value3 = $_;         
  push(@Array3,$value3); 
}
close(DAT); 

# Get Quantize
$BEAT = 60 / $bpm;
# Chose quantize length 1, half=0.5, quarter=0.25, 8th=0.125, 16th=0.0625, 32th=0.03125
$QUANT_LENGTH = $Array3[2];
$QUANTIZE = $BEAT * $QUANT_LENGTH;

#Amount sets amount of grove quantize Values between 0-1 ,0=0% 0.5=50%  1=100% etc
$AMOUNT = $Array3[1];

#Start Ofset changes the alighnment of the quantize.
$Start_Ofset = $Array3[3];                
$Start_Ofset = $BEAT * $Start_Ofset;      

#Quantize Lenght in beats i.e 4 = 1bar,  8 = 2bars, in 4/4 timesigneture
$Beats_Number = $Array3[0];

# Retrive Array from GQDATA txt
open(DAT,"C:/GQDATA.txt") || die;
while(<DAT>){
  chomp($_);           
  $value = $_;         
  push(@Array,$value); 
}
close(DAT); 

#Convert Array to seconds
foreach $var (@Array){
    $var = ($var - 1) / $bpm * 60;
    push(@Array2, "$var");
}
push(@Array2, 999999999);
push(@Array2, 0);

# Get number of items currently selected
my $Item_Count = RPR_CountSelectedMediaItems(0);
my $Item_Index = 0;
my $Array_Value = $Array2[0] - 2;

# Update Position for each selected item
while ($Item_Index < $Item_Count) {
    # Get ID for current item index
    my $Item_ID = RPR_GetSelectedMediaItem(0, $Item_Index);

    # Get Position value for current item
    my $D_POSITION = RPR_GetMediaItemInfo_Value($Item_ID, "D_POSITION"); 

    #Find which bar D_Position is in
    $OFSET = $D_POSITION - $Start_Ofset;
    $OFSET = $OFSET /60 * $bpm + 1;
    $OFSET = ($OFSET - 1) / $Beats_Number;
    $OFSET = int($OFSET); 
    $OFSET = ($OFSET * $Beats_Number) + 1;
    $OFSET = (($OFSET - 1) / $bpm) * 60;
    $OFSET = $OFSET + $Start_Ofset;
 
    # Find position left and right of Item position
    my $i=0;
    while(($Array2[$i] + $OFSET) < $D_POSITION ){ 
        $i++;                            
    }
    my $L_POSITION = $Array2[$i-1] + $OFSET;
    my $R_POSITION = $Array2[$i] + $OFSET; 

    # Comparison to find closest of the two quantize point
    if(($D_POSITION - $L_POSITION) <= ($R_POSITION - $D_POSITION)){
          if(($D_POSITION - $L_POSITION) > $QUANTIZE){
          } else {
              $L_POSITION = $D_POSITION - (($D_POSITION - $L_POSITION) * $AMOUNT);
              RPR_SetMediaItemInfo_Value($Item_ID, "D_POSITION", $L_POSITION);
          }
    } else {
          if(($R_POSITION - $D_POSITION) > $QUANTIZE){
          } else {
              $R_POSITION = $D_POSITION + (($R_POSITION - $D_POSITION) * $AMOUNT);
              RPR_SetMediaItemInfo_Value($Item_ID, "D_POSITION", $R_POSITION);
          }

    }
    $Item_Index++;

}
Config
Code:
# Groove quantize config
#
# Stiched together by Jedstar2000
# ..........USE AT YOUR OWN RICK.................


@Array = ();

use constant TITLE => "Groove Quantize Config";
use constant NUM_INPUTS => 4;
use constant CAPTIONS_CSV => "Quantize length in beats,Amount 0-1 ,Max Quant 8th=0.125 etc,Quantize Offset in Beats";
use constant MAX_RETVAL_LEN => 20;

my $retvals_csv = "4,1,0.125,0";

my @response = RPR_GetUserInputs(TITLE, NUM_INPUTS, CAPTIONS_CSV, $retvals_csv, MAX_RETVAL_LEN);

@Array = split(',',$response[4]);


# Create txt file DAT       
open(DAT,">C:/GQCONFIG.txt");

foreach $var (@Array){
    print DAT "$var\n";   
} 
close(DAT);
Info
Code:
# Groove quantize config
#
# Stiched together by Jedstar2000
# ..........USE AT YOUR OWN RISK.................


RPR_ShowConsoleMsg("Quantize length in beats   Default 4\n");
RPR_ShowConsoleMsg("4 = 1bar,  8 = 2bars, etc in 4x4 time signeture \n");
RPR_ShowConsoleMsg("\n");
RPR_ShowConsoleMsg("Amount 0-1   Default 1\n");
RPR_ShowConsoleMsg("Sets amount of quantize\n");
RPR_ShowConsoleMsg("0=0%, 0.3=30%, 0.75=75%, 1=100%, etc\n");
RPR_ShowConsoleMsg("\n");
RPR_ShowConsoleMsg("Max Quant 8th=0.125 etc  Default 0.125\n");
RPR_ShowConsoleMsg("Sets Max distance an item will move\n");
RPR_ShowConsoleMsg("half=0.5, quarter=0.25, 8th=0.125, 16th=0.0625, 32th=0.03125\n");
RPR_ShowConsoleMsg("\n");
RPR_ShowConsoleMsg("Quantize Offset in beats  Default 0\n");
RPR_ShowConsoleMsg("Pushes the quantize forward by offset length\n");
RPR_ShowConsoleMsg("1 = push quantize forward one beat \n");
RPR_ShowConsoleMsg("4 = push quantize forward one bar\n");
RPR_ShowConsoleMsg("0.125 = push quantize foward an 8th etc\n");
RPR_ShowConsoleMsg("\n");
RPR_ShowConsoleMsg("Enjoy Jed..........\n");
Save
Code:
# Groove quantize config
#
# Stiched together by Jedstar2000
# ..........USE AT YOUR OWN RICK.................


@Array = ();

use constant TITLE => "Groove Quantize Config";
use constant NUM_INPUTS => 1;
use constant CAPTIONS_CSV => "File Name";
use constant MAX_RETVAL_LEN => 20;

my $retvals_csv = "";

my @response = RPR_GetUserInputs(TITLE, NUM_INPUTS, CAPTIONS_CSV, $retvals_csv, MAX_RETVAL_LEN);

@Array = split(',',$response[4]);

# Retrive Array from DATA txt
my @Array2;
my $value;
open(DAT,"C:/GQDATA.txt") || die;
while(<DAT>){
  chomp($_);           
  $value = $_;         
  push(@Array2,$value); 
}
close(DAT); 

# Create txt file DAT       
open(DAT,">C:/$response[4].txt");

foreach $var (@Array2){
    print DAT "$var\n";   
} 
close(DAT);
Enjoy Jed ..........................

Teee Heeee I know it says "USE AT YOUR OWN RICK" but it just goes to show you don't need to be able to spell to code
__________________
...............Reaper the DIY DAW.....................
MultiTrack Editing Macros http://forum.cockos.com/showthread.php?t=50111
Hybrid Theme http://forum.cockos.com/showthread.php?t=131090

Last edited by jedstar2000; 12-30-2009 at 04:51 AM.
jedstar2000 is offline   Reply With Quote
Old 12-30-2009, 04:37 AM   #52
MikeLacey
Human being with feelings
 
Join Date: Dec 2006
Location: UK
Posts: 789
Default

Use "at your own rick" is a sort of signature

MIDI - what tasks do you need to do with MIDI notes? I have some ideas floating around for manipulating REAPER MIDI stuff, it would be a good excuse to write some helper functions and stuff.

Right... I'm going to see my Mom, I may be some time...

Mike
__________________
Mike Lacey, Leicestershire, UK
MikeLacey is offline   Reply With Quote
Old 12-30-2009, 05:04 AM   #53
jedstar2000
Human being with feelings
 
jedstar2000's Avatar
 
Join Date: Apr 2009
Location: Bristol uk
Posts: 1,006
Default

I would need to perform the same functions as I'm using with items.

I'm sure a translator could be written but it seems allot of hard work for something cockos may suddenly change.

1. I need to record all positions of notes in seconds or beats to an array.
2. I need to be able to move notes to a new position using a command.

I could then have two new scripts.
Capture groove quantize from midi item.
Apply groove quantize to midi item.

Which would only leave the loading of GQ files.
I know I can load them by passing a variable with the file name but this requires some careful typing.

I also could do with creating a folder so files aren't sat in the root of c:
I'm thinking of having a setup script that would setup a folder and create the initial config array.
__________________
...............Reaper the DIY DAW.....................
MultiTrack Editing Macros http://forum.cockos.com/showthread.php?t=50111
Hybrid Theme http://forum.cockos.com/showthread.php?t=131090
jedstar2000 is offline   Reply With Quote
Old 12-31-2009, 09:14 AM   #54
MikeLacey
Human being with feelings
 
Join Date: Dec 2006
Location: UK
Posts: 789
Default

That sounds fun...

Would be easier to store the position of notes using beats, rather than seconds. Note positions are stored by REAPER using ticks and (and get this) the default number of ticks per quarter note (QN) is 960

Note positions are relative to the last note or event, or the start of the Item. So if Items always started on a beat that would simplify things, but of course they don't. It does though, as Jeffos pointed out, make it easy (easier) to move a block of notes, or selected notes I guess.

You have an item from which you take groove data, and item(s) to which you apply that groove data.

Is it a requirement that all of the items start at the same point in the project time-line?

Is it a requirement that all of the items are the same length?

Would you want to quantise selected notes or all notes within an item?

I'm presuming that you'd want notes to drag control data around with them when they get moved (pitch change etc.) is that correct?
__________________
Mike Lacey, Leicestershire, UK
MikeLacey is offline   Reply With Quote
Old 01-01-2010, 10:21 AM   #55
jedstar2000
Human being with feelings
 
jedstar2000's Avatar
 
Join Date: Apr 2009
Location: Bristol uk
Posts: 1,006
Default

Happy new year

Please do have a crack at it your much braver than me.

Quote:
Originally Posted by MikeLacey View Post
That sounds fun...

Would be easier to store the position of notes using beats, rather than seconds. Note positions are stored by REAPER using ticks and (and get this) the default number of ticks per quarter note (QN) is 960

Note positions are relative to the last note or event, or the start of the Item. So if Items always started on a beat that would simplify things, but of course they don't. It does though, as Jeffos pointed out, make it easy (easier) to move a block of notes, or selected notes I guess.
Beats starting from zero would be perfect, The existing capture quantize script converts seconds to beats and equates to zero before saving the DATA file. So all you'd have to do would be accumulate and divide by 3840

Quote:
Originally Posted by MikeLacey View Post
You have an item from which you take groove data, and item(s) to which you apply that groove data.
Yes

Quote:
Originally Posted by MikeLacey View Post
Is it a requirement that all of the items start at the same point in the project time-line?
No

Quote:
Originally Posted by MikeLacey View Post
Is it a requirement that all of the items are the same length?
No the existing script can use any items anyware it will only use quantize points within the range set in the config .

Quote:
Originally Posted by MikeLacey View Post
Would you want to quantise selected notes or all notes within an item?
Item I think but either would be great

Quote:
Originally Posted by MikeLacey View Post
I'm presuming that you'd want notes to drag control data around with them when they get moved (pitch change etc.) is that correct?
I guess so but would be best have this as an option controlled by the config file.
__________________
...............Reaper the DIY DAW.....................
MultiTrack Editing Macros http://forum.cockos.com/showthread.php?t=50111
Hybrid Theme http://forum.cockos.com/showthread.php?t=131090
jedstar2000 is offline   Reply With Quote
Old 01-02-2010, 05:34 AM   #56
jedstar2000
Human being with feelings
 
jedstar2000's Avatar
 
Join Date: Apr 2009
Location: Bristol uk
Posts: 1,006
Default

What would be increadably useful would be a set of translator scripts.
small enough to cut and paste into existing scripts.

one to count how many notes in an item and give each note an index number.
one to retrieve (position , velocity, pitch) of indexed note.
one to change (position, velocity, pitch) of indexed note.

I hope this is possible as chunks are basically 16k tables.
Code:
e 4781 90 0e 01
e 240 80 0e 00
E 269 90 10 7f
E 240 80 10 00
E 240 b0 7b 00
This is how I Hope it would work (but I bet I completely wrong)
I'm guessing that 4781 represents an offset from the beginning of the project .
This should make building an array fairly simple.
Store all values to an array -1 and /5
This would give an array of just the positions relative to each other .
accumulate each value .
val 2 = val 2+val 1
val 3 = val 3 + val 2
etc
Divide the array values by 3840.
Walla we have an array of values we can use and if we want can be converted to seconds.

Then have a script that reverses the process and rebuilds the chunk???????

I can see this would only works as long as the table appears as above and would only works for note position.
__________________
...............Reaper the DIY DAW.....................
MultiTrack Editing Macros http://forum.cockos.com/showthread.php?t=50111
Hybrid Theme http://forum.cockos.com/showthread.php?t=131090
jedstar2000 is offline   Reply With Quote
Old 01-02-2010, 10:49 AM   #57
MikeLacey
Human being with feelings
 
Join Date: Dec 2006
Location: UK
Posts: 789
Default

Hi Jed. Happy New Year mate.

Ok - thinking aloud here.

On the face of it that's quite doable but there are a couple of things that are making me scratch my head a bit once you get into it.

"I'm guessing that 4781 represents an offset from the beginning of the project"

It's from the beginning of the MIDI item, rather than the beginning of the project.

That's easy enough, more difficult though is the issue below.

In your example...
  1. e 4781 90 0e 01
  2. e 240 80 0e 00
  3. E 269 90 10 7f
  4. E 240 80 10 00
  5. E 240 b0 7b 00
The '90' messages are 'note-on', the '80' messages are 'note-off' - so far so good. The last event (b0) is "all notes off". And just to be a pain, a '90' message with a velocity of 0 is a note-off message.

If this were the extent of MIDI messages all would be well but (and you knew there was going to be a 'but') between messages 1 and 2 above there could (easily) be a number of non-note messages such as hold-pedal-on/off, pitch-bend, mod-wheel-movement. There could quite legitimately be hundreds of messages between any of the note-on/off messages above. Have a look at http://www.cockos.com/wiki/index.php...Wheel_And_More for a real-world example. (look in a minute, it's quite messy)

Sticking with our neat-ish example for the moment though.
  1. e 4781 90 0e 01
    E 8 e0 64 40
    E 8 e0 75 40
    E 8 e0 06 41
    E 8 e0 16 41
    E 8 e0 27 41
  2. e 240 80 0e 00
    E 81 e0 06 41
    E 82 e0 16 41
    E 83 e0 27 41
    E 84 e0 0 41
  3. E 269 90 10 7f
  4. E 240 90 10 00
  5. E 240 b0 7b 00

I've inserted some pitch-change messages as they might well appear, which looks reasonable enough. You should note though that message 3 still has the same offset it did before (269) but there have been 4 messages inserted before it, each with an offset. So message number 3's position in the timeline has increased (been moved rightwards) by an offset of 5*8 (the messages between #1 & #2) and 81+82+83+84 (the messages between #2 & #3). And everything after #3 has been moved as well.

Still sticking with the pitch-change messages for the moment then - let's suppose that you and I make a rule that says - When we move a note (a note-on and note-off message pair that is) that we move any enclosed and trailing non-note data as well. Sounds reasonable and in the example above it works nicely if we want to move the first note-on/off pair to the end of the clip. We'd end up with a sequence of messages looking like this:
  1. E 269 90 10 7f
  2. E 240 90 10 00
  3. e 4781 90 0e 01
    E 8 e0 64 40
    E 8 e0 75 40
    E 8 e0 06 41
    E 8 e0 16 41
    E 8 e0 27 41
  4. e 240 80 0e 00
    E 81 e0 06 41
    E 82 e0 16 41
    E 83 e0 27 41
    E 84 e0 0 41
  5. E 240 b0 7b 00
Piece of cake in this instance, the non-note data "event" is contained within the two messages we're moving and all is well with the world.

Things aren't usually so simple though; a non-note event like pitch-change might easily extend over a series of notes - move a couple of notes from the middle of a long pitch change event to after or before the event and you end up with the pitch not being as it should be when you're done. (See the very last e0 message above which sets the pitch change back to zero)

I'll go and think some more.
__________________
Mike Lacey, Leicestershire, UK
MikeLacey is offline   Reply With Quote
Old 01-02-2010, 05:02 PM   #58
jedstar2000
Human being with feelings
 
jedstar2000's Avatar
 
Join Date: Apr 2009
Location: Bristol uk
Posts: 1,006
Default

WOW that makes my tax return look appealing .

On the up side the capture groove script looks promising.


First thoughts.
Moving pitch bend data etc is going to cause overlaps. The actual process of moving notes relative to each other becomes far simpler when everything is referenced from the same point.


move note 7,8, to position 4,5 (right hand columns is referenced from the beginning of the item. 3 = 1+2+3 etc)

Code:
Original             Moved         1+2+3.etc
1 100 on     100.....1 100 on      100
2 100 data   200.....2 100 data    200 
3 100 data   300.....3 100 data    300
4 100 off    400.....4 100 off     400
5 100 data   500     5 000 on      400
6 100 data   600     6 100 data    500  Overlapping data
7 100 on     700     7 000 off     500
8 1oo off    800     8 100 data    600
9 100 data   900     9 300 data    900
Hope this makes some sense .
Certainly looks lot a whole lot of work to me....
__________________
...............Reaper the DIY DAW.....................
MultiTrack Editing Macros http://forum.cockos.com/showthread.php?t=50111
Hybrid Theme http://forum.cockos.com/showthread.php?t=131090
jedstar2000 is offline   Reply With Quote
Old 01-03-2010, 04:10 AM   #59
jedstar2000
Human being with feelings
 
jedstar2000's Avatar
 
Join Date: Apr 2009
Location: Bristol uk
Posts: 1,006
Default

I had a bit of a sleep on this and have a couple of concerns.

1. How will we know which on note goes with which off note.
2. Overlaps and glitches in control data
3. Will this work with imported midi files.
Code:
e 8 9c 47 56           // Offset of 8, Note On Ch0xC, Note B4, Velocity 0x56
From this I can see we have direct control over note start, note pitch, note velocity. we also can identify to a certain degree which note on belongs to which note off .

Question: If you select notes does it automatically select control data aswell?:

Anyway what I propose as a proof of concept would be to ignore moving all control data and note off information . I know we still need to use it to add up the offsets but I don't think this is a problem.

The reason behind this is I think it will be more robust and produce the required result in 90% of the cases after all were only moving note a small amount and the user can always split the midi item into two one for notes and one for data which will allow the script to work.

Just my thoughts thanks for having a look at this
__________________
...............Reaper the DIY DAW.....................
MultiTrack Editing Macros http://forum.cockos.com/showthread.php?t=50111
Hybrid Theme http://forum.cockos.com/showthread.php?t=131090
jedstar2000 is offline   Reply With Quote
Old 01-03-2010, 04:55 AM   #60
MikeLacey
Human being with feelings
 
Join Date: Dec 2006
Location: UK
Posts: 789
Default

Hey Jed,

Let me have a think while I'm taking down the deccies.

Mike
__________________
Mike Lacey, Leicestershire, UK
MikeLacey is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:16 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.