I want to transition from one note to another note very smoothly (portamento effect). So I am using two layers do accomplish this.
In first layer, I will play one note (default quarter duration) and then give silence (so that playing is not stopped)
In the second layer, I will go for pitch bend and gradually increase the pitch bend value in a loop to maximum of 1 semitone
Default duration = 0.25
Pitch bend depth = 1 semitone (set using #CC6, #CC100 and #CC101)
So pitch bend of 8192 = 1 semitone
Number of steps = 250
Pitch wheel value per step = 8192/250
Duration of each step = 0.25/250
So ina loop, I am increasing PW in steps of 8192/250 and each step is of 0.25/250 duration. I am getting the effect correctly.
Now my question is, what is the minimum duration required so that MIDI controller is able to play? Where can I find the spec? If I go for 300 steps (duration = 1/1200), I do not see pitch bend effect. So I guess it is because the duration is too small.
Example code (using Jfugue Library) for those who are familiar with JFugue music library.
Player player = new Player();
Pattern pattern = new Pattern();
pattern.add(" T100 V0 L0 I40 :CON(100,0) :CON(101,0) :CON(6,1) C R3 L1");
int PW = 8192; // Default Pitch Bend
int steps=250; // Let us consider 250 steps in one semitone
double duration = 0.25/steps; // Duration of each step
int PWValue=8192/steps; // This is the value of pitch bend to be changed gradually
for(int i=0;i<steps;i++) // S1 to R1
{
PW=PW+PWValue;
pattern.add(" R/"+duration +" :PW("+PW+") ");
}
player.play(pattern);
Sorry, the JFugue code was not put inside the code block and seems to be corrupted. Could not edit the post after posting and hence updating it here,
[code type=markup]
player.play("C D E F G E F D C");
pattern.add(" T100 V0 L0 I40 :CON(100,0) :CON(101,0) :CON(6,1) C R3 L1");
int PW = 8192; // Default Pitch Bend
int steps=250; // Let us consider 250 steps in one semitone
double duration = 0.25/steps; // Duration of each step
int PWValue=8192/steps; // This is the value of pitch bend to be changed gradually
for(int i=0;i<steps;i++) // S1 to R1
{
PW=PW+PWValue;
pattern.add(" R/"+duration +" :PW("+PW+") ");
}
player.play(pattern);
[/code]
How fast a device can handle messages depends only on the device itself.
What synthesizer are you using?
Are you using a real MIDI cable (which would have a limit of about 1000 3-byte messages per second)?
(I don't know JFugue, or how it specifies timestamps.)
I am working with i3 Dell Inspiron laptop 3000 series. I am not sure of the synthesizer it supports.