framed
Class Window

java.lang.Object
  extended by framed.Window
All Implemented Interfaces:
FrameSource
Direct Known Subclasses:
HammingWindow, HannWindow, RectangularWindow

public abstract class Window
extends java.lang.Object
implements FrameSource


Constructor Summary
Window(AudioSource source)
          Create a default Hamming windos (16ms size, 10ms shift)
Window(AudioSource source, int windowLength, int shiftLength)
          Create a Hamming window using given frame shift length
 
Method Summary
static Window create(AudioSource source, java.lang.String parameterString)
          Generate a new Window object using the parameter string and AudioSource
 int getFrmeSize()
          Get the number of samples within one frame (i.e.
 int getNumberOfFramesPerSecond()
           
 int getShift()
           
static void main(java.lang.String[] args)
           
 boolean read(double[] buf)
          Extract the next frame from the audio stream using a window function
 void setShiftLength(int shiftLength)
           
 void setWindowLength(int windowLength)
           
 void setWindowSpecs(int windowLength, int shiftLength)
           
 java.lang.String toString()
          Return a String representation of the FrameSource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface framed.FrameSource
getFrameSize
 

Constructor Detail

Window

public Window(AudioSource source)
Create a default Hamming windos (16ms size, 10ms shift)

Parameters:
source - AudioSource to read from

Window

public Window(AudioSource source,
              int windowLength,
              int shiftLength)
Create a Hamming window using given frame shift length

Parameters:
source - AudioSource to read from
windowLength - Frame length in milli-seconds
shiftLength - Shift length in milli-seconds
Method Detail

create

public static Window create(AudioSource source,
                            java.lang.String parameterString)
                     throws MalformedParameterStringException
Generate a new Window object using the parameter string and AudioSource

Parameters:
source -
parameterString - "hamm|hann|rect,length-ms,shift-ms"
Returns:
Throws:
MalformedParameterStringException

getFrmeSize

public int getFrmeSize()
Get the number of samples within one frame (i.e. the dimension of the feature vector)

Returns:
number of samples within one frame

getNumberOfFramesPerSecond

public int getNumberOfFramesPerSecond()

getShift

public int getShift()

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

read

public boolean read(double[] buf)
             throws java.io.IOException
Extract the next frame from the audio stream using a window function

Specified by:
read in interface FrameSource
Parameters:
buf - buffer to save the signal frame
Returns:
true on success, false if the audio stream terminated before the window was filled
Throws:
java.io.IOException

setShiftLength

public void setShiftLength(int shiftLength)

setWindowLength

public void setWindowLength(int windowLength)

setWindowSpecs

public void setWindowSpecs(int windowLength,
                           int shiftLength)

toString

public java.lang.String toString()
Description copied from interface: FrameSource
Return a String representation of the FrameSource

Specified by:
toString in interface FrameSource
Overrides:
toString in class java.lang.Object