private int getTone (int freq)	{
		int a,index=-1,lowVal=999,dif;
		// Store the highest and lowest frequencies detected
		if (freq>highFreq) highFreq=freq;
		else if (freq<lowFreq) lowFreq=freq;
		// Match the frequency to a tone number
		for (a=0;a<TONES.length;a++)	{
			dif=Math.abs(TONES[a]-freq);
			if (dif<lowVal)	{
				lowVal=dif;
				index=a;
			}
		}
		
		if ((index==0)&&(lowVal>40)) return -1;
		else if ((index==33)&&(lowVal>40)) return 34;
		else return index;
	}