processing-sound-archive icon indicating copy to clipboard operation
processing-sound-archive copied to clipboard

Strange crash after stopping sketch and sometimes during running sketch

Open benfry opened this issue 10 years ago • 11 comments

https://github.com/processing/processing/issues/2940

benfry avatar Nov 14 '14 23:11 benfry

extra details...

screen shot 2014-11-15 at 8 13 28 pm

and this in console window.

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0x000000011d75aa81, pid=1118, tid=100611

JRE version: Java(TM) SE Runtime Environment (7.0_67-b01) (build 1.7.0_67-b01)

Java VM: Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode bsd-amd64 compressed oops)

Problematic frame:

C [libmethcla.dylib+0x1a81] remove_free_block+0x10

Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

An error report file with more information is saved as:

/Users/articulatedworks/hs_err_pid1118.log

If you would like to submit a bug report, please visit:

http://bugreport.sun.com/bugreport/crash.jsp

Could not run the sketch (Target VM failed to initialize). For more information, read revisions.txt and Help → Troubleshooting.

98% reproducible.. the 2% seems to come when oscillator objects don't yet get triggered in sketch.

justinpeake avatar Nov 16 '14 01:11 justinpeake

@justinpeake can you post your code please?

wirsing avatar Nov 18 '14 01:11 wirsing

import processing.sound.*;
import processing.serial.*;

Serial myPort;
SinOsc osc;
SinOsc osc2;
SinOsc osc3;

Env envelope;


int[] scale = {
  60
};

int note = 0;

int trig;


float breath = 0;     
float heart = 0;   

float breathVol;


float previous=0;  // timer
float current=0;  // timer
float counter = 0;  // number of heart beats total
float interval=0; // interval in ms between heart beats
float bpm=0; // heart rate in bpm
float aoc=0;  // amount of change in bpm / per beat
float prebpm=0; // previous bpm
float tminterval;
float tmprevious;
boolean tamer;

float bypos; // graphy
float hxpos; // graphy

ArrayList <Float> intrvls;
ArrayList <Float> bpms;
ArrayList <Float> aocs;

void setup() {
  background(0);
  size(displayWidth, displayHeight);

  intrvls = new ArrayList<Float>();
  bpms = new ArrayList<Float>();
  aocs = new ArrayList<Float>();

  osc = new SinOsc(this);
  envelope = new Env(this);

  osc2 = new SinOsc(this);
  osc2.play();
  osc3 = new SinOsc(this);
  osc3.play();

  myPort = new Serial(this, Serial.list()[7], 115200);
  myPort.bufferUntil('\n');
}

void draw() {

  heartBeatData();
  graphy();
  circulars();
  soundStuff();

  osc2.freq(220. + aoc);
  osc3.freq(220.);

  breathVol = map(breath, 0, 600, 0., .3);
  //println(breathVol);
  osc2.amp(breathVol);
  osc3.amp(breathVol);
}

float translateMIDI(int note) {
  return pow(2, ((note-69)/12.0))* (bpm * 1.2);
}

void serialEvent(Serial myPort) { 

  String inString = myPort.readStringUntil('\n'); 
  if (inString != null) {
    inString = trim(inString); 
    float[] colors = float(split(inString, ",")); 

    if (colors.length >=2) {
      breath = abs(map(colors[0], 220, 600, 0, 300));
      heart = map(colors[1], 0, 1023, 0, 300);
    }
  }
}

functions tab:

void heartBeatData() {
  if (heart > 240) {
    tminterval = millis() - tmprevious;
    tmprevious = millis();
  }

  if (tminterval > 250) {
    tamer = true;
  } else { 
    tamer = false;
  }
  if (heart > 240 && tamer) {
    counter ++;
    interval = millis() - previous;
    previous = millis();

    bpm = (60/interval*1000);
    aoc =  abs(bpm - prebpm);
    prebpm = bpm;

    intrvls.add(interval);
    bpms.add(bpm);
    aocs.add(aoc);

    println(counter, ",", interval, ",", bpm, ",", aoc, ",", breathVol);
  }
}
void graphy() {

  if ((keyPressed == true) && (key == '1')) {
    trig = 1;
  } else if ((keyPressed == true) && (key == '2')) {
    trig = 2;
  } else if ((keyPressed == true) && (key == '3')) {
    trig = 3;
  } else if ((keyPressed == true) && (key == '4')) {
    trig = 4;
  } else if ((keyPressed == true) && (key == '5')) {
    trig = 5;
  } else if ((keyPressed == true) && (key == '6')) {
    trig = 6;
  }



  //breathy
  fill(0, 170, 255, 10);

  //mode1
  // rect (width/2, bypos, breath*-1, 2);
  // rect (width/2, bypos, breath, 2);

  // bypos = bypos +.2;

  // if (bypos >= height) {
  //   bypos = 0;
  // }

  // // hearty

  // fill(100, 0, 100 *(aoc*100), 50);

  // rect (hxpos, height/2, 1, heart*-1/2);
  // rect (hxpos, height/2, 1, heart/2);

  // hxpos = hxpos +.2;

  // if (hxpos >= width) {
  //   hxpos = 0;
  // }

  /* mode 2

   //breathy

   rect (bypos, height/2, 2, breath*-1/2);
   rect (bypos, height/2, 2, breath/2);

   bypos = bypos +.2;

   if (bypos >= height) {
   bypos = 0;
   }

   // hearty

   fill(100, 0, 100 *(aoc*100), 50);

   rect (hxpos, height/2, 1, heart*-1/2);
   rect (hxpos, height/2, 1, heart/2);

   hxpos = hxpos +.2;

   if (hxpos >= width) {
   hxpos = 0;
   } */
}

void circulars () {

  // stroke(0, 1);
  // line(0, height/2, width, height /2);

  // stroke(0, 1);
  // line(width/2, 0, width/2, height );

  // // comment this stuff in for mode 2
  //   stroke(0, 2);
  //   fill(0, 20);
  //   rect(0, 0, width, height);
  // //
  fill(0, 0, 200+(aoc*20), 5);
  stroke(0, 0, 200+(aoc*20), 5);
  ellipse(width/2, height/2, breath, breath);

  fill(255, (aoc*20), 0, 5);
  stroke(255, (aoc*20), 0, 5);
  ellipse(width/2, height/2, heart+bpm, heart+bpm);

  // fill(0, 10);
  // noStroke();
  // ellipse(width/2, height/2, heart+bpm, heart+bpm);
}

void soundStuff() {
  PVector v = new PVector();



  if (heart > 230 && tamer) {

    osc.play(translateMIDI(scale[note]), 1);

    envelope.play(osc, 0.1, 0.1, .7, 0.1);  // pulsey envelope
    //note = (note + 1) % scale.length;
  }
}

justinpeake avatar Nov 18 '14 06:11 justinpeake

I've noticed errors when a Sound program is quit by closing the display window (the main program window.) I haven't seen the errors when the "stop" button is pressed in the IDE.

screen shot 2014-11-17 at 8 04 45 pm

REAS avatar Nov 18 '14 14:11 REAS

@REAS my errors were slightly different (possibly because of linux), and I can't get them to happen again with latest version of library. I get different one instead with keyboard sketch:- On closing keyboard sketch from window, something not being released in sequence?:-

Listening for transport dt_socket at address: 8147
ERROR: /node/free: Node id -1 out of range
ERROR: /node/free: Node id -1 out of range
ERROR: /node/free: Node id -1 out of range
ERROR: /node/free: Node id -1 out of range
ERROR: /node/free: Node id -1 out of range
ERROR: /node/free: Node id -1 out of range
ERROR: /node/free: Node id -1 out of range
ERROR: /node/free: Node id -1 out of range
ERROR: /node/free: Node id -1 out of range
ERROR: /node/free: Node id -1 out of range

Some interaction between ide and sketch? No such problem with ruby-processing.

monkstone avatar Jan 26 '15 18:01 monkstone

@monkstone I don't get these errors, are you sure you're on v1.2.1? It's feedback from the sound engine you can ignore it if you get it. I know of the other FFT bug and am working on it.

wirsing avatar Jan 29 '15 20:01 wirsing

MacOSX 10.10.3 Processing 3.09a I get this error when I try to stop() a SoundFile that is not playing. Is there a way to check if the file is playing?

tomasmcm avatar May 24 '15 18:05 tomasmcm

this will be fixed in the next update.

thanks for reporting!

On 24.05.2015, at 11:02, Tomás Correia Marques [email protected] wrote:

MacOSX 10.10.3 Processing 3.09a I get this error when I try to stop() a SoundFile that is not playing. Is there a way to check if the file is playing?

— Reply to this email directly or view it on GitHub https://github.com/processing/processing-sound/issues/9#issuecomment-105043526.

wirsing avatar Jun 21 '15 02:06 wirsing

@wirsing What the status with this?

REAS avatar Sep 29 '15 21:09 REAS

Just wanted to report that I see the same error message in the console when calling exit() from my sketch, but not if I stop it from the PDE.

LIBRARY INFO name=Sound category=Sound authors=The Processing Foundation url=http://processing.org/reference/libraries/sound/index.html sentence=Sound library based on MethCla for Processing. paragraph= version=7 prettyVersion=1.3.2 lastUpdated=0 minRevision=228 maxRevision=0

ENVIRONMENT MacOSX 10.11.6 Processing 3.1.2

SAMPLE CODE screen shot 2016-08-10 at 2 33 34 pm

siochi avatar Aug 10 '16 18:08 siochi

A follow up: if I press a key (or close the sketch window) before the sound plays, I don't get the error.

siochi avatar Aug 10 '16 18:08 siochi