public int[] getPitchShifts(String tuningscheme, double bendrange, int rootnote, int tuningnote, double tuningfreq) throws Exception, IndexOutOfBoundsException {	    
	
	Double[] pitchratios = getRatios(tuningscheme);
	int[] pitchshift = {0,0,0,0,0,0,0,0,0,0,0,0};
	
	// midi specs use a numerical value from (0 to 16383) with 8192 meaning no bend
	Boolean messagesent = false;	
	for(int nnote=0; nnote < 12; nnote++){
	    // convert frequency ratio from file into a midi pitch shift parameter
	    pitchshift[nnote] = 8192+(int)(8191.0*((12.0*Math.log(pitchratios[nnote])/Math.log(2.0))-nnote)/bendrange);
	    if((pitchshift[nnote] < 0)||(pitchshift[nnote] > 16383)){
		pitchshift[nnote] = 0;
		if(!messagesent){
		    Exception ex = new Exception("A pitch bend is out of range!  Your tuning is too extreme for this method.  Try using a tuning root closer to A440 or a tuning scheme closer to equal temperament.  Outputing garbage until you fix this.");
		    messagesent = true;
		    throw ex;
		}
	    }
	}

	// add offset to tune tuningnote to tuningfreq
	// This is what the frequency of the tuning note is in A440 TET
	double standardfreq = 440.0*Math.pow(2.0,((double)(tuningnote-9))/12.0);
	// This is how many semitones the desired frequency is from the freq above
	double semisoff = 12*Math.log(tuningfreq/standardfreq)/Math.log(2.0);
	// This is what the pitchshift should be for the tuningnote to achieve this
	int tunerootoffset = 8192 + (int)((8191.0*semisoff)/bendrange);
	// This is how many half-steps the tunintnote is above the rootnote
	int tuneaboveroot = tuningnote - rootnote;
	if(tuneaboveroot < 0)
	    tuneaboveroot += 12;
	// This is what we need to add to the tuningnote pitch shift to get it
	// to the right frequency.  So we'll move everything by this much
	int offset = tunerootoffset - pitchshift[tuneaboveroot];
	for(int nnote = 0; nnote < 12; nnote++){
	    pitchshift[nnote] += offset;
	    if((pitchshift[nnote] < 0)||(pitchshift[nnote] > 16383)){
		pitchshift[nnote] = 0;
		//System.out.println("Note: "+Integer.toString(nnote)+"  Pitchshift: "+Integer.toString(pitchshift[nnote])+"   Offset: "+Integer.toString(offset));
		if(!messagesent){
		    Exception ex = new Exception("A pitch bend is out of range!  Your tuning is too extreme for this method.  Try using a tuning root closer to A440 or a tuning scheme closer to equal temperament.  Outputing garbage until you fix this.");
		    messagesent = true;
		    //throw ex;
		}
	    }
	}

	return(pitchshift);
    }