Get some drum samples. These can be obtained by buying a sample disc, downloading free samples from the Internet or recording your own. The drum samples should have a sample rate of 44.1 Hz. Save these in a single file. Name the file "drum sample library."
Open your preferred programming environment.
Create a graphical user interface (GUI). The GUI should contain three sections. The first section will describe the time signature and metrical structure of the loop. Code a numerical text box to input tempo, a text box to enter the number of bars for a loop, two text boxes to give the time signature numerator and denominator and a numerical text box to enter the number of divisions to a beat. Label each box. The second section will contain an array of check boxes to be checked indicating when the drum beat will be played. This section will be refreshed based on the information of the first section. Code the third section to contain a "loop" check box, a button labeled "Play" and a button labeled "Save."
Code section 1. When any new number is entered into a numerical text box in section 1 (apart from the tempo), a new array of check boxes should be created in section 2. Code the array to have a list of the drum samples in the first column and an array of check boxes in the other columns. The number of rows in the array is the number of samples you are using. The number of columns in the array is the number of bars in the loop multiplied by the numerator of the time signature multiplied by the beat divisions.
Code section 3 "Play" button. When the play button is pressed, a sound file is created based on the check boxes from section 2. Create a vector of length = (60 * 44100 * meter numerator * number of bars) / tempo. For each column, add the sample of each checked box to the vector at the index = (60 * 44100 * column number) / tempo. Play the vector once and loop it as long as the loop check box is on.
Code section 3 "Save" Button. Save the vector as a sound file.