ERROR: Message 'top' not understood

I can reproduce the error by executing the code twice, the second time being executed before the first execution finishes, or more precisely before windows close by themselves.

You are starting the code with Window.closeAll, and that’s why in this particular case (executing twice), you got the error, because you are later asking for the window to close but it’s been deleted already and can’t answer to the top message which is needed, I think, to close it (after thinking about it, it’s more likely the .bounds call that triggers the .top call ).


What I tried then is this :

}.play.onFree{ s.queryAllNodes; { win.close; "ping".postln; }.defer };

So I can see exactly when the window is deleted. This happens indeed randomly, and the very time it closes, it sometimes leads to the error, as seen in this log :

Shared memory server interface initialized
NODE TREE Group 0
   1 group
      1001 temp__77
      1000 temp__76
   1002 system_freqScope1_shm
ping
NODE TREE Group 0
   1003 localhostInputLevels
   1 group
   1002 system_freqScope1_shm
   1005 stethoscope1
   1004 localhostOutputLevels
FAILURE IN SERVER /n_set Node 1001 not found
ERROR: Message 'top' not understood.
RECEIVER:

More debugging shows it happens during this call :

{
	win.background = colour;
	win.bounds = win.bounds
	.moveBy(posXthis, posYthis)
	.resizeBy(widthThis, heightThis);
	win.alpha = transparency;
}.defer;

I don’t have time to go deeper into this, but I think your silence detection is messy and sometimes frees itself before it should, closing win while it still has to be processed in the above block.


Yep, that’s that.

Try changing the synth ampMod :

sig = { |freq=4000, ampMod=1|

The signal isn’t lasting long enough and frees sig2dac at the end of the first iteration, which in turns closes win.

But you are still asking, 9 * 20 times, to change win's background, etc. Since it’s been closed, it raises an error.

2 Likes