Why java midi synth on mac stop playing notes

醉酒当歌 提交于 2019-11-29 11:27:09

It's a Lion Problem. I'm developing a tool which sends MIDI to different ports and tested it on many platforms. Java Sound Synthesiser works well for all OS X - Versions except Lion. There it seems like the buffer of the Synthesiser overflows. After a few notes it stops playing, if I send a punch of notes it starts working again and stops again,..

However, sadly the Java Sound Synthesiser is an old thing where it seems nobody supports it any more.

Does anyone know other possibilities to play MIDI Sounds via Java except sending it to an third party sequencer? Would be nice if there would be something like just another General MIDI Library.

Thanks and greez!

Nate

Your problem isn't with the midi, it's with this:

while ( in.readLine() != null )

You're holding down the enter key, which allows the loop to execute very quickly many times. Your code will flip the note on and off as fast as the input buffer can take in data, and it will sound continuous, but I'd bet that if you were to read the midi signals you would have hundreds of them in the span of a few seconds. Your sound probably stops because the synth can't deal with the immense amount of midi data you are feeding it.

Try just pressing enter once and see if that keeps a continuous note going.

I would look into a better way to read the keys into your program. See this SO question for a possible method for doing that.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!