manaris / jythonMusic

JythonMusic is an open source environment for music making and creative programming activities.
GNU General Public License v3.0
33 stars 11 forks source link

MidiSequence fails to open sequencer #4

Open seanderson opened 3 years ago

seanderson commented 3 years ago

The following two lines yield an exception on Mac and Ubuntu 20.04 (jdk 1.8). Have had a similar issue when trying to use MidiSequence with Parts. Perhaps this is as simple as a missed "open" statement on the sequencer?

m = MidiSequence("JS_Bach.Canon.TriasHarmonica.BWV1072.mid",C3,100) m.play()

java.lang.IllegalStateException: java.lang.IllegalStateException: sequencer not openjMusic MidiSynth: Stopping

manaris commented 3 years ago

Hi,

Try the following... put a sleep(1.0) (more, or less) between the two statements, and see if that helps...

Explanation: The first statement uses the JVM Midi sequencer, which runs in a separate thread inside the JVM. The second statement is executed far too soon (i.e., before the Java Sequencer had a chance to finish opening the MIDI file). Adding a little delay should take care of things. Also, you might want to download the latest code from http://jythonmusic.org. This github code may be a little outdated. But that shouldn't be your problem.

On Thu, Nov 12, 2020 at 9:45 AM Sven Anderson notifications@github.com wrote:

The following two lines yield an exception on Mac and Ubuntu 20.04 (jdk 1.8). Have had a similar issue when trying to use MidiSequence with Parts. Perhaps this is as simple as a missed "open" statement on the sequencer?

m = MidiSequence("JS_Bach.Canon.TriasHarmonica.BWV1072.mid",C3,100) m.play()

java.lang.IllegalStateException: java.lang.IllegalStateException: sequencer not openjMusic MidiSynth: Stopping

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/manaris/jythonMusic/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXQKK2TNXR6LESTFPCDP6LSPPYKJANCNFSM4TTL6B7Q .