Class MonoSampled
java.lang.Object
ca.phon.audio.AbstractSampled
ca.phon.audio.MonoSampled
- All Implemented Interfaces:
Sampled
A wrapper around a multi-channel sampled which returns
samples as an average of all channels.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Release resourcesfloatEnd time in secondsfloatGet length in secondsintGet the number of channels.intReturn the number of samplesfloatGet sample rate.floatGet start timeintloadSampleData(double[][] buffer, int offset, int firstSample, int numSamples) intsampleForTime(float time) Convert a time value to a sample indexdoublevalueForSample(int channel, int sample) Get value for sampledoublevalueForTime(int channel, float time) Get value for specified timeMethods inherited from class ca.phon.audio.AbstractSampled
getWindowExtrema, getWindowExtrema, getWindowExtrema, getWindowExtrema, getWindowExtrema, getWindowExtrema, maximumValue, maximumValue, minimumValue
-
Constructor Details
-
MonoSampled
-
-
Method Details
-
getNumberOfChannels
public int getNumberOfChannels()Description copied from interface:SampledGet the number of channels.- Returns:
- number of channels
-
getNumberOfSamples
public int getNumberOfSamples()Description copied from interface:SampledReturn the number of samples- Returns:
- number of samples
-
getSampleRate
public float getSampleRate()Description copied from interface:SampledGet sample rate.- Returns:
- sample rate (samples/second)
-
valueForSample
public double valueForSample(int channel, int sample) Description copied from interface:SampledGet value for sample- Parameters:
channel-sample- index
-
sampleForTime
public int sampleForTime(float time) Description copied from interface:SampledConvert a time value to a sample index- Parameters:
time- (in seconds)- Returns:
- sample index or -1 if time is outside Sampled data range
-
valueForTime
public double valueForTime(int channel, float time) Description copied from interface:SampledGet value for specified time- Parameters:
time-- Returns:
- value at specified time
-
getStartTime
public float getStartTime()Description copied from interface:SampledGet start time- Returns:
- start time in seconds
-
getEndTime
public float getEndTime()Description copied from interface:SampledEnd time in seconds- Returns:
- end time in seconds
-
getLength
public float getLength()Description copied from interface:SampledGet length in seconds- Returns:
- length in seconds
-
close
-
loadSampleData
public int loadSampleData(double[][] buffer, int offset, int firstSample, int numSamples)
-