import processing.serial.*;
import ddf.minim.spi.*;
import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.ugens.*;
import ddf.minim.effects.*;
Minim minim = new Minim(this);
AudioSample playAAAAA;
AudioSample playBBBBB;
AudioSample playCCCCC;
AudioSample playDDDDD;
AudioSample playEEEEE;
AudioSample playFFFFF;
AudioSample playAAAA;
AudioSample playBBBB;
AudioSample playCCCC;
AudioSample playDDDD;
AudioSample playEEEE;
AudioSample playFFFF;
AudioSample playAAA;
AudioSample playBBB;
AudioSample playCCC;
AudioSample playDDD;
AudioSample playEEE;
AudioSample playFFF;
AudioSample playAA;
AudioSample playBB;
AudioSample playCC;
AudioSample playDD;
AudioSample playEE;
AudioSample playFF;
AudioSample playA;
AudioSample playB;
AudioSample playC;
AudioSample playD;
AudioSample playE;
AudioSample playF;
int wait;
int AAAAA;
int BBBBB;
int CCCCC;
int DDDDD;
int EEEEE;
int FFFFF;
int AAAA;
int BBBB;
int CCCC;
int DDDD;
int EEEE;
int FFFF;
int AAA;
int BBB;
int CCC;
int DDD;
int EEE;
int FFF;
int AA;
int BB;
int CC;
int DD;
int EE;
int FF;
int A;
int B;
int C;
int D;
int E;
int F;
int Last_AAAAA;
int Last_BBBBB;
int Last_CCCCC;
int Last_DDDDD;
int Last_EEEEE;
int Last_FFFFF;
int Last_AAAA;
int Last_BBBB;
int Last_CCCC;
int Last_DDDD;
int Last_EEEE;
int Last_FFFF;
int Last_AAA;
int Last_BBB;
int Last_CCC;
int Last_DDD;
int Last_EEE;
int Last_FFF;
int Last_AA;
int Last_BB;
int Last_CC;
int Last_DD;
int Last_EE;
int Last_FF;
int Last_A;
int Last_B;
int Last_C;
int Last_D;
int Last_E;
int Last_F;
Serial myPort;
void setup(){
println(Serial.list()[0]);
myPort = new Serial(this, Serial.list()[0],9600);
playAAAAA = minim.loadSample("AAAAA.mp3");
playBBBBB = minim.loadSample("BBBBB.mp3");
playCCCCC = minim.loadSample("CCCCC.mp3");
playDDDDD = minim.loadSample("DDDDD.mp3");
playEEEEE = minim.loadSample("EEEEE.mp3");
playFFFFF = minim.loadSample("FFFFF.mp3");
playAAAA = minim.loadSample("AAAA.mp3");
playBBBB = minim.loadSample("BBBB.mp3");
playCCCC = minim.loadSample("CCCC.mp3");
playDDDD = minim.loadSample("DDDD.mp3");
playEEEE = minim.loadSample("EEEE.mp3");
playFFFF = minim.loadSample("FFFF.mp3");
playAAA = minim.loadSample("AAA.mp3");
playBBB = minim.loadSample("BBB.mp3");
playCCC = minim.loadSample("CCC.mp3");
playDDD = minim.loadSample("DDD.mp3");
playEEE = minim.loadSample("EEE.mp3");
playFFF = minim.loadSample("FFF.mp3");
playAA = minim.loadSample("AA.mp3");
playBB = minim.loadSample("BB.mp3");
playCC = minim.loadSample("CC.mp3");
playDD = minim.loadSample("DD.mp3");
playEE = minim.loadSample("EE.mp3");
playFF = minim.loadSample("FF.mp3");
playA = minim.loadSample("A.mp3");
playB = minim.loadSample("B.mp3");
playC = minim.loadSample("C.mp3");
playD = minim.loadSample("D.mp3");
playE = minim.loadSample("E.mp3");
playF = minim.loadSample("F.mp3");
Last_AAAAA = 0;
Last_BBBBB = 0;
Last_CCCCC = 0;
Last_DDDDD = 0;
Last_EEEEE = 0;
Last_FFFFF = 0;
Last_AAAA = 0;
Last_BBBB = 0;
Last_CCCC = 0;
Last_DDDD = 0;
Last_EEEE = 0;
Last_FFFF = 0;
Last_AAA = 0;
Last_BBB = 0;
Last_CCC = 0;
Last_DDD = 0;
Last_EEE = 0;
Last_FFF = 0;
Last_AA = 0;
Last_BB = 0;
Last_CC = 0;
Last_DD = 0;
Last_EE = 0;
Last_FF = 0;
Last_A = 0;
Last_B = 0;
Last_C = 0;
Last_D = 0;
Last_E = 0;
Last_F = 0;
}
void draw(){
if(myPort.available() >=1) {
if(myPort.read() == '9') {
AAAAA = myPort.read();
BBBBB = myPort.read();
CCCCC = myPort.read();
DDDDD = myPort.read();
EEEEE = myPort.read();
FFFFF = myPort.read();
AAAA = myPort.read();
BBBB = myPort.read();
CCCC = myPort.read();
DDDD = myPort.read();
EEEE = myPort.read();
FFFF = myPort.read();
AAA = myPort.read();
BBB = myPort.read();
CCC = myPort.read();
DDD = myPort.read();
EEE = myPort.read();
FFF = myPort.read();
AA = myPort.read();
BB = myPort.read();
CC = myPort.read();
DD = myPort.read();
EE = myPort.read();
FF = myPort.read();
A = myPort.read();
B = myPort.read();
C = myPort.read();
D = myPort.read();
E = myPort.read();
F = myPort.read();
}
}
background(255);
print(AAAAA);
print(" ");
print(BBBBB);
print(" ");
print(CCCCC);
print(" ");
print(DDDDD);
print(" ");
print(EEEEE);
print(" ");
print(FFFFF);
print(" ");
print(AAAA);
print(" ");
print(BBBB);
print(" ");
print(CCCC);
print(" ");
print(DDDD);
print(" ");
print(EEEE);
print(" ");
print(FFFF);
print(" ");
print(AAA);
print(" ");
print(BBB);
print(" ");
print(CCC);
print(" ");
print(DDD);
print(" ");
print(EEE);
print(" ");
print(FFF);
print(" ");
print(AA);
print(" ");
print(BB);
print(" ");
print(CC);
print(" ");
print(DD);
print(" ");
print(EE);
print(" ");
print(FF);
print(" ");
print(A);
print(" ");
print(B);
print(" ");
print(C);
print(" ");
print(D);
print(" ");
print(E);
print(" ");
print(F);
print(" ");
if(AAAAA > 0) {
if(Last_AAAAA <= 0) {
playAAAAA.trigger();
Last_AAAAA = 1;
}
}
else{
Last_AAAAA = 0;
}
if(BBBBB > 0) {
if(Last_BBBBB <= 0) {
playBBBBB.trigger();
Last_BBBBB = 1;
}
}
else{
Last_BBBBB = 0;
}
if(CCCCC > 0) {
if(Last_CCCCC <= 0) {
playCCCCC.trigger();
Last_CCCCC = 1;
}
}
else{
Last_CCCCC = 0;
}
if(DDDDD > 0) {
if(Last_DDDDD <= 0) {
playDDDDD.trigger();
Last_DDDDD = 1;
}
}
else{
Last_DDDDD = 0;
}
if(EEEEE > 0) {
if(Last_EEEEE <= 0) {
playEEEEE.trigger();
Last_EEEEE = 1;
}
}
else{
Last_EEEEE = 0;
}
if(FFFFF > 0) {
if(Last_FFFFF <= 0) {
playFFFFF.trigger();
Last_FFFFF = 1;
}
}
else{
Last_FFFFF = 0;
}
if(AAAA > 0) {
if(Last_AAAA <= 0) {
playAAAA.trigger();
Last_AAAA = 1;
}
}
else{
Last_AAAA = 0;
}
if(BBBB > 0) {
if(Last_BBBB <= 0) {
playBBBB.trigger();
Last_BBBB = 1;
}
}
else{
Last_BBBB = 0;
}
if(CCCC > 0) {
if(Last_CCCC <= 0) {
playCCCC.trigger();
Last_CCCC = 1;
}
}
else{
Last_CCCC = 0;
}
if(DDDD > 0) {
if(Last_DDDD <= 0) {
playDDDD.trigger();
Last_DDDD = 1;
}
}
else{
Last_DDDD = 0;
}
if(EEEE > 0) {
if(Last_EEEE <= 0) {
playEEEE.trigger();
Last_EEEE = 1;
}
}
else{
Last_EEEE = 0;
}
if(FFFF > 0) {
if(Last_FFFF <= 0) {
playFFFF.trigger();
Last_FFFF = 1;
}
}
else{
Last_FFFF = 0;
}
if(AAA > 0) {
if(Last_AAA <= 0) {
playAAA.trigger();
Last_AAA = 1;
}
}
else{
Last_AAA = 0;
}
if(BBB > 0) {
if(Last_BBB <= 0) {
playBBB.trigger();
Last_BBB = 1;
}
}
else{
Last_BBB = 0;
}
if(CCC > 0) {
if(Last_CCC <= 0) {
playCCC.trigger();
Last_CCC = 1;
}
}
else{
Last_CCC = 0;
}
if(DDD > 0) {
if(Last_DDD <= 0) {
playDDD.trigger();
Last_DDD = 1;
}
}
else{
Last_DDD = 0;
}
if(EEE > 0) {
if(Last_EEE <= 0) {
playEEE.trigger();
Last_EEE = 1;
}
}
else{
Last_EEE = 0;
}
if(FFF > 0) {
if(Last_FFF <= 0) {
playFFF.trigger();
Last_FFF = 1;
}
}
else{
Last_FFF = 0;
}
if(AA > 0) {
if(Last_AA <= 0) {
playAA.trigger();
Last_AA = 1;
}
}
else{
Last_AA = 0;
}
if(BB > 0) {
if(Last_BB <= 0) {
playBB.trigger();
Last_BB = 1;
}
}
else{
Last_BB = 0;
}
if(CC > 0) {
if(Last_CC <= 0) {
playCC.trigger();
Last_CC = 1;
}
}
else{
Last_CC = 0;
}
if(DD > 0) {
if(Last_DD <= 0) {
playDD.trigger();
Last_DD = 1;
}
}
else{
Last_DD = 0;
}
if(EE > 0) {
if(Last_EE <= 0) {
playEE.trigger();
Last_EE = 1;
}
}
else{
Last_EE = 0;
}
if(FF > 0) {
if(Last_FF <= 0) {
playFF.trigger();
Last_FF = 1;
}
}
else{
Last_FF = 0;
}
if(A > 0) {
if(Last_A <= 0) {
playA.trigger();
Last_A = 1;
}
}
else{
Last_A= 0;
}
if(B > 0) {
if(Last_B <= 0) {
playB.trigger();
Last_B = 1;
}
}
else{
Last_B = 0;
}
if(C > 0) {
if(Last_C <= 0) {
playC.trigger();
Last_C = 1;
}
}
else{
Last_C = 0;
}
if(D > 0) {
if(Last_D <= 0) {
playD.trigger();
Last_D = 1;
}
}
else{
Last_D = 0;
}
if(E > 0) {
if(Last_E <= 0) {
playE.trigger();
Last_E = 1;
}
}
else{
Last_E = 0;
}
if(F > 0) {
if(Last_F <= 0) {
playF.trigger();
Last_F = 1;
}
}
else{
Last_F = 0;
}
}
안녕하세요.
프로세싱과 아두이노를 연동해서 버튼으로 음을 내는 작업을 하고있습니다. 그런데 프로세싱 코드에서 에러가 나는데요 무슨 문제인지 도저히 모르겠습니다.. 도움좀 주시면 감사하겠습니다..ㅠㅠ
에러는 다음과 같습니다.
COM1
==== JavaSound Minim Error ====
==== java.lang.reflect.InvocationTargetException
java.lang.NullPointerException
at ddf.minim.Minim.addSource(Minim.java:308)
at ddf.minim.Minim.loadSample(Minim.java:476)
at ddf.minim.Minim.loadSample(Minim.java:458)
at sketch_180524a.setup(sketch_180524a.java:170)
at processing.core.PApplet.handleDraw(PApplet.java:2401)
at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1557)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:316)
|