Instruments in SoundCipher
The SoundCipher library contains a large amount of instruments. This quick guide will show you how to take advantage of these different instruments. You can view the demo down below or at: https://www.ktbyte.com/projects/project/79781
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
SoundCipher sc = new SoundCipher(this); //SoundCipher entity //Different instrument values int PIANO = 0, XYLOPHONE = 13, ELECTRIC_GUITAR = 27, ACOUSTIC_BASS = 32, STRINGS = 48, ORCHESTRA_HIT = 55, TRUMPET = 56, TUBA = 58, BRASS = 61, ALTO_SAX = 65, CLARINET = 71, FLUTE = 73, TAIKO = 116, SYNTH_DRUM = 118; //Instruments stored in an array. int[] instruments = {PIANO, XYLOPHONE, ELECTRIC_GUITAR, ACOUSTIC_BASS, STRINGS, ORCHESTRA_HIT, TRUMPET, TUBA, BRASS, ALTO_SAX, CLARINET, FLUTE, TAIKO, SYNTH_DRUM}; void setup() { size(480, 360); } void mousePressed() { sc.instrument = instruments[(int)random(instruments.length)]; //Plays random instrument from array sc.playNote(60, 50, 0.5); background(random(255), random(255), random(255)); //Changes background color every mouse press } |