Sautrela

edu.gtts.sautrela.sp
Class VoiceActivityDetector

java.lang.Object
  extended by edu.gtts.sautrela.engine.AbstractDataProcessor
      extended by edu.gtts.sautrela.sp.VoiceActivityDetector
All Implemented Interfaces:
DataProcessor, java.beans.BeanInfo, java.io.Serializable

public class VoiceActivityDetector
extends AbstractDataProcessor

An energy based Voice Activity Detector. Adds a voiced/unvoiced boolean mask to a DataStream. Frames with an energy level lower than max(energy)-threshold (in dB), are considered to be unvoiced. A boolean array representing the voice mask is added to the DataBeginStream by means of a propperty called VADFlag.

Author:
mpenagar
See Also:
DataStreamBegin.getProperty(String), Serialized Form

Field Summary
static double DEFAULT_THRESHOLD
          default energy threshold = 30dB
 
Fields inherited from interface java.beans.BeanInfo
ICON_COLOR_16x16, ICON_COLOR_32x32, ICON_MONO_16x16, ICON_MONO_32x32
 
Constructor Summary
VoiceActivityDetector()
          Creates a new instance of VoiceActivityDetector
 
Method Summary
 void editBeanInfo(java.beans.BeanInfo info)
           
 double getThreshold()
          Getter for property threshold.
static void main(java.lang.String[] args)
           
 void process(Buffer in, Buffer out)
          Processes the input Data.
 void setThreshold(double threshold)
          Setter for property threshold.
static boolean[] transformVADFlag(boolean[] flag, int windowSize, int shift, int leftSkip, int rightSkip, int minVoiceCount)
          Utility method for converting VAD flags.
 
Methods inherited from class edu.gtts.sautrela.engine.AbstractDataProcessor
getAdditionalBeanInfo, getBeanDescriptor, getDefaultEventIndex, getDefaultPropertyIndex, getEventSetDescriptors, getIcon, getMethodDescriptors, getName, getPropertyDescriptors, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_THRESHOLD

public static final double DEFAULT_THRESHOLD
default energy threshold = 30dB

See Also:
Constant Field Values
Constructor Detail

VoiceActivityDetector

public VoiceActivityDetector()
Creates a new instance of VoiceActivityDetector

Method Detail

getThreshold

public double getThreshold()
Getter for property threshold.

Returns:
Value of property threshold.

setThreshold

public void setThreshold(double threshold)
Setter for property threshold.

Parameters:
threshold - New value of property threshold.

transformVADFlag

public static boolean[] transformVADFlag(boolean[] flag,
                                         int windowSize,
                                         int shift,
                                         int leftSkip,
                                         int rightSkip,
                                         int minVoiceCount)
Utility method for converting VAD flags. DataProcessors that break the synchronization between the VAD flags and stream data (for example Deltas and SDC) must transform the VADFlag too. This utility method performs a sliding windowing transformation of an existing VADflag array:

outFlag(i) = numberOfTrue(window(i)) >= minVoiceCount ? true : false

The returned array length is:

outFlag.length = (flag.length - leftSkip - rightSkip - windowSize + shift) / shift

Parameters:
flag - The source VADflag array.
windowSize - The sliding window size
shift - The sliding window shift
leftSkip - The number of values to skipt at the left
rightSkip - The number of values to skipt at the rigth
minVoiceCount - Minimum number of voiced values in the window to generate a voiced output

process

public void process(Buffer in,
                    Buffer out)
             throws DataProcessorException
Processes the input Data.

Parameters:
in - Input Buffer
out - Output Buffer
Throws:
DataProcessorException

editBeanInfo

public void editBeanInfo(java.beans.BeanInfo info)
Overrides:
editBeanInfo in class AbstractDataProcessor

main

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

Sautrela