Package ca.phon.audio
Class ArraySampled
java.lang.Object
ca.phon.audio.AbstractSampled
ca.phon.audio.ArraySampled
- All Implemented Interfaces:
Sampled
-
Constructor Summary
ConstructorDescriptionArraySampled
(float sampleRate, double[][] samples) Create a new sampled from supplied data and sample rate -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Release resourcesfloat
End time in secondsfloat
Get length in secondsint
Get the number of channels.int
Return the number of samplesfloat
Get sample rate.float
Get start timeint
loadSampleData
(double[][] buffer, int offset, int firstSample, int numSamples) int
sampleForTime
(float time) Convert a time value to a sample indexdouble
valueForSample
(int channel, int sample) Get value for sampledouble
valueForTime
(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
-
ArraySampled
public ArraySampled(float sampleRate, double[][] samples) Create a new sampled from supplied data and sample rate- Parameters:
sampleRate
-samples
-
-
-
Method Details
-
getNumberOfChannels
public int getNumberOfChannels()Description copied from interface:Sampled
Get the number of channels.- Returns:
- number of channels
-
getNumberOfSamples
public int getNumberOfSamples()Description copied from interface:Sampled
Return the number of samples- Returns:
- number of samples
-
getSampleRate
public float getSampleRate()Description copied from interface:Sampled
Get sample rate.- Returns:
- sample rate (samples/second)
-
valueForSample
public double valueForSample(int channel, int sample) Description copied from interface:Sampled
Get value for sample- Parameters:
sample
- index
-
sampleForTime
public int sampleForTime(float time) Description copied from interface:Sampled
Convert 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:Sampled
Get value for specified time- Returns:
- value at specified time
-
getStartTime
public float getStartTime()Description copied from interface:Sampled
Get start time- Returns:
- start time in seconds
-
getEndTime
public float getEndTime()Description copied from interface:Sampled
End time in seconds- Returns:
- end time in seconds
-
getLength
public float getLength()Description copied from interface:Sampled
Get length in seconds- Returns:
- length in seconds
-
close
Description copied from interface:Sampled
Release resources- Throws:
IOException
-
loadSampleData
public int loadSampleData(double[][] buffer, int offset, int firstSample, int numSamples)
-