Hey there.
I'm very very new to C and am having some trouble with a program I'm writing. The program is meant to improvise around a scale and do a different sequence everytime. However every time I start the program it does the exact same sequence despite it using random numbers.
Code:
#include "stdlib.h"
#include "midi_lib.h"
int main(void)
{
/* Declare integer variables for specifying a note */
int pitch, channel, velocity, offset, key;
int i, bar_duration, note_duration;
int velocity_reduction = 32;
int program_quit=0;
int scale_note;
int major_scale[8] = {0, 2, 4, 5, 7, 9, 11, 12};
int minor_scale[8] = {0, 2, 3, 5, 7, 8, 10, 12};
int mixolydian_scale[8] = {0, 2, 4, 5, 7, 9, 10, 12};
key = 60; /* middle C */
channel = 1;
velocity = 64; /* mediu loudness */
bar_duration = 4*400; /* the first four notes take this time */
midi_start();
while (!program_quit)
{
midi_note(key + mixolydian_scale[(rand() % (8+1-0))+0], 1, 64);
pause((rand() % (500+1-125)) + 125);
midi_note(key + mixolydian_scale[(rand() % (8+1-0))+0], 1, 0);
}
midi_close();
return 0;
}
any help and advice would be much appreciated.
Cheers in advance
dogma93