Minim's AudioSample triggering with delay
in
Core Library Questions
•
1 year ago
I'm trying to program a very simple virtual drum using Processing and Minim.
I am using AudioSample to load/trigger my drum samples, but when the sample is triggered,
there's a few miliseconds delay before the sample actually plays. For my purpose, this delay destroys the user experience.
How can I fix that?
I am using:
Ubuntu 12.04 x86
Processing 1.5.1
Minim 2.0.2
Java 1.6
My code:
- public class TestApplet extends PApplet {
- private static final long serialVersionUID = 1L;
- // Sound delegate
- Minim minim;
- Pad pad;
- AudioSample sample;
- public static void main(String args[]) {
- PApplet.main(new String[] {/*"--present", */"com.borges.TestApplet"});
- }
- public void setup() {
- minim = new Minim(this);
- sample = minim.loadSample("tom.wav");
- size(800, 600);
- frameRate(200);
- background(255);
- }
- public void stop() {
- sample.close();
- minim.stop();
- }
- public void draw() {
- }
- public void keyPressed() {
- sample.trigger();
- }
- }
1