jAudioFeatureExtractor.jAudioTools
クラス DSPMethods

java.lang.Object
  上位を拡張 jAudioFeatureExtractor.jAudioTools.DSPMethods

public class DSPMethods
extends java.lang.Object

A holder class for general static methods relating to processing signals in the form of samples stored as arrays of doubles.

作成者:
Cory McKay

コンストラクタの概要
DSPMethods()
           
 
メソッドの概要
static double[][] applyGain(double[][] samples, double gain)
          Applies a gain to the given samples.
static double convertSampleToTime(int sample, float sampling_rate)
          Returns the time corresponding to the given sample indice with the given sampling rate.
static int convertTimeToSample(double time, float sampling_rate)
          Returns the sample corresponding to the given time with the given sampling rate.
static double[] getAutoCorrelation(double[] signal, int min_lag, int max_lag)
          Calculates the auto-correlation of the given signal.
static double[] getAutoCorrelationLabels(double sampling_rate, int min_lag, int max_lag)
          Returns the bin labels for each bin of an auto-correlation calculation that involved the given paremeters (most likely using the getAutoCorrelation method).
static double[][] getCopyOfSamples(double[][] original_samples)
          Returns a copy of the given array of samples.
static double[] getSamplesMixedDownIntoOneChannel(double[][] audio_samples)
          Returns the given set of samples as a set of samples mixed down into one channel.
static double[] normalizeSamples(double[] samples_to_normalize)
          Normalizes the given samples so that the absolute value of the highest sample amplitude is 1.
static double[][] normalizeSamples(double[][] samples_to_normalize)
          Normalizes the given samples dependantly so that the absolute value of the highest sample amplitude is 1.
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

DSPMethods

public DSPMethods()
メソッドの詳細

applyGain

public static double[][] applyGain(double[][] samples,
                                   double gain)
Applies a gain to the given samples. Note that a negative gain effectively applies a phase shift of pi. There is no guarantee that the returned samples will be between -1 and +1. The returned samples are copies, so changes to them will not affect the original samples.

パラメータ:
samples - Audio samles to modify, usually with a minimum value of -1 and a maximum value of +1. The first indice corresponds to the channel and the second indice corresponds to the sample number.
gain - The gain to apply.
戻り値:
The given audio samples after the application of the given gain.

getSamplesMixedDownIntoOneChannel

public static double[] getSamplesMixedDownIntoOneChannel(double[][] audio_samples)
Returns the given set of samples as a set of samples mixed down into one channel.

パラメータ:
audio_samples - Audio samles to modify, with a minimum value of -1 and a maximum value of +1. The first indice corresponds to the channel and the second indice corresponds to the sample number.
戻り値:
The given audio samples mixed down, with equal gain, into one channel.

normalizeSamples

public static double[] normalizeSamples(double[] samples_to_normalize)
Normalizes the given samples so that the absolute value of the highest sample amplitude is 1. Does nothing if also samples are 0.

パラメータ:
samples_to_normalize - The samples to normalize.
戻り値:
Returns a copy of the given samples after normalization.

normalizeSamples

public static double[][] normalizeSamples(double[][] samples_to_normalize)
Normalizes the given samples dependantly so that the absolute value of the highest sample amplitude is 1. Does nothing if all samples are 0.

パラメータ:
samples_to_normalize - The samples to normalize. The first indice denotes channel and the second denotes sample number.
戻り値:
Returns a copy of the given samples after normalization.

getCopyOfSamples

public static double[][] getCopyOfSamples(double[][] original_samples)
Returns a copy of the given array of samples.

パラメータ:
original_samples - Audio samles to modify, usually with a minimum value of value of- 1 and a maximum value of +1. The first indice corresponds to the channel and the second indice corresponds to the sample number.
戻り値:
A copy of the original_samples parameter.

convertTimeToSample

public static int convertTimeToSample(double time,
                                      float sampling_rate)
Returns the sample corresponding to the given time with the given sampling rate.

パラメータ:
time - The time in seconds to convert to a sample indice.
sampling_rate - The sampling rate of the audio in question.
戻り値:
The corresponding sample indice.

convertSampleToTime

public static double convertSampleToTime(int sample,
                                         float sampling_rate)
Returns the time corresponding to the given sample indice with the given sampling rate.

パラメータ:
sample - The sample indice to convert to time.
sampling_rate - The sampling rate of the audio in question.
戻り値:
The corresponding time in seconds.

getAutoCorrelation

public static double[] getAutoCorrelation(double[] signal,
                                          int min_lag,
                                          int max_lag)
Calculates the auto-correlation of the given signal. The auto-correlation is only calculated between the given lags.

The getAutoCorrelationLabels method can be called to find the labels in Hz for each of the returned bins.

パラメータ:
signal - The digital signal to auto-correlate.
min_lag - The minimum lag in samples to look for in the auto-correlation.
max_lag - The maximum lag in samples to look for in the auto-correaltion.
戻り値:
The auto-correlation for each lag from min_lag to max_lag. Entry 0 corresponds to min_lag, and the last entry corresponds to max_lag.

getAutoCorrelationLabels

public static double[] getAutoCorrelationLabels(double sampling_rate,
                                                int min_lag,
                                                int max_lag)
Returns the bin labels for each bin of an auto-correlation calculation that involved the given paremeters (most likely using the getAutoCorrelation method).

パラメータ:
sampling_rate - The sampling rate that was used to encode the signal that was auto-correlated.
min_lag - The minimum lag in samples that was used in the auto-correlation.
max_lag - The maximum lag in samples that was used in the auto-correlation.
戻り値:
The labels, in Hz, for the corresponding bins produced by the getAutoCorrelation method.