Minim: An Audio Library for Processing
Features:
- AudioPlayer: Mono and Stereo playback of WAV, AIFF, AU, SND, and MP3 files.
- AudioMetaData: An object filled with metadata about a file, such as ID3 tags.
- AudioRecorder: Mono and Stereo audio recording either buffered or direct to disk.
- AudioInput: Mono and Stereo input monitoring.
- AudioOutput: Mono and Stereo sound synthesis.
- AudioSignal: A simple interface for writing your own sound synthesis classes.
- Comes with all the standard waveforms, a pink noise generator and a white noise generator. Additionally, you can extend the Oscillator class for easy implementation of your own periodic waveform.
- AudioEffect: A simple interface for writing your own audio effects.
- Comes with low pass, high pass, band pass, and notch filters. Additionally, you can extend the IIRFilter class for easy implementation of your own IIR filters.
- Easy to attach signals and effects to AudioInputs and AudioOutputs. All the mixing and processing is taken care of for you.
- Provides an FFT class for doing spectrum analysis.
- Provides a BeatDetect class for doing beat detection.
Visit the download page, then take a look at the Quickstart Guide or dive right into the Javadocs.
processing, arduino and your lib make my dreams reel!!!
thanx a lot
snark, Bonn
Can I use this lib in my java se application directly, instead of using it with processing ?
Yes, the most recent code in the Github repo no longer has PApplet as a dependency, so you can use Minim in a regular old java se application. For file reading a writing, you need to define two of the methods that are present in Processing, which are the sketchPath method and the createInput method. These methods take String file names and convert them to an String absolute path and an InputStream, respectively. We find the methods through reflection, so there is no Interface to implement or anything like that.
Is there any method to retrieve the index number of a sample (rather than its wavelength/value) as the song is being played? I want to sync visual effects with the audio file (.mp3), but when I set it according to millis() past, it differs each time due to the memory/speed of the application. I want to be able to say if less than this sample number but not greater than this one do this, etc. Thank you!
No, you cannot directly do this. In some cases, it would be meaningless, like if you are playing streaming radio from the internet. What you can do, however, is write an AudioListener that counts samples as it receives them and then do whatever you need to do for the visuals at the correct time. This will guarantee that you don’t *miss* the moment you are looking for, which could potentially happen if you are just polling millis(), but it still won’t guarantee that the visual always happens in the same frame every time. This is just the nature of the beast.