Pbind with \midi "Message 'uid' not understood."

Hello there,

i’ve used the Pbind function before with external instruments, currently when trying to run very basic code i get an error message. The code in question:

s.boot;

s.plotTree;

MIDIClient.init;

MIDIClient.destinations;

(
var m = MIDIOut.newByName("UMC404HD 192k", "UMC404HD 192k MIDI 1").latency_(Server.default.latency);
//var m = MIDIOut(0);

p = Pbind(
	\type, \midi,
	\midicmd, \noteOn,
	\midiOut, m,
	\chan, 0,
	\degree, Pwhite(-7,12,inf),
	\dur, Pwrand([0.25,Pn(0.125,2)],#[0.8,0.2],inf),
	\amp, Pexprand(0.5, 1.0, inf)
).play(quant:1);
)

p.stop;

s.stop;

Server boots up as expected. MIDI initialization also seems to work, when trying to play the Pbind i get:

*** Welcome to SuperCollider 3.11.0. *** For help press Ctrl-D.
SCDoc: Indexing help-files...
SCDoc: Indexed 1352 documents in 1.06 seconds
-> localhost
Booting server 'localhost' on address 127.0.0.1:57110.
JackDriver: client name is 'SuperCollider'
SC_AudioDriver: sample rate = 48000.000000, driver's block size = 512
JackDriver: connected  system:capture_1 to SuperCollider:in_1
JackDriver: connected  system:capture_2 to SuperCollider:in_2
JackDriver: connected  SuperCollider:out_1 to system:playback_1
JackDriver: connected  SuperCollider:out_2 to system:playback_2
SuperCollider 3 server ready.
JackDriver: max output latency 32.0 ms
Requested notification messages from server 'localhost'
localhost: server process's maxLogins (1) matches with my options.
localhost: keeping clientID (0) as confirmed by server process.
Shared memory server interface initialized
MIDI Sources:
	MIDIEndPoint("System", "Timer")
	MIDIEndPoint("System", "Announce")
	MIDIEndPoint("Midi Through", "Midi Through Port-0")
	MIDIEndPoint("UMC404HD 192k", "UMC404HD 192k MIDI 1")
	MIDIEndPoint("SuperCollider", "out0")
	MIDIEndPoint("SuperCollider", "out1")
MIDI Destinations:
	MIDIEndPoint("Midi Through", "Midi Through Port-0")
	MIDIEndPoint("UMC404HD 192k", "UMC404HD 192k MIDI 1")
	MIDIEndPoint("SuperCollider", "in0")
	MIDIEndPoint("SuperCollider", "in1")
	MIDIEndPoint("SuperCollider", "in2")
	MIDIEndPoint("SuperCollider", "in3")
-> MIDIClient
-> an EventStreamPlayer
ERROR: Message 'uid' not understood.
RECEIVER:
   nil
ARGS:
PATH: /home/dormir/Documents/supercollider/random_pattern1.scd

PROTECTED CALL STACK:
	Meta_MethodError:new	0x5574a8220200
		arg this = DoesNotUnderstandError
		arg what = nil
		arg receiver = nil
	Meta_DoesNotUnderstandError:new	0x5574a82224c0
		arg this = DoesNotUnderstandError
		arg receiver = nil
		arg selector = uid
		arg args = [  ]
	Object:doesNotUnderstand	0x5574a7e4d540
		arg this = nil
		arg selector = uid
		arg args = nil
	a FunctionDef	0x5574a8d9d2c0
		sourceCode = "#{|server|
						var freqs, lag, dur, sustain, strum;
						var bndl, midiout, hasGate, midicmd;

						freqs = ~freq = ~detunedFreq.value;

						~amp = ~amp.value;
						~midinote = (freqs.cpsmidi).round(1).asInteger;
						strum = ~strum;
						lag = ~lag;
						sustain = ~sustain = ~sustain.value;
						midiout = ~midiout.value;
						~uid ?? { ~uid = midiout.uid };  // mainly for sysex cmd
						hasGate = ~hasGate ? true;
						midicmd = ~midicmd;
						bndl = ~midiEventFunctions[midicm...etc..."
		arg server = localhost
		var freqs = 493.88330125612
		var lag = 0.0
		var dur = nil
		var sustain = 0.2
		var strum = 0.0
		var bndl = nil
		var midiout = nil
		var hasGate = nil
		var midicmd = nil
	a FunctionDef	0x5574a8d8fdc0
		sourceCode = "#{
					var tempo, server, eventTypes, parentType;

					parentType = ~parentTypes[~type];
					parentType !? { currentEnvironment.parent = parentType };

					server = ~server = ~server ? Server.default;

					~finish.value(currentEnvironment);

					tempo = ~tempo;
					tempo !? { thisThread.clock.tempo = tempo };


					if(currentEnvironment.isRest.not) {
						eventTypes = ~eventTypes;
						(eventTypes[~type] ?? { eventTypes[\\note] }).value(server)
					};

					~callback.value(current...etc..."
		var tempo = nil
		var server = localhost
		var eventTypes = ( 'fadeBus': a Function, 'freeAllocWrite': a Function, 'tree': a Function, 'on': a Function, 
  'load': a Function, 'freeBuffer': a Function, 'group': a Function, 'freeAllocRead': a Function, 'allocWrite': a Function, 
  'cue': a Function, 'grain': a Function, 'Synth': a Function, 'freeAllocWriteID': a Function, 'alloc': a Function, 
  'rest': a Function, 'sine2': a Function, 'sine1': a Function, 'midi': a Function, 'set': a Function, 
  'setProperties': a Function, 'parGroup': a Function, 'allocRead': a Fu...etc...
		var parentType = nil
	a FunctionDef	0x5574a8d31e00
		sourceCode = "<an open Function>"
	Function:prTry	0x5574a84a2ec0
		arg this = a Function
		var result = nil
		var thread = a Routine
		var next = nil
		var wasInProtectedFunc = false
	
CALL STACK:
	DoesNotUnderstandError:reportError
		arg this = <instance of DoesNotUnderstandError>
	Nil:handleError
		arg this = nil
		arg error = <instance of DoesNotUnderstandError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of DoesNotUnderstandError>
	Thread:handleError
		arg this = <instance of Routine>
		arg error = <instance of DoesNotUnderstandError>
	Object:throw
		arg this = <instance of DoesNotUnderstandError>
	Function:protect
		arg this = <instance of Function>
		arg handler = <instance of Function>
		var result = <instance of DoesNotUnderstandError>
	Environment:use
		arg this = <instance of Event>
		arg function = <instance of Function>
		var result = nil
		var saveEnvir = <instance of Environment>
	Event:play
		arg this = <instance of Event>
	Event:playAndDelta
		arg this = <instance of Event>
		arg cleanup = <instance of EventStreamCleanup>
		arg mute = false
	EventStreamPlayer:prNext
		arg this = <instance of EventStreamPlayer>
		arg inTime = 33.0
		var nextTime = nil
		var outEvent = <instance of Event>
	< FunctionDef in Method EventStreamPlayer:init >
		arg inTime = 33.0
	Routine:prStart
		arg this = <instance of Routine>
		arg inval = 33.0
^^ ERROR: Message 'uid' not understood.
RECEIVER: nil

was there some change to the \midi type of Pbind? Thanks for reading, hope someone can maybe point me towards some things i can try out to solve the issue.

greetings;;
dormir

You have a typo: it should be \midiout (but you have a capital O).

See http://doc.sccode.org/Tutorials/A-Practical-Guide/PG_08_Event_Types_and_Parameters.html#MIDI%20output

hjh

well… this is rather embarassing.

thanks for noticing! guess the error message kind of distracted me.

best,
dormir–

I thought at first that MIDIOut.newByName was returning nil… but then realized, if that were true, then latency_ would also fail. So then I had to look harder! :laughing:

It’s a subtle one – I overlooked it at first, too.

hjh