edu.berkeley.guir.ptk.input
Class AudioInput

java.lang.Object
  extended byedu.berkeley.guir.ptk.PTK
      extended byedu.berkeley.guir.ptk.input.InputSource
          extended byedu.berkeley.guir.ptk.input.AudioInput
All Implemented Interfaces:
java.lang.Runnable

public class AudioInput
extends InputSource

Gets a volume and eight frequence samples from a microphone, creates an Event including them all, and dispatches it. The metadata of the events this class creates is AudioConstants.AUDIO. The data IDs are AudioConstants.VOLUME, and one of the AudioConstants.FREQUENCY[number] IDs.

Author:
tmatthew

Field Summary
 float[] freqs
           
static java.lang.String MY_ID
           
 float[] tmp_freqs
           
 float volume
           
 
Fields inherited from class edu.berkeley.guir.ptk.input.InputSource
history, mds, my_id, my_ip, time_between_events
 
Fields inherited from class edu.berkeley.guir.ptk.PTK
debug, MAX_DEBUG, MED_DEBUG, MIN_DEBUG, NO_DEBUG
 
Constructor Summary
AudioInput()
          Constructors for non-distributed applications.
AudioInput(Abstractor abs)
          Constructor for non-distributed applications that abstracts on the inputs side.
AudioInput(Abstractor[] abs)
          Constructor for non-distributed applications that abstracts on the inputs side.
AudioInput(java.lang.String my_ip)
          Constructors for non-distributed applications.
 
Method Summary
protected  float[] copyFreqs(float[] f)
           
static void main(java.lang.String[] argv)
          Starts this Input with the IP address AudioConstants.DEFAULT_INPUT_IP and sets the time between events to AudioConstants.DEFAULT_AUDIO_TIME_BETWEEN_EVENTS.
 Events newInput()
          Gets input from the data source, fills an EVent with it, and returns the Event.
protected  void setFreqsToZero()
           
 
Methods inherited from class edu.berkeley.guir.ptk.input.InputSource
addMetadata, addMetadataItem, addMyMetadataToEvent, dispatchEvent, finalize, getAbstractThenSendInputEvent, getMetadata, getMetadataItemsAsArray, getThenSendInputEvent, register, run, setMetadata, setTimeBetweenEvents, startInput
 
Methods inherited from class edu.berkeley.guir.ptk.PTK
getMAX, getMED, getMIN, getNO, printDebug, printDebug, printError
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MY_ID

public static final java.lang.String MY_ID
See Also:
Constant Field Values

freqs

public float[] freqs

tmp_freqs

public float[] tmp_freqs

volume

public float volume
Constructor Detail

AudioInput

public AudioInput()
Constructors for non-distributed applications. An input that uses this constructor cannot be part of an application on another machine.


AudioInput

public AudioInput(java.lang.String my_ip)
Constructors for non-distributed applications. An input that uses this constructor cannot be part of an application on another machine.


AudioInput

public AudioInput(Abstractor abs)
Constructor for non-distributed applications that abstracts on the inputs side.


AudioInput

public AudioInput(Abstractor[] abs)
Constructor for non-distributed applications that abstracts on the inputs side.

Method Detail

newInput

public Events newInput()
Gets input from the data source, fills an EVent with it, and returns the Event.

Specified by:
newInput in class InputSource

setFreqsToZero

protected void setFreqsToZero()

copyFreqs

protected float[] copyFreqs(float[] f)

main

public static void main(java.lang.String[] argv)
Starts this Input with the IP address AudioConstants.DEFAULT_INPUT_IP and sets the time between events to AudioConstants.DEFAULT_AUDIO_TIME_BETWEEN_EVENTS. Can instead take one command line parameter: (1) IP address where this Input is running.

Parameters:
argv - IP address where this Input is running, as a String.