Sound library does not work in Processing 4 - Python Mode

Hi, I just updated to Processing 4 and found the sound library stopped working with Python Mode. The Java mode worked fine. Any help is much appreciated.


sf = None
def setup():
    global sf
    sf = SoundFile(this, "boxiddngbell.mp3")

Processing showed a ClassCastException as follows:

java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class (jdk.internal.loader.ClassLoaders$AppClassLoader and are in module java.base of loader ‘bootstrap’)
at jycessing.LibraryImporter.addJarToClassLoader(
at jycessing.LibraryImporter.recursivelyAddJarsToClasspath(
at jycessing.LibraryImporter.addLibrary(
at jycessing.LibraryImporter$
at org.python.pycode._pyx141.f$0(sketch_230215b.pyde:4)
at org.python.pycode._pyx141.call_function(sketch_230215b.pyde)
at org.python.core.Py.runCode(
at org.python.core.Py.exec(
at org.python.pycode._pyx140.f$0(/Users/rguo/Documents/Processing/sketch_230215b/sketch_230215b.pyde:96)
at org.python.pycode._pyx140.call_function(/Users/rguo/Documents/Processing/sketch_230215b/sketch_230215b.pyde)
at org.python.core.Py.runCode(
at org.python.core.Py.exec(
at org.python.util.PythonInterpreter.exec(
at jycessing.PAppletJythonDriver.processSketch(
at jycessing.PAppletJythonDriver.findSketchMethods(
at jycessing.Runner.runSketchBlocking(
at java.base/

Hmm. Can’t load native code to bring window to front using the absolute path: /Users/rguo/Documents/Processing/modes/PythonMode/mode/libjniosx.dylib.
Hmm. Can’t load native code to bring window to front.

1 Like

Cheers, @guojian.ryan !

I’m afraid Python mode is mostly not working in Processing 4. You can try getting the Processing 3.5.4 IDE and see if the Sound library still works there.

I think I have tried it last year but I’m unsure. Some libraries like Serial stopped working on Python mode in certain platforms even on Processing 3 for some time now. It is unfortunate the Python mode project is looking for a new maintainer.for quite a while now.

I wish @GoToLoop could become the new Processing Python Mode maintainer :slight_smile:.