private int getOctave(double freq) {
		if (freq > defaultSaFrequency) {
			int octave = 0;
			do {
				if ( (defaultSaFrequency * (octave + 1) <= freq) && freq < (2*(defaultSaFrequency * (octave+1))) ) {
					return octave;
				} else {
					octave++;
				}
			}while(true);
		} else if (freq < defaultSaFrequency) {
			int octave = 0;
			do {
				if ( (defaultSaFrequency/(2*(octave+1)) <= freq) && (freq < defaultSaFrequency/(octave+1))  ) {
					return -(octave+1);
				} else {
					octave++;
				}
			}while(true);
		} else {
			return 0;
		}
	}