Forum Replies Created
-
AuthorPosts
-
Old thread bumpage —
I am looking for a way to avoid sysex feedback loops.
Most of the time it is no problem that ctrlr gets a message it just sent out, because if it is some kind of response string it does not trigger anything when it is re-transmitted.
But for example with a preset dump request this kicks off a neverending loop because the dump request message gets mirrored every time; eg it goes out, goes in, out again….I have already tried “anticipating” this kind of loop by listening in the midiReceived script and doing *something* in reaction, but until now all i tried does not work.
Ideally this *something* would be to filter out the received string from traveling to the midi output again, is this possible?The setup is as follows:
sampler midi out ->pc midi in -> CTRLR panel -> pc midi out -> sampler midi in
Since sysex is channel independant channel settings do not matter, and toggling thru settings in ctrlr just makes it worse (obviously), doubling the received data.
The sampler always sends out received sysex events to the midi output again so i cannot “dam them in” on the device itself either.So i have had some time to work on my panel again recently, and i got this working 🙂
Seems I took a wrong approach with trying to use memoryblocks , as Atom suggested it is possible to do in native lua and this evades the “unable to make cast” problem.
This code does the trick:
setSampleName = function(modulator, newValue)
--make a dialogwindow to enter a samplename
c = panel:getComponent("setNamesLabel")
textwindow = utils.askForTextInputWindow("enter sample name", "do not use more than 16 characters", "please enter a name", "", false, "ok", "cancel")
c:setPropertyString("uiLabelText", textwindow)
console(string.format("This was typed in the set samplename inputwindow"))
console(string.format(textwindow))
--grab characters from texwindow's output (as dec)ch1 = string.byte(textwindow, 1)
ch2 = string.byte(textwindow, 2)
ch3 = string.byte(textwindow, 3)
ch4 = string.byte(textwindow, 4)
ch5 = string.byte(textwindow, 5)
ch6 = string.byte(textwindow, 6)
ch7 = string.byte(textwindow, 7)
ch8 = string.byte(textwindow, 8)
ch9 = string.byte(textwindow, 9)
ch10 = string.byte(textwindow, 10)
ch11 = string.byte(textwindow, 11)
ch12 = string.byte(textwindow, 12)
ch13 = string.byte(textwindow, 13)
ch14 = string.byte(textwindow, 14)
ch15 = string.byte(textwindow, 15)
ch16 = string.byte(textwindow, 16)--fill empty values with space value to avoid nil value errors = ascii 32 //working
if ch1 == nil then ch1 = 32 end
if ch2 == nil then ch2 = 32 end
if ch3 == nil then ch3 = 32 end
if ch4 == nil then ch4 = 32 end
if ch5 == nil then ch5 = 32 end
if ch6 == nil then ch6 = 32 end
if ch7 == nil then ch7 = 32 end
if ch8 == nil then ch8 = 32 end
if ch9 == nil then ch9 = 32 end
if ch10 == nil then ch10 = 32 end
if ch11 == nil then ch11 = 32 end
if ch12 == nil then ch12 = 32 end
if ch13 == nil then ch13 = 32 end
if ch14 == nil then ch14 = 32 end
if ch15 == nil then ch15 = 32 end
if ch16 == nil then ch16 = 32 end
--send name command bit = 09 // TODO tie two bits following 09 to sample number selection
namestr = string.format("f0 18 21 01 55 09 01 00 %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x F7", ch1,ch2, ch3, ch4, ch5, ch6, ch7, ch8, ch9, ch10, ch11, ch12, ch13, ch14, ch15, ch16)
console(string.format(namestr))panel:sendMidiMessageNow(CtrlrMidiMessage(namestr))
endNovember 29, 2012 at 3:11 pm in reply to: 1180 – performance laggy when MIDI In and Out enabled? #5109I also experienced laggy behaviour with midi but only when the console is being used for printing a few things at a time.
For instance in a midiReceived script i have some printing to console of channels, numbers and values that reacts on everything coming in for analysing incoming data, and when i turn off those commands the midi works without a hitch again.
If i turn them on again the midi seems to be inert for a second or two and then it spits out everything in quick succesion, as if it’s trying to catch up.
This happens on win7 ultimate 32 bit stock (no updates)
I had spotted the “;” typo along the way while debugging, but thanks for pointing it out 😉
2- ok i see now, thanks for showing me a proper way to handle this !
I have just tested your function but alas, still the same error in v1180.
It does make it to the console correctly though, so the function you wrote here works great, and i will be able to use it elsewhere alot too so thanks for that ” title=”Very Happy” />
I will wait for the next build to try again and will update here on how it turns out.I tried some more in various ways, still the same problem so imme let it go for now. Too bad because editing names from the ctrlr would be a great addition.
For what it’s worth, i ‘ve been digging around on and it’s propably due to the way luabind works,this thread gave me some clues[/url:9kprcm7c]
Thanks for thinking along, i have tried your ideas, but alas i keep bumping into the same error.
No matter how i break down the command(s), as soon as i want to insert the hexstring into the message construction it throws "unable to cast".The last resort i can think of is using an "invisible" lcd-strip and try to dump the memoryblock hex-ed output inthere & then fetch it from there to insert the values in the ougoing hexstring, but something tells me i will have the same error..
Or maybe some other way of coverting strings, but i am in the dark there not being a "real" programmer – my code propably already revealed this
It would be great if i got this to work, it would make my panel überfunctional
If/when i crack this i will keep this thread updated.
So i cooked up a way to do this but when i try to send out the midi message i get an "unable to cast error"… here’s the code id have until now, all works except getting the midi message out, gives me a "unable to make cast" error.
From what i gathered here it has something to do with string types, i have no idea how to work around this one.[code:20eyzqs6]–
— Called when a modulator value changes
— @modulator http://ctrlr.org/api/class_ctrlr_modulator.html
— @newValue new numeric value of the modulator
—
setSampleName = function(modulator, newValue)–make a dialogwindow to enter a samplename //working kinda — button actions todo
c = panel:getComponent("setNamesLabel")
textwindow = utils.askForTextInputWindow("enter sample name", "Maximum 16 characters, surplus will be discarded – Do not forget to save", "", "", false, "ok", "cancel")
c:setPropertyString("uiLabelText", textwindow)
console(string.format("This was typed in the inputwindow"))
console(string.format(textwindow))–grab first 16 characters as decimal value ie ascii id //working
ch1 = string.byte(textwindow, 1)
ch2 = string.byte(textwindow, 2)
ch3 = string.byte(textwindow, 3)
ch4 = string.byte(textwindow, 4)
ch5 = string.byte(textwindow, 5)
ch6 = string.byte(textwindow, 6)
ch7 = string.byte(textwindow, 7)
ch8 = string.byte(textwindow,
ch9 = string.byte(textwindow, 9)
ch10 = string.byte(textwindow, 10)
ch11 = string.byte(textwindow, 11)
ch12 = string.byte(textwindow, 12)
ch13 = string.byte(textwindow, 13)
ch14 = string.byte(textwindow, 14)
ch15 = string.byte(textwindow, 15)
ch16 = string.byte(textwindow, 16)–fill empty values with space value to avoid nil value errors = ascii 32 //working
if ch1 == nil then ch1 = 32 end
if ch2 == nil then ch2 = 32 end
if ch3 == nil then ch3 = 32 end
if ch4 == nil then ch4 = 32 end
if ch5 == nil then ch5 = 32 end
if ch6 == nil then ch6 = 32 end
if ch7 == nil then ch7 = 32 end
if ch8 == nil then ch8 = 32 end
if ch9 == nil then ch9 = 32 end
if ch10 == nil then ch10 = 32 end
if ch11 == nil then ch11 = 32 end
if ch12 == nil then ch12 = 32 end
if ch13 == nil then ch13 = 32 end
if ch14 == nil then ch14 = 32 end
if ch15 == nil then ch15 = 32 end
if ch16 == nil then ch16 = 32 end–make memoryblock and dump character bytes inthere //working
namedata = CtrlrLuaMemoryBlock()
namedata:append(ch1)
namedata:append(ch2)
namedata:append(ch3)
namedata:append(ch4)
namedata:append(ch5)
namedata:append(ch6)
namedata:append(ch7)
namedata:append(ch8)
namedata:append(ch9)
namedata:append(ch10)
namedata:append(ch11)
namedata:append(ch12)
namedata:append(ch13)
namedata:append(ch14)
namedata:append(ch15)
namedata:append(ch16)–convert to hex and print to console //working
x = namedata:toHexString(1)
console(string.format("here comes hex"))
console(string.format(x))–create and send name command 09 – TODO tie lsb and msb to selectors // "unable to make cast"
–panel:sendMidiMessageNow(CtrlrMidiMessage({0xF0; 0x18, 0x21, 0x01, 0x55, 0x09, 0x00, 0x00, x, 0xF7}))end[/code:20eyzqs6]
Anyone have ideas?
I looked at the examples and got it working in my panel after a bit of tinkering , thank you ” title=”Smile” />
I am trying to get multiple timers to work, how does one specify several unique timer id’s inside the same script (if possible)?
I have been trying by altering several things but i do not get them working.I have used the script posted by msepsis here[/url:3b6d4ur8] as starting point
for instance when i try this the timer will not start:
[code:3b6d4ur8]
timer:setCallback (1, timerCallback)
timer:startTimer(1, 500)function timerCallback (timerId) — this function name must match the name above in the first line.
— stuff to do while timer is running
timer:stopTimer(1)
end
— stuff to do after timer has run it’s duration (here 500ms)
[/code:3b6d4ur8]When i try this the timer does not stop:
[code:3b6d4ur8]
timer:setCallback (31, timerCallback)
timer:startTimer(31, 500)function timerCallback (timerId) — this function name must match the name above in the first line.
— stuff to do while timer is running
timer:stopTimer(31)
end
— stuff to do after timer has run it’s duration (here 500ms)
[/code:3b6d4ur8]And when i try another name for the timer it says "attemt to index global ‘timerOne’ (a nil value)
[code:3b6d4ur8]
timerOne:setCallback (33, timerCallback)
timerOne:startTimer(33, 500)function timerCallback (timerId) — this function name must match the name above in the first line.
— stuff to do while timer is running
timerOne:stopTimer(33)
end
— stuff to do after timer has run it’s duration (here 500ms)
[/code:3b6d4ur8]The goal is to use the timer to pause a portion of the script while waiting for an incoming sysex value, and then either continue the script or abort it, depending on the value received.
November 5, 2012 at 10:15 am in reply to: Receive MidiMessage in a modulator function Lua script? #4964Great thank you for taking time to explain this ” title=”Very Happy” />
I will delve into this today, i already figured out how to manipulate sysex strings between modulators; getting and setting bytes n stuff so i think i’ll be able to crack this.
I will also check out the other thread you mention for more insight.Cheerz,
H.To add to strange tab behaviour:
Modulators that are supposed to be inside a certain tab are assigned to a different tab upon re-opening a panel, also some modulators are moved outside of the tabs.
Messed up my gui work i did this afternoon…..
I have tried with locking size and position to no avail.
Using ctrlr 5.0.3 rev 1102 nightly, since its the only one not crashing on me when trying to run ctrlr.I have been trying with the modular expressions but i am still getting weird results.
I will decribe more detailed what is happening in my panel:
What i am trying to do is send out a sysex LSB/MSB value withing a certain range recognised by the emu.
For this specific parameter the ranges are :min: 1c 7F – dec: 028 127 –this equals -100%
default: 00 00 – dec: 000 000 –this equals 0%
max: 64 00 – dec: 100 000 –this equals +100%Whenever i go below zero with the ctrlr modulator, the MSB it sends out flips from 00 to FF, i need to be able to constrain this to 7F somehow so the emu recognises it a a "negative value in LSB" message.
The LSB behaves correctly, it is only the MSB portion giving me troubleThe closest i get with the expressions is when i make the modulator count from 0 to 200 and the do modulatorValue-100 and midiValue+100, but then i still get behaviour like described in my first post.
When i make the modulator count from -100 to 100 with the same expressions it only sends out positive values.***edit***
Been able to get correct behaviour using a uiFixedSlider and mapping out the raw data ranges ” title=”Smile” />
Thank you for making this clear to me, I will try out what you suggest.
And also thanks for the swift response – Serdecznie dziÄ™kujÄ™Of course, silly me for not realising the obvious…
So I should find a way prevent the modulator from sending out anything above 7f , or better find out what value triggers the negative amount in the emu and insert that, right?
I guess tomorrow I will be back to learning lua…
Would you (or anyone for that matter) mind getting me on track with a simple script I can adapt? I have already worked out some basics in lua but I am far from a programmer and am struggling a bit…Thank you for pointing me in the right direction, and for the warning regarding the weird behavior. I will look into your panel to see how you make this work and translate this to my panel.
Will be so cool when I get it to work, the emu samplers rock hard but are tedious to program from the front panel, once I get this working it will be even more badass ” title=”Smile” />
I am currently working on a emu 6400 (classic) panel, but still have lots of work on it. For now i have setup preset/voice/sample selection, most cords sources/destinations, some envelopes, lfo settings and tuning parameters.
Filters still to do, lots of work on those alone….
I am also kind of figuring out the layout as i go because there are so many parameters involved – working with tabs but it still seems a bit off.
Also some functionality is not working as it should right now because sent values are only working in positive direction, and i also noticed weird behavior when scsi from pc to emu is active.
I will post a draft version as soon as i feel it is complete enough.
Getting there but i have 2 problems at the moment:
I am building the preset/sample/voice part of the editor, wich involves adding/removing/copying presets/voices/samples.
I use IncDecbuttons to select preset/program/sample numbers, this works fine, but for some functionality (adding/removing voices in a selected preset) i would like to be able just to make one button that says "add new voice in selected preset" – like in the hardware front panel menu.Is there a way to "fetch" a value of a specific CTRLR modulator with another modulator? – in this case the value of the inc/dec button i use to select the preset?
Example:
IncDecbutton:
F0 18 21 01 55 01 02 5F 01 xx yy [/color:1bb0j6nv] 6B F7Add new voice button (simple button)
F0 18 21 01 55 20 xx yy [/color:1bb0j6nv] F7I would like to fetch the xx yy[/color:1bb0j6nv] value and insert this in the string of the "add new voice to selected preset" button so i can navigate to the desired voice using the IncDedbutton, hit the "add voice" button and have a new voice in the right place.
I have searched the site and manual but did not find a way…
Also i have a question about negative modulation: I have found some answers here as to why it does not work (yet) but does anybody know of a workaround?
Thanks for reading,
Hec
” title=”Very Happy” />
Working!!!
Thank you so much Atom!Now i can start mapping everything out and finally be able to unleash this beast of a sampler to the max ” title=”Cool” />
Wow that was fast ” title=”Smile” />
Yes, the data is 14-bit signed or unsigned number, split into two 7-bit midi bytes, sent LSB first.
It always has to be followed by a checksum bit, but this can be set to ignore (7F) and then the termination byte (F7)comes after this checksum.I do not know how to interpret your code example (i am not a programmer more of a tinkerer), do you mean i can write the formula with LS and MS as "placeholders" in the sysex code and refer the controller to them by using this "parameter id" thing?
Sorry for the noobishness
ps: i did some analysing/testing using midi-ox and am getting the effects i want when sending static sysex messages, maybe i can use the multi message list to define possible values? Will be long lists though….
pps: i attached a document i found listing the sysex specs for whoever might also be interested in giving this a go.
-
AuthorPosts