Creating a Piano (need help with keyReleased)

edited May 2018 in Library Questions

I am creating a music machine and when I press the 'a' key the function begins to hold the note. When I release the 'a' key, the sound file stops, as i want it to.

But when I go to press the 'a' key again, no sound comes out at all. I feel like the key1.pause(); function stops it correctly but wont load the same sound file when pressing the 'a' key again.

When I use the key1.rewind(); under the keyReleased function, it plays the sound upon releasing the key 'a' in a rewind manner.

This is my final project for Programming for Visual Artists and really could use some assistance please!

            import ddf.minim.analysis.*;
            import ddf.minim.*;

            Minim minim;

            AudioPlayer key1;

            void setup() {

            size(1440, 770);

            minim = new Minim(this);
            key1 = minim.loadFile("key1.mp3", 512);

            void draw() {

            void keyPressed() {
              if (key=='a')
            void keyReleased() {



Sign In or Register to comment.