We are about to switch to a new forum software. Until then we have removed the registration on this forum.
anyone know why this is crashing right when it should loop?
import processing.sound.*;
// Declare the processing sound variables
SoundFile sample;
Amplitude rms;
// Declare a scaling factor
float scale=1;
// Declare a smooth factor
float smooth_factor=0.25;
// Used for smoothing
float sum;
PImage img; // The source image
int cellsize = 2; // Dimensions of each cell in the grid
int columns, rows; // Number of columns and rows in our system
public void setup() {
size(800, 1000, P3D);
//fullScreen(P3D);
img = loadImage("..."); // Load the image
columns = img.width / cellsize; // Calculate # of columns
rows = img.height / cellsize; // Calculate # of rows
//Load and play a soundfile and loop it
sample = new SoundFile(this, "...");
sample.loop();
// Create and patch the rms tracker
rms = new Amplitude(this);
rms.input(sample);
}
void draw() {
background(255,0,255);
// Begin loop for columns
for ( int i = 0; i < columns; i++) {
// Begin loop for rows
for ( int j = 0; j < rows; j++) {
int x = i*cellsize + cellsize/2; // x position
int y = j*cellsize + cellsize/2; // y position
int loc = x + y*img.width; // Pixel array location
color c = img.pixels[loc]; // Grab the color
// Calculate a z position as a function of mouseX and pixel brightness
//float z = width/2 * brightness(img.pixels[loc]) - 20.0;
float rms_scaled=sum*width/10 * brightness(img.pixels[loc]) - 20.0;
// smooth the rms data by smoothing factor
sum += (rms.analyze() - sum) * smooth_factor;
// rms.analyze() return a value between 0 and 1. It's
// scaled to height/2 and then multiplied by a scale factor
// Translate to the location, set fill and stroke, and draw the rect
pushMatrix();
//translate(x + 300, y + 250, rms_scaled);
translate(x + 200, y + 200, rms_scaled);
fill(c, 204);
noStroke();
rectMode(CENTER);
rect(0, 0, cellsize, cellsize);
popMatrix();
}
}
}
Answers
this could mean anything. please be more specific.
@koogs the pop up states that the sketch unexpectedly quit. here is all the info i'm receiving via console:
We've seen that before, the TIS/TSM thing. Look at the bug reports on the processing github site, links on the main processing website. Or search here.
I suggest you check if the minim library to see if you coulduse it as a replacement to the
processing.sound
lib.Kf
knew i'd seen it:
https://github.com/processing/processing/issues/5462
not sound related apparently, more video card...
try using something other than P3D, maybe P2D. or leaving it blank.
(but, yes, minim is more mature and more stable than the sound library, so use that as well)
@koogs - thanks for the link! i will try something other than P3D... minim always works for me, but i just tried running a basic sketch and this happened :)]
lousy pic ... it says the same TIS/TSM again:
2018-05-02 21:00:39.907 java[66121:264097] pid(66121)/euid(501) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
(using minim is an aside here... it's the P3D causing the TIS/TSM error)