marytts.signalproc.process
Class PhaseVocoder

java.lang.Object
  extended by marytts.util.data.BaseDoubleDataSource
      extended by marytts.util.data.BufferedDoubleDataSource
          extended by marytts.util.data.BlockwiseDoubleDataSource
              extended by marytts.signalproc.process.FrameOverlapAddSource
                  extended by marytts.signalproc.process.PhaseVocoder
All Implemented Interfaces:
DoubleDataSource

public class PhaseVocoder
extends FrameOverlapAddSource

A phase vocoder implementation for time stretching. Phase unwrapping is performed.

Author:
Marc Schröder

Nested Class Summary
 class PhaseVocoder.PhaseUnwrapper
           
 
Field Summary
static int DEFAULT_FRAMELENGTH
           
protected  double rateChangeFactor
           
 
Fields inherited from class marytts.signalproc.process.FrameOverlapAddSource
DEFAULT_WINDOWTYPE, frameProvider, memory, outputWindow, processor
 
Fields inherited from class marytts.util.data.BlockwiseDoubleDataSource
blockSize
 
Fields inherited from class marytts.util.data.BufferedDoubleDataSource
buf, dataProcessor, DEFAULT_BUFFERSIZE, readPos, writePos
 
Fields inherited from class marytts.util.data.BaseDoubleDataSource
dataLength, inputSource
 
Fields inherited from interface marytts.util.data.DoubleDataSource
NOT_SPECIFIED
 
Constructor Summary
PhaseVocoder(DoubleDataSource inputSource, int samplingRate, double rateChangeFactor)
           
 
Method Summary
 int computeOutputLength(int inputLengthInSamples)
          Based on the given rate change factor, compute the exact length change factor for a given signal length, based on the current frame length and input/output frame shifts.
protected  int getInputFrameshift(int outputFrameshift)
           
static void main(java.lang.String[] args)
           
 
Methods inherited from class marytts.signalproc.process.FrameOverlapAddSource
getBlockSize, getNextFrame, hasMoreData, initialise, prepareBlock, readBlock
 
Methods inherited from class marytts.util.data.BlockwiseDoubleDataSource
readIntoBuffer
 
Methods inherited from class marytts.util.data.BufferedDoubleDataSource
available, bufferSpaceLeft, compact, currentlyInBuffer, getData, increaseBufferSize
 
Methods inherited from class marytts.util.data.BaseDoubleDataSource
getAllData, getData, getData, getDataLength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FRAMELENGTH

public static final int DEFAULT_FRAMELENGTH
See Also:
Constant Field Values

rateChangeFactor

protected double rateChangeFactor
Constructor Detail

PhaseVocoder

public PhaseVocoder(DoubleDataSource inputSource,
                    int samplingRate,
                    double rateChangeFactor)
Parameters:
inputSource -
frameLength -
samplingRate -
rateChangeFactor - the factor by which to speed up or slow down the source. Values greater than one will speed up, values smaller than one will slow down the original.
Method Detail

getInputFrameshift

protected int getInputFrameshift(int outputFrameshift)
Overrides:
getInputFrameshift in class FrameOverlapAddSource

computeOutputLength

public int computeOutputLength(int inputLengthInSamples)
Based on the given rate change factor, compute the exact length change factor for a given signal length, based on the current frame length and input/output frame shifts. From the illustrations in @see{FrameOverlapAddSource}, it can be seen that for a given frame length f and frame shift s, the length of a signal can be described as l(n) = f + n*s - delta. f is fixed; s is si for input frameshift, so for output frameshift. For a given input length, one can compute n and rest and thus compute the output length.

Returns:
the output length

main

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