Forum Replies Created
-
AuthorPosts
-
From a user interface point of view, maybe it would be easier to view each component part of the envelope as a box.
So the attack component would be encompassed by a box, drag the left side out and it will lengthen the attack time, drag the right side to the right and it will lengthen the attack but substract from the decay and release times. Sustain would only have a vertical drag element.
Just a thought.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalYOu can as i showed, your methods return numbers, and any method in Lua can take numbers (or any other type) as a parameter so:
Indeed, it works perfectly. I was expecting something more complicated, but I am relieved that the execution is beautifully simple. Cheers Atom.
The Kiwi-3P Editor panel is getting very close to completion. I still have a few functions to add to the menus, however most of the methods I require already reside in other functions that are already finished. So hopefully it will be mostly copy and pasting.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalGood luck with the project Pat… it’s a great way to learn more about MIDI CC and Sysex. The programming side is a revelation too; if like me this is your first attempt at working with scripts / methods and the like.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalYep, I am still getting my head around a lot of it.. there are example to be found panels in the Ctrlr app download, these are good for referencing examples of scripting / methods.
Atom has written a getting started guide here: http://ctrlr.org/getting-started/
I would recommend using the Ctrlr MIDI monitor found under the Windows Menu to see what your DX21 sends out in the form of CC or Sysex messages. You will also need the instruction manual for the DX21 which hopefully will have comprehensive tables showing you the MIDI CC and Sysex info.
Hope this helps : )
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalYeah that should work, but for some reason sometimes it fails for me. That’s why i use a custom variable just to be sure.
Cheers again for pointing me towards this. If I encounter any further problems I may press you for more info on the custom variable : )
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalHi Kingpeepee, I asked the same queston a couple of months back.
This was the reply:
One question regarding sysex, I’m hoping that the panel will be able to reflect patch changes made on the 3P. Will this require extra scripting or settings to be made in the Ctrlr panel?
yes.. you will need to get familiar with getting data and assigning values to modulators (knobs, sliders, buttons, etc).. Basically what you need to do is create a program change knob (or two buttons, – and +) that send a multimessage to your synth. first message is a program change, second message is a sysex program dump request.
Then on your panel itself (just click on “blank” space on your panel) go to the properties on the far right and look for “called when the panel receives a MIDI message”.
You’ll need to create a Lua method there called something like midiMessageRecieved. You need to create some hook that determines whether the message coming in is a program dump. Best ways to do this is ether by getting the nth byte to see if it is equal to your synth’s message ID for a program dump, or get the size of the message to compare to what a program dump’s byte length is. Here’s some example code of getting the 4th byte to see if it is equal to 0×10 (0x before a number represents HEX) which in my synths’s case indicates the message is a program dump from the synth:
midiMessageReceived = function(midiMessage) --this is a comment, it is ignored by the lua interpreter --create a variable "IDM" which is the value of the 4th byte of any incoming MIDI message: IDM = midiMessage:getLuaData():getByte(4) --is the fourth byte of incoming midi message equal to 0x10? if IDM == 0x10 then --if yes, then run another method called "assignValues" assignValues(midiMessage) --this next line is just a console message that alerts you that the script has run this far. View these in the "Lua Console" console ("program change sent, standby for panel update...") end end
IF the message is a program dump from the synth, you’ll then get the bytes that contain the values for your parameters, assign them to a variable (each one) and then assign that variable as the value for each modulator on your panel.
Here’s a shortened example of my “assignValues” method:function assignValues(midiMessage) -- create a variable that contains all bytes of program data from the synths program dump, get this info from synth's manual: programData = midiMessage:getData():getRange(7,256) -- cool, we've got everything, all we need to do now is actually assign the values to the modulators. --NOTE: use "setValueMapped" if the modulator is a combobox with custom values. --use "setModulatorValue" if the modulator is a typical modulator with a value range of, say 0-127 panel:getModulatorByName("Osc 1 Octave"):setValueMapped(programData:getByte(1), false) panel:getModulatorByName("Osc 1 Semitone"):setValueMapped(programData:getByte(2), false) panel:getModulatorByName("Osc 1 Detune"):setModulatorValue(programData:getByte(3), false, false, false) --continue for ALL parameters within your program dump.. . end
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalCool, I bet your getting a real buzz from seeing the fruits your work come together like this. Well done.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalRead up here for info on this:
ctrlr.org/forums/topic/preventing-script-from-running-at-panel-load/Hi Hecticcc, I have this variable in a Method I am using (written by Atom).
if panel:getRestoreState() == true or panel:getProgramState() == true then return end
This looks very similar to what Msepsis mentioned in the thread you referenced above. It does the job, many thanks for your assistance.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalOK, I have been trying to make this work and I found this:
-- trim whitespace from right end of string function trimr(s) return s:find'^%s*$' and '' or s:match'^(.*%S)' end
I’m guessing this is related to the String Class Atom made reference to. This is how I got it to work in my method:
nameData = L(PatchLabel:getProperty("uiLabelText")) function trim (s) return (string.gsub(s, "^%s*(.-)%s*$", "%1")) end nameTrim = (trim(nameData)) fileToWrite = utils.saveFileWindow("Save patch to disk", File(nameTrim), "*.syx", true)
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalAlso try to avoid calling panel:getModulatorByName() at runtime, this is the biggest mistake people make, in situation where you have hundreds or thousands of modulators in the panel (those static ones count too) Ctrlr needs to go through the table to find the one you want.
If you are done with designing your panel you can type somewhere in the init method for a panel
OK, this seems like really good advice, so I have given it a go. But now I am getting “Callback errors” on panel launch. Seems that the other methods are not aware of the ‘init method’ and are giving “nil values”.
Init is in the ‘Called when the panel has finished loading’ panel field and goes like this (shortened for this example):
function init() AftertouchEnv1toDCO = panel:getCombo("Aftertouch Env 1 to DCO") AftertouchLFO1toDCO = panel:getCombo("Aftertouch LFO 1 to DCO") AllSoundOff = panel:getButton("All Sound Off") BankDisplay = panel:getLCDLabel("Bank Display") Env1Attack = panel:getSlider("Env 1 Attack") PitchBendtoDCOPitch = panel:getCombo("Pitch Bend to DCO Pitch") end
One of the methods that fails is this:
benderDCOpitchMessage = function(mod, value) comboValue = PitchBendtoDCOPitch:getModulatorValue() if comboValue == 00 then mySysex = CtrlrMidiMessage({0xF0, 0x7F, 0x7F, 0x7F, 0x60, 0x01, 0x00, 0xb0, 0x23, 0x00, 0xF7}) panel:sendMidiMessageNow(mySysex) elseif comboValue == 01 then mySysex = CtrlrMidiMessage({0xF0, 0x7F, 0x7F, 0x7F, 0x60, 0x01, 0x00, 0xb0, 0x23, 0x20, 0xF7}) panel:sendMidiMessageNow(mySysex) elseif comboValue == 02 then mySysex = CtrlrMidiMessage({0xF0, 0x7F, 0x7F, 0x7F, 0x60, 0x01, 0x00, 0xb0, 0x23, 0x40, 0xF7}) panel:sendMidiMessageNow(mySysex) elseif comboValue == 03 then mySysex = CtrlrMidiMessage({0xF0, 0x7F, 0x7F, 0x7F, 0x60, 0x01, 0x00, 0xb0, 0x23, 0x60, 0xF7}) panel:sendMidiMessageNow(mySysex) end end
I also tried:
comboValue = PitchBendtoDCOPitch:getProperty()
Attachments:
You must be logged in to view attached files.Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalThat’s sweet and should make the process much easier.
Cheers guys.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalCheers Atom, it is starting to make sense now… I need to go away and try a few things out.
Thanks for pointing out the lessons on Functions, once I get get my head around them I’m sure it will open up a lot more possiblities. Something to read on the way home tonight eh!
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalSorry for the misunderstanding. Please bear with me and I’ll try to explain more clearly.
If the Popup Menu is in one Lua Method, can I put the function in a different Lua Method? Hopefully the attached image will help. : )
OK, been thinking some more about this…
‘myPopMenu’ method would end with ‘toneselectToRun()‘, and I’m guessing something like ‘myPopupMenuResult = MemoryBlock ({6})’.- This reply was modified 10 years, 7 months ago by lfo2vco.
Attachments:
You must be logged in to view attached files.Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalHi Atom, OK lets say the Method ‘myPopupMenu’ returns a result of ‘6’ and the method ‘toneSelect’ has this in the script:
if ret == 6 then firstLabel:setPropertyString ("uiLabelText", "A1") secondLabel:setPropertyString ("uiLabelText", "6") blah = 0x00
How do I get the ‘6’ from ‘myPopupMenu’ to ‘toneSelect’?
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalOK, so I got the Popup Menu working and doing what I want. So now I am thinking of expanding the options available on the Popup Menu, but there is already a lot of script to perform the single function it currently has. I think if I add more it will be totally confusing (to me).
So the question is can I have one method for the Popup Menu, then have separate methods for the function it will call? I guess the Popup would send a result to each method on which it would act. How is this done?
I have been looking at Atom’s Dialogue Windows Demo and I can see some stuff like:
comboBox = window:getComboBoxComponent("myCombo")
going on in the ‘windowCallback’ method andmodalWindow:setModalHandler(windowCallback)
going on in the ‘showWindowWithCombo’ method. I’m guessing that is performing the functions I would require.Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalHi Msepsis & Hecticcc, thanks for the follow up. Atom talked me through this one and together we got it sorted. But for completeness and also in case anyone else follows this thread looking for an answer here is the method used.
Some of the combobox bytes are expressed like this in the Kiwi-3P user manual:
Byte (20) DCO1 Wave/Range,
Data Type 0000yyxx,
xx =DCO 1 Range 00=16′ 01=8’10=4′
yy =DCO 1 Wave 00=Saw 01=Pulse 10=SquareSo the on receiving the MIDI message from the synth Lua treats it like this:
byte = programData:getByte(20) bi = BigInteger(byte) panel:getModulatorByName("DCO 1 Range"):setValueMapped(bi:getBitRangeAsInt(0,2), false) panel:getModulatorByName("DCO 1 Waveform"):setValueMapped(bi:getBitRangeAsInt(2,2), false)
And to get the data into Byte 20 for a Sysex dump Lua treats it like this:
dco1range = panel:getModulatorByName("DCO 1 Range") dco1waveform = panel:getModulatorByName("DCO 1 Waveform") bi = BigInteger(0) bi:setBitRangeAsInt (0,2,dco1range:getValue()) bi:setBitRangeAsInt (2,2,dco1waveform:getValue()) byte20 = bi:getBitRangeAsInt(0,7)
I get a bit of a buzz from doing this kind of stuff with data, perhaps because I am new to the game… perhaps because I am just a bit odd : )
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalThanks msepsis a clear explanation. Oh, and thanks again for your explanation to my post ‘Help with Sysex please’ that really helped my get my panel going.
By trial and error I am getting there. The panel now has a Save button that successfully dumps Sysex to the Kiwi-3P too! Almost done.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalshowYesNoCancelBox() ?
As usual I feel a right Muppet, I did try ‘showOkNoCancelBox()’. Close but no cigar!!!
I’ll bookmark that JUCE page. I looked through: http://sourceforge.net/p/ctrlrv4/code/1284/tree/nightly/Source/Lua/JuceClasses/
not realising the alert box is a JUCE thingy. Cheers.Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalCheers Atom.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalThis is working a treat.
I also have a label that contains numbers as Hex 00 01, what do I modify so it goes into the table as 00 01 not 30 30 20 30 31?
Cheers.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystal -
AuthorPosts