ccrma / chuck

ChucK Music Programming Language
http://chuck.stanford.edu/
GNU General Public License v2.0
813 stars 129 forks source link

MiniAudicle hanging when opening midi devices #91

Open jack461 opened 7 years ago

jack461 commented 7 years ago

Hi!

I am using an iMac (OSX 10.9.5) with the following versions of the software:

chuck --version

chuck version: 1.3.5.2 (chimera) mac os x : intel : 64-bit http://chuck.cs.princeton.edu/ http://chuck.stanford.edu/

miniAudicle

version 1.3.5.2 (gidora) git: a8d59b9

I have a KORG nanoKontrol2 (and/or a KORG nanoPAD2 -- same problem) MIDI device connected. The correct drivers are installed, and the devices are recognized by other softwares.

I test this program:

MidiIn nK2;

5 => int nK2Port;

<<< "About to open nK2:", nK2Port >>>;

if (!nK2.open(nK2Port))
{
    <<< "Can't open nK2 port", nK2Port >>>;
    me.exit();
}

<<< "Looks OK -- nK2:", nK2Port >>>;

[[5 is the device number of the nanoKontrol2]] It runs correctly with the command line version of Chuck:

$ chuck T1-Midi-01.ck  
About to open nK2: 5 
Looks OK -- nK2: 5 
$

When I use Chuck from miniAudicle, the MIDI devices appear correctly in the Device Browser, but when I run the code, it hangs in miniAudicle, with this error in a pop-up window:

The Virtual Machine appears to be hanging This is typically caused by a shred... etc.

I have then to kill miniAudicle from the Finder.

Is there something that I should have done and that I am missing? I expect to use Chuck in a Live situation in a few weeks, and this appears to be a real big problem for me.

Any help?

Thanks!

Jean-Jacques.

ericheep commented 7 years ago

Hm, for whatever it's worth, your code worked for me.

That's with a NanoKontrol2 on Sierra 10.12.3 using miniAudicle 1.3.5.2 and ChucK 1.3.5.2.

Maybe the OS matters in this case?

Also, you should be able to let ChucK find the string that represents the controller you're using, in your case -

MidiIn nK2;

<<< "About to open nanoKontrol2" >>>;

if (!nK2.open("nanoKONTROL")) { <<< "Can't open nanoKontrol2" >>>; me.exit(); }

<<< "Looks OK" >>>;

I doubt that'd help if your situation, but it's worth trying.

On Sun, Apr 2, 2017 at 1:00 AM, jack461 notifications@github.com wrote:

Hi!

I am using an iMac (OSX 10.9.5) with the following versions of the software:

chuck --version

chuck version: 1.3.5.2 (chimera) mac os x : intel : 64-bit http://chuck.cs.princeton.edu/ http://chuck.stanford.edu/

miniAudicle

version 1.3.5.2 (gidora) git: a8d59b9

I have a KORG nanoKontrol2 (and/or a KORG nanoPAD2 -- same problem) MIDI device connected. The correct drivers are installed, and the devices are recognized by other softwares.

I test this program:

MidiIn nK2;

5 => int nK2Port;

<<< "About to open nK2:", nK2Port >>>;

if (!nK2.open(nK2Port)) { <<< "Can't open nK2 port", nK2Port >>>; me.exit(); }

<<< "Looks OK -- nK2:", nK2Port >>>;

[[5 is the device number of the nanoKontrol2]] It runs correctly with the command line version of Chuck:

$ chuck T1-Midi-01.ck About to open nK2: 5 Looks OK -- nK2: 5 $

When I use Chuck from miniAudicle, the MIDI devices appear correctly in the Device Browser, but when I run the code, it hangs in miniAudicle, with this error in a pop-up window:

The Virtual Machine appears to be hanging This is typically caused by a shred... etc.

I have then to kill miniAudicle from the Finder.

Is there something that I should have done and that I am missing? I expect to use Chuck in a Live situation in a few weeks, and this appears to be a real big problem for me.

Any help?

Thanks!

Jean-Jacques.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ccrma/chuck/issues/91, or mute the thread https://github.com/notifications/unsubscribe-auth/AF_2hkw9uz2q275SUZZD3Z2pqaiza-saks5rr1WfgaJpZM4Mwu1n .

jack461 commented 7 years ago

Hi, Eric !

Many thanks for your comment.

I have added the test code:

MidiMsg msg;
now + 5::minute => time TS;
while (now < TS)
{
   nK2 => now;
   while (nK2.recv(msg))
   {
       <<< msg.data1, msg.data2, msg.data3 >>>;
   } 
}

I am also using, as you suggested, the nK2.open("nanoKONTROL") call with MiniAudicle, and sometimes it hangs, sometimes it works for a while then it crashes.

The command line version seems to be working; I get sometimes the sequence:

$ chuck  T2-MIDI-nK2-03.ck
[chuck]: (CoreAudio) timeout waiting for sample rate update for device (1)...
[chuck]: cannot initialize audio device (use --silent/-s for non-realtime)
$ chuck  T2-MIDI-nK2-03.ck
[chuck]: (CoreAudio) timeout waiting for sample rate update for device (0)...
[chuck]: cannot initialize audio device (use --silent/-s for non-realtime)
$

which seems to happen when an other soft has been using the sound card, but it seems otherwise more reliable.

I will try to test on a more recent Mac OS (but then my t.c. electronic studiokonnekt 48 sound card is not supported on it :-).

Thanks again for your suggestion !

Regards.

J.Jacques.

spencersalazar commented 7 years ago

Thanks for letting us know. Does the issue occur exclusively when you use the MIDI controllers? Does the miniAudicle hang warning appear for any other types of programs?

Its pretty common in "mission critical" scenarios, e.g. a live performance, to use command line chuck in lieu of miniAudicle, unless you really need the interactions miniAudicle provides, such as sporking code manually and live-editing- especially if you are already experiencing reliability issues.

jack461 commented 7 years ago

Hi!

I had no problems with other programs [[[except some unrelated bugs I have signaled in this forum]]].

So what I do is run MiniAudicle, start the Virtual Machine, load the script, and Add it.

I use 2 similar scripts:

MidiIn nK2;
<<< "About to open nanoKontrol2" >>>;
if (!nK2.open("nanoKONTROL"))
{
    <<< "Can't open nanoKontrol2" >>>;
    me.exit();
}
<<< "Looks OK" >>>;
MidiMsg msg;
// Run 
now + 2::minute => time TS;
while (now < TS)
{
   nK2 => now;
   while (nK2.recv(msg))
   {
       <<< msg.data1, msg.data2, msg.data3 >>>;
   } 
}
<<< "End." >>>;

Script 1 uses " nK2.open(5) " [[[5 is the nanoKontrol2 device number on my configuration]]] where script 2 uses " nK2.open("nanoKONTROL") " .

MiniAudicle hangs when I use script 1. When I run the script, I get this pop-up window:

The Virtual Machine appears to be hanging This is typically caused by a shred... etc.

The Virtual Machine is locked whatever I do (cancel, abort, click anywhere, etc.). I have to kill it from the Finder.

Now, it looks to be working if I use the script 2 with " nK2.open("nanoKONTROL") ". In fact, in this case, I have the same pop-up window, but, if I hit "cancel", the shred starts and works after a few seconds (5 or 6).

Then, I experienced some crashes with script 2, as I was interacting with the device at the end of the 2 minute loop, before the "End" is printed -- but it seems that I can't reproduce these crashes right now.

I can also say that if I stop the script, and run it a second time (without restarting MiniAudicle), it starts with no delay. Also, if I run the script 1 (with " nK2.open(5) ") after the script 2, it also runs correctly.

I tested this on a different Mac (this one with Mac OS 10.11.6), and I have installed new Korg MIDI drivers on both machines, with the same results.

I don't know if this helps much...

Best regards, and thanks for your help and your reactivity !

Jean-Jacques.