public final class AudioFile
extends java.lang.Object
Constructor and Description |
---|
AudioFile(java.lang.String filePath)
Create and transcode an audio file.
|
Modifier and Type | Method and Description |
---|---|
static java.util.List<AudioFile> |
audioFiles(java.lang.String... folders)
Returns a list of AudioFiles included in one or more folders.
|
javax.sound.sampled.AudioFileFormat |
fileFormat() |
double |
getLengthIn(TimeUnit unit) |
long |
getLengthInMilliSeconds()
Determines the length of the transcoded file (only audio data) in
microseconds.
|
double |
getMicrosecondsPositionOfFrame(long frame) |
long |
getSizeInBytes()
Determines the size of the transcoded audio data in bytes.
|
java.lang.String |
originalBasename() |
java.lang.String |
originalPath() |
void |
playCents(PitchDetectionMode detectionMode,
double from,
double to,
PitchUnit unit)
Detects pitch and plays plays the samples that are in the interval from,
to in the given pitch unit.
|
void |
playSelection(double from,
double to) |
void |
playSelections(double[] selections)
Play selections of the audio file.
|
java.lang.String |
toString() |
java.lang.String |
transcodedBasename() |
java.lang.String |
transcodedDirectory() |
java.lang.String |
transcodedPath() |
public AudioFile(java.lang.String filePath)
filePath
- the originalPath for the audio fileEncoderException
- If FFMPEG fails to transcode the audio an
UnsupportedAudioFileException is generated.public java.lang.String transcodedPath()
public java.lang.String transcodedDirectory()
public java.lang.String originalPath()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String originalBasename()
public java.lang.String transcodedBasename()
public static java.util.List<AudioFile> audioFiles(java.lang.String... folders)
folders
- The fopublic long getLengthInMilliSeconds()
public double getLengthIn(TimeUnit unit)
public double getMicrosecondsPositionOfFrame(long frame)
public long getSizeInBytes()
public javax.sound.sampled.AudioFileFormat fileFormat()
public void playSelection(double from, double to)
public void playSelections(double[] selections)
selections
- An interleaved array with in the form
[from,to,from,to,from,to...]. The from and to values are given
in seconds.public void playCents(PitchDetectionMode detectionMode, double from, double to, PitchUnit unit)
detectionMode
- The detection mode.from
- Interval start.to
- Interval stop.unit
- The pitch unit.