Home Forums General Programming Callback error: Lua runtime error Reply To: Callback error: Lua runtime error

#13350
lfo2vco
lfo2vco
Participant

If you format the string correctly you can send it out over midi.

Yep I see what you are getting at Hecticcc, but my problem lies with this (I think)

function saveToSynth(midiMessage)

	-- Get ASCII characters from uiLCDLabel and convert into two Hexadecimal strings of 10 characters long
	getPatchLabel = panel:getComponent("Patch Label"):getProperty("uiLabelText")
	character00 = string.byte(getPatchLabel,1)
	character01 = string.byte(getPatchLabel,2)
	character02 = string.byte(getPatchLabel,3)
	character03 = string.byte(getPatchLabel,4)
	character04 = string.byte(getPatchLabel,5)
	character05 = string.byte(getPatchLabel,6)
	character06 = string.byte(getPatchLabel,7)
	character07 = string.byte(getPatchLabel,8)
	character08 = string.byte(getPatchLabel,9)
	character09 = string.byte(getPatchLabel,10)

		if Character00 == 0x20 then 
			byte00 = string.format("20")
		else
			byte00 = string.format("%.2x",character00)
		end
		if Character01 == 0x20 then 
			byte01 = string.format("20")
		else
			byte01 = string.format("%.2x",character01)
		end
		if Character02 == 0x20 then 
			byte02 = string.format("20")
		else
			byte02 = string.format("%.2x",character02)
		end
		if Character03 == 0x20 then 
			byte03 = string.format("20")
		else
			byte03 = string.format("%.2x",character03)
		end
		if Character04 == 0x20 then 
			byte04 = string.format("20")
		else
			byte04 = string.format("%.2x",character04)
		end
		if Character05 == 0x20 then 
			byte05 = string.format("20")
		else
			byte05 = string.format("%.2x",character05)
		end
		if Character06 == 0x20 then 
			byte06 = string.format("20")
		else
			byte06 = string.format("%.2x",character06)
		end
		if Character07 == 0x20 then 
			byte07 = string.format("20")
		else
			byte07 = string.format("%.2x",character07)
		end
		if Character08 == 0x20 then 
			byte08 = string.format("20")
		else
			byte08 = string.format("%.2x",character08)
		end
		if Character09 == 0x20 then 
			byte09 = string.format("20")
		else
			byte09 = string.format("%.2x",character09)
		end

			bytes00to09 = string.format("0x%s 0x%s 0x%s 0x%s 0x%s 0x%s 0x%s 0x%s 0x%s 0x%s", byte00, byte01, byte02, byte03, byte04, byte05, byte06, byte07, byte08, byte09)
			console(string.format(bytes00to09))

	-- Send Tone Dump Sysex message to Kiwi-3P
	toneDump = string.format("f0 7f 06 %.2x 0xf7", bytes00to09)
	panel:sendMidiMessageNow(CtrlrMidiMessage(toneDump))
	end

Above is a very abridged version of my method, I think there is enough info to make sense of what I am trying to do. However I believe (and stand to be corrected) that calling on a string (bytes00to09) in the sysex string (toneDump) may be what is causing the problem.

I have formatted the method this way as there are a lot of modulator values to include and the values get difficult and unwieldy to follow as one long string. So I have subdivided them into groups of ten bytes, with the aim of combining them in between the Sysex start and end.

Seems this grand plan is a bit of a failure :-\

Complete example dump follows:
0xf0 0x7f 0x7f 0x7f 0x60 0x01 0x00 0x06 0x00 0x01 0x48 0x69 0x67 0x68 0x20 0x53 0x74 0x72 0x69 0x6e 0x67 0x73 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x04 0x27 0x7d 0x00 0x3f 0x09 0x60 0x4a 0x2b 0x7f 0x3f 0x01 0x12 0x03 0x2d 0x64 0x2a 0x4b 0x7f 0x11 0x3f 0x00 0x00 0x7f 0x00 0x7f 0x7f 0x46 0x30 0x7f 0x00 0x05 0x7f 0x7f 0x00 0x00 0x7f 0x00 0x00 0x00 0x0f 0x40 0x00 0x3f 0x00 0x00 0x05 0x00 0x0e 0x3d 0x15 0x00 0x03 0x01 0x55 0x78 0x08 0x02 0x03 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xf7