Exceeding the 65536 bytes method size.
in
Programming Questions
•
1 year ago
Hey,
So I'm quite sure I went about writing this code in entirely the wrong way, but, my code creates one pixelated image and then shifts to another pixelated image as mouseX moves from 0 to width. After a lot of tedious work, I finished the program. It's super long and far from concise...but I'm happy with the way it moves and the way it looks.
(A snippet of the code is posted below - I can't post it all..it's too long (8000 lines...))
However, ideally, I'd like for the movement to correspond to sound, so I plugged it in to a program that I used in one of my classes (Posted at the end of the post). However, when I try to run it within that program, I get the error "method exceeds 65536 byte limit". (Likely because I wrote the code in such a tedious, clunky way...)
When I divided my code in half (reducing the number of lines that make the image to 60, the program works just fine)
How can I divide my initial program or modify it so that I can use sound as the effector and not worry about this limit?
Many, many thanks to anyone that can figure this one out..
Cheers!
- //DECLARING
- block a;
- block b;
- block c;
- block d;
- block e;
- block f;
- block g;
- block h;
- block i;
- block j;
- block k;
- block l;
- block m;
- block n;
- block o;
- block p;
- block q;
- block r;
- block s;
- block t;
- block u;
- block v;
- block w;
- block x;
- block y;
- block z;
- block aa;
- block ba;
- block ca;
- block da;
- block ea;
- block fa;
- block ga;
- block ha;
- block ia;
- block ja;
- block ka;
- block la;
- block ma;
- block na;
- block oa;
- block pa;
- block qa;
- block ra;
- block sa;
- block ta;
- block ua;
- block va;
- block wa;
- block xa;
- block ya;
- block za;
- block ab;
- block bb;
- block cb;
- block db;
- block eb;
- block fb;
- void setup()
- {
- size(500,500);
- smooth();
- noStroke();
- //LINE 1
- a = new block(103.67,290.28,27.31);
- b = new block(108.67,295.28,27.31);
- c = new block(113.67,300.28,27.31);
- d = new block(395.41,305.28,27.31);//SIDE2
- e = new block(400.41,310.28,27.31);
- f = new block(405.31,315.28,27.31);
- //LINE 2
- g = new block(83.79,285.28,32.31);
- h = new block(88.79,285.28,32.31); //REPEAT
- i = new block(93.79,290.28,32.31);
- j = new block(98.79,295.28,32.31);
- k = new block(103.79,300.28,32.31);
- l = new block(108.79,305.28,32.31);
- m = new block(113.79,310.28,32.31);
- n = new block(118.79,315.28,32.31);
- o = new block(123.79,320.28,32.31);
- p = new block(128.79,325.28,32.31);
- q = new block(380.5,285.28,32.31); //SIDE 2
- r = new block(385.5,290.28,32.31);
- s = new block(390.5,295.28,32.31);
- t = new block(395.5,300.28,32.31);
- u = new block(400.5,305.28,32.31);
- v = new block(405.5,310.28,32.31);
- w = new block(410.5,315.28,32.31);
- x = new block(415.5,320.28,32.31);
- y = new block(420.5,325.28,32.31);
- z = new block(425.5,325.28,32.31);
- //LINE 3
- aa = new block(68.87,285.28,37.31);
- ba = new block(73.87,285.28,37.31);//REPEAT
- ca = new block(78.87,285.28,37.31);//REPEAT
- da = new block(83.87,285.28,37.31);//REPEAT
- ea = new block(88.87,285.28,37.31);//REPEAT
- fa = new block(93.87,285.28,37.31);//REPEAT
- ga = new block(98.87,290.28,37.31);
- ha = new block(103.87,295.28,37.31);
- ia = new block(108.87,300.28,37.31);
- ja = new block(113.87,305.28,37.31);
- ka = new block(118.87,310.28,37.31);
- la = new block(123.87,315.28,37.31);
- ma = new block(128.87,320.28,37.31);
- na = new block(133.87,325.28,37.31);
- oa = new block(138.87,330.28,37.31);
- pa = new block(143.87,335.28,37.31);
- qa = new block(365.58,285.28,37.31);//SIDE2
- ra = new block(370.58,290.28,37.31);
- sa = new block(375.58,295.28,37.31);
- ta = new block(380.58,300.28,37.31);
- ua = new block(385.58,305.28,37.31);
- va = new block(390.58,310.28,37.31);
- wa = new block(395.58,315.28,37.31);
- xa = new block(400.58,320.28,37.31);
- ya = new block(405.58,325.28,37.31);
- za = new block(410.58,330.28,37.31);
- ab = new block(415.58,335.28,37.31);
- bb = new block(420.58,335.28,37.31);//REPEAT
- cb = new block(425.58,335.28,37.31);//REPEAT
- db = new block(430.58,335.28,37.31);//REPEAT
- eb = new block(435.58,335.28,37.31);//REPEAT
- fb = new block(440.58,335.28,37.31);//REPEAT
- }
- void draw(){
- background(255);
- //LINE 1
- a.display();
- b.display();
- c.display();
- d.display();//SIDE2
- e.display();
- f.display();
- //LINE 2
- g.display();
- h.display();
- i.display();
- j.display();
- k.display();
- l.display();
- m.display();
- n.display();
- o.display();
- p.display();
- q.display();//SIDE2
- r.display();
- s.display();
- t.display();
- u.display();
- v.display();
- w.display();
- x.display();
- y.display();
- z.display();
- //LINE3
- aa.display();
- ba.display();
- ca.display();
- da.display();
- ea.display();
- fa.display();
- ga.display();
- ha.display();
- ia.display();
- ja.display();
- ka.display();
- la.display();
- ma.display();
- na.display();
- oa.display();
- pa.display();
- qa.display();//SIDE2
- ra.display();
- sa.display();
- ta.display();
- ua.display();
- va.display();
- wa.display();
- xa.display();
- ya.display();
- za.display();
- ab.display();
- bb.display();
- cb.display();
- db.display();
- eb.display();
- fb.display();
- }
- class block
- {
- //EVERY BLOCK has these pieces of data
- float xstart, xend;
- float xpos, ypos;
- //Declaring
- //Constructor
- block (float tempxstart,float tempxend, float tempY)
- {
- this.xstart = xstart;
- this.xend = xend;
- xstart = tempxstart;
- xend = tempxend;
- ypos = tempY;
- }
- //Functionality
- //Display
- void display(){
- ellipseMode(CENTER);
- fill(0);
- ellipse(map(mouseX,0,width,xstart,xend),ypos,4,4);
- }
- }
Sound code
- * Note: Put all of your code in the "testFace" tab. Leave
- * this tab and the "volume" tab as they are. You can set
- * your variables at the top of "testFace".
- *
- * Based on code from Lorenzo Bravi:
- * http://www.lorenzobravi.com/projects/workshop-isia/
- */
- float v;
- float easing = 0.2; // Between 0 and 1
- float volumeScalar = 4000;
- boolean mic = true;
- float x = 250;
- float speed = 4;
- int direction = 1;
- int dark = 30;
- int light = 255;
- void setup() {
- size(500, 500);
- smooth();
- noStroke();
- setupVolume();
- frameRate(80);
- }
- void draw() {
- background(255);
- getVolume();
- if (mic == false) {
- v = mouseX;
- }
- testFace();
- //saveFrame("mask-####.png");
- }
- String name = "Your Name Here";
- void testFace() {
- }
- import ddf.minim.*;
- Minim minim;
- AudioInput in;
- float s_volume;
- float volume;
- void setupVolume() {
- minim = new Minim(this);
- in = minim.getLineIn(Minim.MONO, 512);
- }
- void getVolume() {
- s_volume = in.right.level() * volumeScalar;
- // println(s_volume);
- float d_volume = s_volume - volume;
- if (abs(d_volume) > 1) {
- volume += d_volume * easing;
- }
- v = volume;
- }
- void stop() {
- in.close();
- minim.stop();
- super.stop();
- }
1