Carey Brown wrote:What is an example of command line arguments that you're using?
Edit: sorry I missed your comment at the end.
java Synth 96 6 0 127 6500
Stephan van Hulst wrote:Actually, you shouldn't be using Thread.sleep() at all. If you want to block the current thread until the track has finished playing, you should use locks and conditions and add a meta event listener to the sequencer.
Stephan, can you tell me where I can go to find out how to "use locks and conditions" and adding "a meta event listener to the sequencer"? Are those things new to Java 8 or Java 9? I'm mostly familiar with Java 6 and 7, and I don't remember anything about locks, conditions, or meta event listeners.
As long as the threads in the executor service are not daemons, any melodies that started playing will continue playing when the executor service is shut down. That will give you very gracious termination of your application.
Note that I haven't tested this code or that in the previous post. There may be some mistakes I haven't thought of.