loading image file error
in
Programming Questions
•
8 months ago
for some reason I am getting a random error of:
- processing.app.SketchException: unexpected char: '\'
- at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:377)
- at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:185)
- at processing.mode.java.JavaBuild.build(JavaBuild.java:144)
- at processing.mode.java.JavaBuild.build(JavaBuild.java:123)
- at processing.mode.java.JavaMode.handleRun(JavaMode.java:160)
- at processing.mode.java.JavaEditor$19.run(JavaEditor.java:474)
- at java.lang.Thread.run(Thread.java:680)
here is the code:
- import themidibus.*;
- MidiBus myBus;
- boolean[] notes = new boolean[129];
- PImage[] images = new PImage[129];
- int[] xs = new int[129];
- int[] ys = new int[129];
- void setup() {
- size(1024, 1024);
- smooth();
- MidiBus.list();
- myBus = new MidiBus(this, 0, 0);
- for (int i = 1; i <= 128; i++) {
- images[i] = loadImage(“note” + str(i) + “.jpg”);
- }
- }
- void draw() {
- background(0);
- for (int i = 1; i <= 128; i++) {
- if (notes[i]) {
- image(images[i], 0, map(i, 1, 128, 0, 1004) );
- }
- }
- }
- void noteOn(int channel, int pitch, int velocity) {
- println(“Pitch:
- ” + pitch + ” | Velocity:
- ” + velocity);
- notes[pitch] = true;
- }
- void noteOff(int channel, int pitch, int velocity) {
- println(“note off:
- ” + pitch);
- delay(200);
- notes[pitch] = false;
- }
I have all the images in the data folder as well note1.jpg to note128.jpg
1