/** * This interface defines several useful constants used throughout * the mobile client code for ultrasound detection. * * @author Tony Offer * @author Chris Palistrant * @version 1.0 */ public interface Constants { // The sampling rate used for recording and used by the // ultrasound detection algorithm for various calculations. public static final float SAMPLING_RATE = 44100.0F; // A default target frequency for the ultrasound detection // algorithm. The target frequency is the frequency that the // ultrasound detection algorithm looks for in the audio signal. public static final float TARGET_FREQUENCY = 21000.0F; // The block size used by the Goertzel algorithm. This number // represents the amount of samples necessary to make a decision // as to the presence of the target frequency. public static final int N = 420; // The size, in bits, of the audio samples that will be recorded // while listening for ultrasound. Note that reading from a // Java data line for the purposes of recording audio returns a // stream of bytes, which do not necessarily contain the same // number of bits as the samples themselves. public static final int SAMPLE_SIZE = 16; // The number of channels used to record ultrasound //public static int CHANNELS = 1; // mono // Whether or not the recorded samples are signed. public static final boolean SIGN = true; // Whether or not the samples employ big endian encoding. public static final boolean BIGEND = false; // The threshold above which the magnitude returned by the // Goertzel algorithm for the target frequency is sufficient to // give a positive detection of the target frequency. public static final int THRESHOLD = 3500; }