public class PercussionOnsetDetector extends java.lang.Object implements AudioProcessor, OnsetDetector
Estimates the locations of percussive onsets using a simple method described in "Drum Source Separation using Percussive Feature Detection and Spectral Modulation" by Dan Barry, Derry Fitzgerald, Eugene Coyle and Bob Lawlor, ISSC 2005.
Implementation based on a VAMP plugin example by Chris Cannam at Queen Mary, London:
Centre for Digital Music, Queen Mary, University of London. Copyright 2006 Chris Cannam. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the names of the Centre for Digital Music; Queen Mary, University of London; and Chris Cannam shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization.
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_SENSITIVITY |
static double |
DEFAULT_THRESHOLD |
Constructor and Description |
---|
PercussionOnsetDetector(float sampleRate,
int bufferSize,
int bufferOverlap,
OnsetHandler handler)
Create a new percussion onset detector.
|
PercussionOnsetDetector(float sampleRate,
int bufferSize,
OnsetHandler handler,
double sensitivity,
double threshold)
Create a new percussion onset detector.
|
Modifier and Type | Method and Description |
---|---|
boolean |
process(AudioEvent audioEvent)
Process the audio event.
|
void |
processingFinished()
Notify the AudioProcessor that no more data is available and processing
has finished.
|
void |
setHandler(OnsetHandler handler) |
public static final double DEFAULT_THRESHOLD
public static final double DEFAULT_SENSITIVITY
public PercussionOnsetDetector(float sampleRate, int bufferSize, int bufferOverlap, OnsetHandler handler)
sampleRate
- The sample rate in Hz (used to calculate timestamps)bufferSize
- The size of the buffer in samples.bufferOverlap
- The overlap of buffers in samples.handler
- An interface implementor to handle percussion onset events.public PercussionOnsetDetector(float sampleRate, int bufferSize, OnsetHandler handler, double sensitivity, double threshold)
sampleRate
- The sample rate in Hz (used to calculate timestamps)bufferSize
- The size of the buffer in samples.handler
- An interface implementor to handle percussion onset events.sensitivity
- Sensitivity of the peak detector applied to broadband
detection function (%). In [0-100].threshold
- Energy rise within a frequency bin necessary to count toward
broadband total (dB). In [0-20].public boolean process(AudioEvent audioEvent)
AudioProcessor
process
in interface AudioProcessor
audioEvent
- The audio event that contains audio data.public void processingFinished()
AudioProcessor
processingFinished
in interface AudioProcessor
public void setHandler(OnsetHandler handler)
setHandler
in interface OnsetDetector