如何在 processing 4 python 模式下播放声音?

问题描述 投票:0回答:0

我现在正在做一个学校项目。我们得到了在程序处理(python 模式)中创建游戏的任务。前几天我走得很远,尽管程序错误消息有点无用,我总是不得不自己寻找原因。

无论如何,我现在想在游戏中添加一些第一声。所以我安装了 Processing Foundation 的官方声音库,但遇到了很多问题。

如上所述,我的第一次尝试涉及使用官方声音库。因为我没有使用 java,所以我尝试使用 Processing python 参考 (https://py.processing.org/reference/) 来让它工作,但这只是给了我一条我不明白的错误消息。

我刚刚输入:add_library("Sound")

并将此作为错误消息:

ClassCastException: 类 jdk.internal.loader.ClassLoaders$AppClassLoader 不能转换为类 java.net.URLClassLoader ) 在 jycessing.LibraryImporter.addJarToClassLoader(LibraryImporter.java:315) 在 jycessing.LibraryImporter.recursivelyAddJarsToClasspath(LibraryImporter.java:164) 在 jycessing.LibraryImporter.addLibrary(LibraryImporter.java:140) 在 jycessing.LibraryImporter$1.call(LibraryImporter.java:82) 在 org.python.core.PyObject.call(PyObject.java:480) 在 org.python.core.PyObject.call(PyObject.java:484) 在 org.python.pycode._pyx24.f$0(Inventar_Test_Modell.pyde:1) 在 org.python.pycode._pyx24.call_function(Inventar_Test_Modell.pyde) 在 org.python.core.PyTableCode.call(PyTableCode.java:171) 在 org.python.core.PyCode.call(PyCode.java:18) 在 org.python.core.Py.runCode(Py.java:1614) 在 org.python.core.Py.exec(Py.java:1658) 在 org.python.pycode._pyx23.f$0(/var/folders/l5/gshvnlmx7l538wt8818rk3th0000gn/T/Inventar_Test_Modell11316697653401988902/Inventar_Test_Modell.pyde:96) 在 org.python.pycode._pyx23.call_function(/var/folders/l5/gshvnlmx7l538wt8818rk3th0000gn/T/Inventar_Test_Modell11316697653401988902/Inventar_Test_Modell.pyde) 在 org.python.core.PyTableCode.call(PyTableCode.java:171) 在 org.python.core.PyCode.call(PyCode.java:18) 在 org.python.core.Py.runCode(Py.java:1614) 在 org.python.core.Py.exec(Py.java:1658) 在 org.python.util.PythonInterpreter.exec(PythonInterpreter.java:276) 在 jycessing.PAppletJythonDriver.processSketch(PAppletJythonDriver.java:233) 在 jycessing.PAppletJythonDriver.findSketchMethods(PAppletJythonDriver.java:613) 在 jycessing.Runner.runSketchBlocking(Runner.java:399) 在 jycessing.mode.run.SketchRunner.lambda$2(SketchRunner.java:112) 在 java.base/java.lang.Thread.run(Thread.java:833)

如果文字太多,我很抱歉,但我会尽可能详细,以便您能以最好的方式理解我的问题。 顺便说一下,我在运行 MacOS Ventura 13.2.1 的 MacBook 上编码。 “beads”或“minim”等其他库返回了相同的结果。在这一点上,我只是感到困惑,不知道如何排除故障。我还尝试安装其他版本的处理(4.1.2、4.2 和 3. 版本),将其安装在我的 Windows 10 机器上,当然还多次重新安装程序和库。甚至我的老师也不知道问题出在哪里。

如果有人至少可以给我提示问题出在哪里,我将不胜感激。这是我第一次在这个论坛上写作,我只写了大约 9 个月的代码,所以如果我忽略了一些明显的东西或者没有发布一些我应该发布的东西,我真的很抱歉。如果您需要我的程序或问题的更多信息,请随时问我。另外,英语不是我的母语,所以请怜悯我的写作。

python processing
© www.soinside.com 2019 - 2024. All rights reserved.