|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectddf.minim.Minim
public class Minim
The Minim class is how you get what you want from JavaSound.
There are methods for obtaining objects for playing audio files:
AudioSample, AudioSnippet, and AudioPlayer. There
are methods for obtaining an AudioRecorder, which is how you record
audio to disk. There are methods for obtaining an AudioInput, which
is how you can monitor the computer's line-in or microphone, depending on
what the user has set as the record source. Finally there are methods for
obtaining an AudioOutput, which is how you can play audio generated
by your program. All of these classes are given AudioStreams
by Minim, which are Threads that do the actual work
of audio I/O. Because of this, you should always call the close
method of an AudioXXX when you are finished with it.
Minim needs to know about your sketch so that it can load files
from the sketch's data directory. For this reason, you must pass a PApplet to the
constructor.
| Field Summary | |
|---|---|
static javax.sound.sampled.AudioFileFormat.Type |
AIFC
The .aifc file format. |
static javax.sound.sampled.AudioFileFormat.Type |
AIFF
The .aiff file format. |
static javax.sound.sampled.AudioFileFormat.Type |
AU
The .au file format. |
static int |
LOOP_CONTINUOUSLY
|
static int |
MONO
Specifies that you want a MONO AudioInput or AudioOutput |
static javax.sound.sampled.AudioFileFormat.Type |
SND
The .snd file format. |
static int |
STEREO
Specifies that you want a STEREO AudioInput or AudioOutput |
static javax.sound.sampled.AudioFileFormat.Type |
WAV
The .wav file format. |
| Constructor Summary | |
|---|---|
Minim(processing.core.PApplet parent)
Creates an instance of Minim that will use the Javasound implementation. |
|
Minim(processing.core.PApplet parent,
MinimServiceProvider msp)
Creates an instance of Minim that will use the provided implementation for audio. |
|
| Method Summary | |
|---|---|
AudioRecorder |
createRecorder(Recordable source,
java.lang.String fileName,
boolean buffered)
Creates an AudioRecorder that will use source as its
record source and that will save to the file name specified. |
AudioSample |
createSample(float[] samples,
javax.sound.sampled.AudioFormat format)
Creates an AudioSample using the provided samples and AudioFormat,
with an output buffer size of 1024 samples. |
AudioSample |
createSample(float[] samples,
javax.sound.sampled.AudioFormat format,
int bufferSize)
Creates an AudioSample using the provided samples and AudioFormat,
with the desired output buffer size. |
AudioSample |
createSample(float[] left,
float[] right,
javax.sound.sampled.AudioFormat format)
Creates an AudioSample using the provided left and right channel samples
with an output buffer size of 1024. |
AudioSample |
createSample(float[] left,
float[] right,
javax.sound.sampled.AudioFormat format,
int bufferSize)
Creates an AudioSample using the provided left and right channel samples. |
static void |
debug(java.lang.String s)
Displays a debug message, but only if debugOn() has been called. |
void |
debugOff()
Turns off debug messages. |
void |
debugOn()
Turns on debug messages. |
static void |
error(java.lang.String s)
Used internally to report error messages. |
AudioInput |
getLineIn()
Gets an AudioInput, to which you can attach AudioEffects. |
AudioInput |
getLineIn(int type)
Gets an AudioInput, to which you can attach AudioEffects. |
AudioInput |
getLineIn(int type,
int bufferSize)
Gets an AudioInput, to which you can attach AudioEffects. |
AudioInput |
getLineIn(int type,
int bufferSize,
float sampleRate)
Gets an AudioInput, to which you can attach AudioEffects. |
AudioInput |
getLineIn(int type,
int bufferSize,
float sampleRate,
int bitDepth)
Gets an AudioInput, to which you can attach AudioEffects. |
AudioOutput |
getLineOut()
Gets an AudioOutput, to which you can attach
AudioSignals and AudioEffects. |
AudioOutput |
getLineOut(int type)
Gets an AudioOutput, to which you can attach
AudioSignals and AudioEffects. |
AudioOutput |
getLineOut(int type,
int bufferSize)
Gets an AudioOutput, to which you can attach
AudioSignals and AudioEffects. |
AudioOutput |
getLineOut(int type,
int bufferSize,
float sampleRate)
Gets an AudioOutput, to which you can attach
AudioSignals and AudioEffects. |
AudioOutput |
getLineOut(int type,
int bufferSize,
float sampleRate,
int bitDepth)
Gets an AudioOutput, to which you can attach
AudioSignals and AudioEffects. |
AudioPlayer |
loadFile(java.lang.String filename)
Loads the requested file into an AudioPlayer
with a buffer size of 1024 samples. |
AudioPlayer |
loadFile(java.lang.String filename,
int bufferSize)
Loads the requested file into an AudioPlayer with
the request buffer size. |
AudioSample |
loadSample(java.lang.String filename)
Loads the requested file into an AudioSample. |
AudioSample |
loadSample(java.lang.String filename,
int bufferSize)
Loads the requested file into an AudioSample. |
AudioSnippet |
loadSnippet(java.lang.String filename)
Loads the requested file into an AudioSnippet |
void |
setInputMixer(javax.sound.sampled.Mixer mixer)
Sets the Javasound Mixer that will be used for obtaining input sources such as AudioInputs. |
void |
setOutputMixer(javax.sound.sampled.Mixer mixer)
Sets the Javasound Mixer that will be used for obtain output destinations such as those required by AudioOuput, AudioPlayer, AudioSample, and so forth. |
void |
stop()
Stops Minim. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MONO
public static final int STEREO
public static final int LOOP_CONTINUOUSLY
public static javax.sound.sampled.AudioFileFormat.Type WAV
public static javax.sound.sampled.AudioFileFormat.Type AIFF
public static javax.sound.sampled.AudioFileFormat.Type AIFC
public static javax.sound.sampled.AudioFileFormat.Type AU
public static javax.sound.sampled.AudioFileFormat.Type SND
| Constructor Detail |
|---|
public Minim(processing.core.PApplet parent)
parent - the PApplet that will be used for loading files
public Minim(processing.core.PApplet parent,
MinimServiceProvider msp)
parent - the PApplet that will be used for loading filesmsp - the MinimServiceProvider that will be used for returning audio resources| Method Detail |
|---|
public static void error(java.lang.String s)
s - the error message to reportpublic static void debug(java.lang.String s)
debugOn() has been called.
The message will be displayed in the console area of the PDE,
if you are running your sketch from the PDE.
Otherwise, it will be displayed in the Java Console.
s - the message to displaydebugOn()public void debugOn()
public void debugOff()
public void stop()
public void setInputMixer(javax.sound.sampled.Mixer mixer)
mixer - The Mixer we should try to acquire inputs from.public void setOutputMixer(javax.sound.sampled.Mixer mixer)
mixer - The Mixer we should try to acquire outputs from.
public AudioSample createSample(float[] samples,
javax.sound.sampled.AudioFormat format)
AudioSample using the provided samples and AudioFormat,
with an output buffer size of 1024 samples.
samples - the samples to useformat - the format to play the samples back at
public AudioSample createSample(float[] samples,
javax.sound.sampled.AudioFormat format,
int bufferSize)
AudioSample using the provided samples and AudioFormat,
with the desired output buffer size.
samples - the samples to useformat - the format to play them back atbufferSize - the output buffer size to use
public AudioSample createSample(float[] left,
float[] right,
javax.sound.sampled.AudioFormat format)
AudioSample using the provided left and right channel samples
with an output buffer size of 1024.
left - the left channel of the sampleright - the right channel of the sampleformat - the format the sample should be played back with
public AudioSample createSample(float[] left,
float[] right,
javax.sound.sampled.AudioFormat format,
int bufferSize)
AudioSample using the provided left and right channel samples.
left - the left channel of the sampleright - the right channel of the sampleformat - the format the sample should be played back withbufferSize - the output buffer size desiredpublic AudioSample loadSample(java.lang.String filename)
AudioSample.
filename - the file or URL that you want to load
AudioSample with a 1024 sample bufferloadSample(String, int),
AudioSample
public AudioSample loadSample(java.lang.String filename,
int bufferSize)
AudioSample.
filename - the file or URL that you want to loadbufferSize - the sample buffer size you want
AudioSample with a sample buffer of the requested sizepublic AudioSnippet loadSnippet(java.lang.String filename)
AudioSnippet
filename - the file or URL you want to load
AudioSnippet of the requested file or URLpublic AudioPlayer loadFile(java.lang.String filename)
AudioPlayer
with a buffer size of 1024 samples.
filename - the file or URL you want to load
AudioPlayer with a 1024 sample bufferloadFile(String, int)
public AudioPlayer loadFile(java.lang.String filename,
int bufferSize)
AudioPlayer with
the request buffer size.
filename - the file or URL you want to loadbufferSize - the sample buffer size you want
AudioPlayer with a sample buffer of the requested size
public AudioRecorder createRecorder(Recordable source,
java.lang.String fileName,
boolean buffered)
AudioRecorder that will use source as its
record source and that will save to the file name specified. The format of the
file will be inferred from the extension in the file name. If the extension is
not a recognized file type, this will return null. Be aware that if you choose
buffered recording the call to AudioRecorder.save() will block until
the entire buffer is written to disk. In the event that the buffer is very large,
your sketch will noticably hang.
source - the Recordable object you want to use as a record sourcefileName - the name of the file to record tobuffered - whether or not to use buffered recording
AudioRecorder for the record sourcepublic AudioInput getLineIn()
AudioInput, to which you can attach AudioEffects.
AudioInput with a 1024 sample buffer, a sample rate of
44100 and a bit depth of 16getLineIn(int, int, float, int)public AudioInput getLineIn(int type)
AudioInput, to which you can attach AudioEffects.
type - Minim.MONO or Minim.STEREO
AudioInput with the requested type, a 1024 sample buffer, a
sample rate of 44100 and a bit depth of 16getLineIn(int, int, float, int)
public AudioInput getLineIn(int type,
int bufferSize)
AudioInput, to which you can attach AudioEffects.
type - Minim.MONO or Minim.STEREObufferSize - how long you want the AudioInput's sample buffer to be
AudioInput with the requested attributes, a sample rate of 44100
and a bit depth of 16getLineIn(int, int, float, int)
public AudioInput getLineIn(int type,
int bufferSize,
float sampleRate)
AudioInput, to which you can attach AudioEffects.
type - Minim.MONO or Minim.STEREObufferSize - how long you want the AudioInput's sample buffer to besampleRate - the desired sample rate in Hertz (typically 44100)
AudioInput with the requested attributes and a bit depth of 16getLineIn(int, int, float, int)
public AudioInput getLineIn(int type,
int bufferSize,
float sampleRate,
int bitDepth)
AudioInput, to which you can attach AudioEffects.
type - Minim.MONO or Minim.STEREObufferSize - how long you want the AudioInput's sample buffer to besampleRate - the desired sample rate in Hertz (typically 44100)bitDepth - the desired bit depth (typically 16)
AudioInput with the requested attributespublic AudioOutput getLineOut()
AudioOutput, to which you can attach
AudioSignals and AudioEffects.
AudioOutput with a 1024 sample buffer, a sample rate of
44100 and a bit depth of 16getLineOut(int, int, float, int)public AudioOutput getLineOut(int type)
AudioOutput, to which you can attach
AudioSignals and AudioEffects.
type - Minim.MONO or Minim.STEREO
AudioOutput with the requested type, a 1024 sample buffer, a
sample rate of 44100 and a bit depth of 16getLineOut(int, int, float, int)
public AudioOutput getLineOut(int type,
int bufferSize)
AudioOutput, to which you can attach
AudioSignals and AudioEffects.
type - Minim.MONO or Minim.STEREObufferSize - how long you want the AudioOutput's sample buffer to be
AudioOutput with the requested attributes, a sample rate of
44100 and a bit depth of 16getLineOut(int, int, float, int)
public AudioOutput getLineOut(int type,
int bufferSize,
float sampleRate)
AudioOutput, to which you can attach
AudioSignals and AudioEffects.
type - Minim.MONO or Minim.STEREObufferSize - how long you want the AudioOutput's sample buffer to besampleRate - the desired sample rate in Hertz (typically 44100)
AudioOutput with the requested attributes and a bit depth of 16getLineOut(int, int, float, int)
public AudioOutput getLineOut(int type,
int bufferSize,
float sampleRate,
int bitDepth)
AudioOutput, to which you can attach
AudioSignals and AudioEffects.
type - Minim.MONO or Minim.STEREObufferSize - how long you want the AudioOutput's sample buffer to besampleRate - the desired sample rate in Hertz (typically 44100)bitDepth - the desired bit depth (typically 16)
AudioOutput with the requested attributes
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||