GROOVE-PROGRAMMING


BEATBRO GROOVE API (the Groove Application Programmer Interface Help)- created and updated by DJ BEATSANOV,the Delphi and Pascal master.Here you'll find source code to some grooves you might want to create.Find out how to let your DOS or Windows application groove with the right BB pascal/delphi algorythm.

. NEW : PATTERN SOLUTIONS


BASICS

in this chapter we start with easy functions that allow us to play a Bassdrum,then a open-hihat & a closed hihat.You learn how the basic rhythm is built, how to use claps/snares.The samples can be wav windows files or OPL chip generated [midi instruments].For the actual sound functions contact us.

pattern : B...B...B...B...
procedure TechnoPattern_1(speed:integer); var x:byte; begin for x:=1 to 16 do begin if x mod 4=0 then KickBassdrum(volume,pan); delay(speed); end; end;
generates an easy techno 4-kicks beat.Pass the delay(speed in ms) as a parameter to this function.Pass volume and pan values to the 'kickbassdrum' function.You see a loop with 16 steps - a traditional drummachine steps.The mod operator is used to determiny 4 equal events for the bassdrum.


pattern : B...B...B...B...
pattern : ..O...O...O...O.

procedure TechnoPattern_2(speed:integer);
var
 x:byte;
begin
 for x:=1 to 16 do
  begin
   if x mod 3=0 then OpenHihat(volume,pan);
   if x mod 4=0 then KickBassdrum(volume,pan); 
   delay(speed);  
  end;
end;
generates an advanced techno 4-kicks/4 OHH beat.The mod operator is used to determiny 4 equal events for the bassdrum and 4 equal events for the OHH inbetween.



pattern : B...B...B...B...
pattern : ..O...O...O...O.
pattern : CCCCCCCCCCCCCCCC

procedure TechnoPattern_3(speed:integer);
var
 x:byte;
begin
 for x:=1 to 16 do
  begin 
   ClosedHiHat(volume,pan);
   if x mod 3=0 then OpenHihat(volume,pan);
   if x mod 4=0 then KickBassdrum(volume,pan); 
   delay(speed);  
  end;
end;
generates an advanced techno 4-kicks/4 OHH/16CHH beat.The mod operator is used to determiny 4 equal events for the bassdrum, 4 equal events for the OHH inbetween.Each step calls the ClosedHiHat.


USING CLAP AND SNARE
pattern : B...B...B...B...
pattern : ....C.......C...

procedure TechnoPatternClap_1(speed:integer);
var
 x:byte;
 trigger:boolean;
begin
 trigger:=true;
 for x:=1 to 16 do
  begin 
   if x mod 4=0 then KickBassdrum(volume,pan); 
   if x mod 8=0 then Clap(volume,pan);
   delay(speed);  
  end;
end;
generates a simple techno 4-kicks/2-claps beat.The mod operator is used to determiny 4 equal events for the bassdrum, and 2 equal events for the Clap.However we have only 2 claps : on each 2nd bassdrumkick,so we use a 8-mod step to slap 2 times.You can also use HitSnare(volume,pan) instead of clap.


PATTERN-SOLUTION

sometimes,you want to modify your drum pattern in a more complicated way,just like a drummachine.Here is a possible solution - you define a TPattern structure (it's a simple array of bytes[steps] for one instrument/drum).Then you fill it with a groove you want,pass it as a parameter to the PlayPattern function,modify the instrument playing-and you're done. pattern : B...B...B...B...

type TPattern=ARRAY[1..16] of byte;

const
 BassdrumP : TPattern =(255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0);
 
procedure PlayPattern(Pattern:TPattern;speed:integer);
var
 x:byte;
begin
 for x:=1 to 16 do
  begin 
   if Pattern[x]>0 then KickBassdrum(Pattern[x],pan); 
   delay(speed);  
  end;
end;

begin
 PlayPattern(BassdrumP,150);
end.
generates a simple techno 4-kicks beat using the BassdrumP pattern as a constant pattern.You can use the values stored in the TPattern array as volume-values or pan-values or instrument number for example.In the example we use it for the volume defenition (if it's zero,we do not activate it at all.)
you are the visitor #>




BACK TO THE MAIN PAGE