public class MaryAudioUtils extends Object
Constructor and Description |
---|
MaryAudioUtils() |
Modifier and Type | Method and Description |
---|---|
static AudioInputStream |
createSingleAudioInputStream(Vector<AudioInputStream> audioInputStreams)
Create a single AudioInputStream from a vector of AudioInputStreams.
|
static AudioFileFormat.Type |
getAudioFileFormatType(String name)
Return an audio file format type for the given string.
|
static double[] |
getSamplesAsDoubleArray(AudioInputStream ais) |
static void |
playWavFile(String filename,
int loop)
Play back a file loop times (0 = only once).
|
static void |
playWavFile(String filename,
int loop,
boolean waitUntilCompleted)
Play back a file loop times (0 = only once).
|
static void |
stopWavFile()
Stop wav play back
|
static void |
timedRecord(File targetFile,
long millis,
AudioFormat audioFormat)
Record a sound file with the recording being limited to a given amount of time
|
static void |
timedRecord(String filename,
long millis,
AudioFormat audioFormat)
Record a sound file with the recording being limited to a given amount of time
|
static void |
writeWavFile(double[] x,
String outputFile,
AudioFormat format) |
public static AudioInputStream createSingleAudioInputStream(Vector<AudioInputStream> audioInputStreams)
audioInputStreams
- a vector containing one or more AudioInputStreams.NullPointerException
- if any of the arguments are nullIllegalArgumentException
- if the vector contains no elements, any element is not an AudioInputStream.public static AudioFileFormat.Type getAudioFileFormatType(String name)
name
- namepublic static void timedRecord(String filename, long millis, AudioFormat audioFormat)
filename
- name of the sound filemillis
- the given amount of time in millisecondsaudioFormat
- the audio format for the actual sound filepublic static void timedRecord(File targetFile, long millis, AudioFormat audioFormat)
targetFile
- name of the sound filemillis
- the given amount of time in millisecondsaudioFormat
- the audio format for the actual sound filepublic static void playWavFile(String filename, int loop)
filename
- name of the wav fileloop
- number of times the file should be repeated (0 = play only once).public static void playWavFile(String filename, int loop, boolean waitUntilCompleted)
filename
- name of the wav fileloop
- number of times the file should be repeated (0 = play only once).waitUntilCompleted
- whether or not to wait until the file has finished playing before returning.public static void stopWavFile()
public static double[] getSamplesAsDoubleArray(AudioInputStream ais)
public static void writeWavFile(double[] x, String outputFile, AudioFormat format) throws IOException
IOException
Copyright © 2000–2016 DFKI GmbH. All rights reserved.