/** * 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 number of UltrasoundAnalyzer threads to use in the // UltrasoundListener object's thread pool. This value can // be tweaked to improve performance since a greater number of // threads means more parallelism while too many threads means // wasted resources. Peak performance is achieved when each // of the threads in the thread pool are always busy but the // UltrasoundListener object does not have to wait for any // thread to become available when it has data to analyze. See // the UltrasoundListener class for more details. public static final int NUMTHREADS = 20; // The number of entries to keep in the recent history of room // determinations. When ultrasound is detected for a certain // room, the room string will be placed in a history of this // length. A larger history means that room determinations will // be more accurate, while a smaller history means that room // determinations will occur more quickly. public static final int HISTORY_SIZE = 20; // The average amount of time it takes for ultrasound to be // detected after receiving an 802.11 message (assuming the // ultrasound was generated concurrently with the 802.11). This // value was determined experimentally. It is in ms. public static final int AVG_DETECT_TIME = 544; // The maximum amount of time it takes for ultrasound to be // detected after receiving an 802.11 message (assuming the // ultrasound was generated concurrently with the 802.11). This // value was determined experimentally. It is in ms. public static final int MAX_DETECT_TIME = 839; // The number of received datagram messages to store while // waiting to receive ultrasound. public static final int ROOM_MSG_BUF = 10; }