# Sound library does not work in Processing 4 - Python Mode

**URL:** <https://discourse.processing.org/t/sound-library-does-not-work-in-processing-4-python-mode/40936>\
**Category:** Processing.py\
**Created:** [February 15, 2023, 12:51pm UTC](https://discourse.processing.org/t/sound-library-does-not-work-in-processing-4-python-mode/40936 "2023-02-15T12:51:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![guojian.ryan](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@guojian.ryan](https://discourse.processing.org/u/guojian.ryan)\
**Post date:** [February 15, 2023, 12:51pm UTC](https://discourse.processing.org/t/sound-library-does-not-work-in-processing-4-python-mode/40936/1 "2023-02-15T12:51:37Z")

</div>

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.

```auto
add_library("sound")

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

```

Processing showed a ClassCastException as follows:

java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader ‘bootstrap’)  
at jycessing.LibraryImporter.addJarToClassLoader(LibraryImporter.java:315)  
at jycessing.LibraryImporter.recursivelyAddJarsToClasspath(LibraryImporter.java:164)  
at jycessing.LibraryImporter.addLibrary(LibraryImporter.java:140)  
at jycessing.LibraryImporter$1. **call** (LibraryImporter.java:82)  
at org.python.core.PyObject. **call** (PyObject.java:480)  
at org.python.core.PyObject. **call** (PyObject.java:484)  
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.PyTableCode.call(PyTableCode.java:171)  
at org.python.core.PyCode.call(PyCode.java:18)  
at org.python.core.Py.runCode(Py.java:1614)  
at org.python.core.Py.exec(Py.java:1658)  
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.PyTableCode.call(PyTableCode.java:171)  
at org.python.core.PyCode.call(PyCode.java:18)  
at org.python.core.Py.runCode(Py.java:1614)  
at org.python.core.Py.exec(Py.java:1658)  
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:276)  
at jycessing.PAppletJythonDriver.processSketch(PAppletJythonDriver.java:233)  
at jycessing.PAppletJythonDriver.findSketchMethods(PAppletJythonDriver.java:613)  
at jycessing.Runner.runSketchBlocking(Runner.java:399)  
at jycessing.mode.run.SketchRunner.lambda$2(SketchRunner.java:112)  
at java.base/java.lang.Thread.run(Thread.java:833)

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.

---

<div class="post-metadata">

**Author:** ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)\
**Post date:** [February 15, 2023, 5:21pm UTC](https://discourse.processing.org/t/sound-library-does-not-work-in-processing-4-python-mode/40936/2 "2023-02-15T17:21:51Z")

</div>

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 🙂.
