print_on()
set_option("full_duplex_on", "CLOBBER_ON")
rtsetparams(44100, 2)
load("VMSTRUM")
rtinput("AUDIO")
rtoutput("Aug3.snd")


tempo = 120
whole = 4
half = 2
quarter = 1
eigth = 0.5

start = 0 /* start time for chords */
st = 0 /* start time for bass line */

num_chords = getchordinfo("DataFiles/chordfile.dat") /* data file with chord progression */

/* play chords */
for (i = 0; i < num_chords; i = i + 1){

dur = getdur(i, tempo) /* duration for current chord */

/* check if whole dur */
if ( dur == whole*(60.0/tempo)){

for(j = 0; j < whole; j = j + 1){

if( (j==0) && (i==0)){

VMSTART(st, .50, (getpitch(i, j)-2.0), .50, 0.1,
40000, 1, 0.5, 1, 0)

}
else

VMSTART(st, .50, (getpitch(i, j)-2.0), .50, 0.1,
40000, 1, 0.5, 1, 1)
st = st + 0.5

}//end for

}//end if


/* check if half duration */
if ( dur == half*(60.0/tempo)){

for(j = 0; j < half; j = j + 1){

if( (j==0) && (i==0))

VMSTART(st, .5, (getpitch(i, j)-2.0), .5, 0.1,
40000, 1, 0.5, 1, 0)

else

VMSTART(st, .5, (getpitch(i, j)-2.0), .5, 0.1,
40000, 1, 0.5, 1, 1)

st = st + .5

}

}

/* play chords */
VMSTART(start, dur, getpitch(i, 0), dur, 0.1,
30000, 1, 0.5, 1, 0)

VMSTART(start, dur, getpitch(i, 1), dur, 0.1,
30000, 1, 0.5, 1, 1)

VMSTART(start, dur, getpitch(i, 2), dur, 0.1,
30000, 1, 0.5, 1, 1)

VMSTART(start, dur, getpitch(i, 3), dur, 0.1,
30000, 1, 0.5, 1, 1)

start = start + dur

}