AubG / Viusic

Interactive video & audio sound board
0 stars 0 forks source link

Minim Build Failing: Simple Record Audio Example #1

Open internetsadboy opened 10 years ago

internetsadboy commented 10 years ago

Yo @AubG @Madslick,

If you have time, can you see if this example breaks?

I essentially yanked the example from minim. I imported all jars associated with minim, and added all minim jars to the build path; so I'm not sure why it's not working.

People had some similar issues on the interwebs. However, it had to do with importing all minim jars and I believe I've done that.

Any help is appreciated :hankey:

RecordAudio.java

Note: change the audio files in loadSample to random audio files on your machine :stuck_out_tongue:

import processing.core.*;

import ddf.minim.*;

public class RecordAudio extends PApplet
{
    Minim minim;

    AudioSample kick;

    AudioSample snare;

    public void setup ()
    {
      size(512, 200, P3D);
      minim = new Minim(this);

      // load BD.wav from the data folder
      kick = minim.loadSample("/Users/jhalpert/Downloads/Minim-2.2.0/examples/Basics/TriggerASample/data/BD.mp3", 512); // filename, buffer size

      // An AudioSample will spawn its own audio processing Thread, 
      // and since audio processing works by generating one buffer 
      // of samples at a time, we can specify how big we want that
      // buffer to be in the call to loadSample. 
      // above, we requested a buffer size of 512 because 
      // this will make the triggering of the samples sound more responsive.
      // on some systems, this might be too small and the audio 
      // will sound corrupted, in that case, you can just increase
      // the buffer size.

      // if a file doesn't exist, loadSample will return null
      if ( kick == null ) println("Didn't get kick!");

      // load SD.wav from the data folder
      snare = minim.loadSample("/Users/jhalpert/Documents/workspace/ProcessingContents/Java/modes/java/libraries/minim/examples/loadFileIntoBuffer/data/SD.wav", 512);
      if (snare == null) println("Didn't get snare!");
    }

    public void draw ()
    {
      background(0);
      stroke(255);

      // use the mix buffer to draw the waveforms.
      for (int i = 0; i < kick.bufferSize() - 1; i++)
      {
        float x1 = map(i, 0, kick.bufferSize(), 0, width);
        float x2 = map(i + 1, 0, kick.bufferSize(), 0, width);
        line(x1, 50 - kick.mix.get(i) * 50, x2, 50 - kick.mix.get(i+1) * 50);
        line(x1, 150 - snare.mix.get(i) * 50, x2, 150 - snare.mix.get(i+1) * 50);
      }
    }

    public void keyPressed () 
    {
      if (key == 's') snare.trigger();
      if (key == 'k') kick.trigger();
    }

}

Error

java.lang.NoClassDefFoundError: javax/media/opengl/GLException
    at processing.opengl.PGraphicsOpenGL.createPGL(PGraphicsOpenGL.java:1744)
    at processing.opengl.PGraphicsOpenGL.<init>(PGraphicsOpenGL.java:518)
    at processing.opengl.PGraphics3D.<init>(PGraphics3D.java:37)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at processing.core.PApplet.makeGraphics(PApplet.java:1919)
    at processing.core.PApplet.size(PApplet.java:1771)
    at processing.core.PApplet.size(PApplet.java:1742)
    at RecordAudio.setup(RecordAudio.java:45)
    at processing.core.PApplet.handleDraw(PApplet.java:2361)
    at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
    at processing.core.PApplet.run(PApplet.java:2256)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 15 more
java.lang.NoClassDefFoundError: javax/media/opengl/GLException
    at processing.opengl.PGraphicsOpenGL.createPGL(PGraphicsOpenGL.java:1744)
    at processing.opengl.PGraphicsOpenGL.<init>(PGraphicsOpenGL.java:518)
    at processing.opengl.PGraphics3D.<init>(PGraphics3D.java:37)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at processing.core.PApplet.makeGraphics(PApplet.java:1919)
    at processing.core.PApplet.size(PApplet.java:1771)
    at processing.core.PApplet.size(PApplet.java:1742)
    at RecordAudio.setup(RecordAudio.java:45)
    at processing.core.PApplet.handleDraw(PApplet.java:2361)
    at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
    at processing.core.PApplet.run(PApplet.java:2256)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 15 more
Exception in thread "Animation Thread" java.lang.RuntimeException: javax/media/opengl/GLException
    at processing.core.PApplet.makeGraphics(PApplet.java:1944)
    at processing.core.PApplet.size(PApplet.java:1771)
    at processing.core.PApplet.size(PApplet.java:1742)
    at RecordAudio.setup(RecordAudio.java:45)
    at processing.core.PApplet.handleDraw(PApplet.java:2361)
    at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
    at processing.core.PApplet.run(PApplet.java:2256)
    at java.lang.Thread.run(Thread.java:745)
internetsadboy commented 10 years ago

My directory structure:

minim-broken

AubG commented 10 years ago

java.lang.NoClassDefFoundError: javax/media/opengl/GLException at processing.opengl.PGraphicsOpenGL.createPGL(PGraphicsOpenGL.java:1744) at processing.opengl.PGraphicsOpenGL.(PGraphicsOpenGL.java:518) at processing.opengl.PGraphics3D.(PGraphics3D.java:37) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at processing.core.PApplet.makeGraphics(PApplet.java:1919) at processing.core.PApplet.size(PApplet.java:1771) at processing.core.PApplet.size(PApplet.java:1742) at testingRecord.Recording.setup(Recording.java:17) at processing.core.PApplet.handleDraw(PApplet.java:2361) at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240) at processing.core.PApplet.run(PApplet.java:2256) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLException at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 15 more

AubG commented 10 years ago

I get the above error, and I am not sure as to why.

internetsadboy commented 10 years ago

Hmm weird, especially b/c it comes bundled w/ processing. The code works w/in "sketch."