Forum Replies Created
-
AuthorPosts
-
True⦠im digging in the manual a little more. copy & paste code brings nothing without a basic understanding.
Yes, I know… I’m having the same problem… It ain’t the best documented language: Lua… And CTRLR info is a bit scattered around this site as well…
But the more we’ll learn in the beginning the easier it’ll be after that π
Well you get an error because you are passing a MemoryBLock to your function and trying to call getData() on it, and you call getData() on a CtrlrMidiMessage() object not a MemoryBlock object.
Cheers, I quickly tried but couldn’t get it to work when changing the MemoryBlock to CtrlrMidiMessage. I’ll try some more later…
Thanx
Well I’m not a professional but I know that staying positive will help you from going mad. But I don’t really think that going back to exactly the same “method” as last week and being positive about it will solve your problem. π
I’ve have changed my approach, took Atoms advice (if somebody will know… he will) and changed my code…
His code does what we want… (Mine did as well, but was way to long) The problem was I was trying to put in Hex values… But feeding it Decimals does/did the trick.
I have read about tonumber( ) and think I will have to use this to cast the bytes from the sysex message to numbers. The question is where/how.
Can somebody help / give me some advice? Please
Here is what I have now; and throws this error at me:
At line [-1]: [C]
What: C
Namewhat: method
Name: getData
Error message: std::runtime_error: ‘Trying to use unregistered class’This function tries to simulate the Midi-Dump, And prints to the console etc. :
function SYSEXDUMP_EMULATION() s = MemoryBlock( { 0xf0, 0x47, 0x00, 0x03, 0x48, 0x01, 0x00, 0x1d, 0x16, 0x0b, 0x1a, 0x0a, 0x0c, 0x0b, 0x1d, 0x1d, 0x0a, 0x0a, 0x0a, 0xf7 } ) name = covertNames( s ) -- name = akaiAlphabet( 10 ) -- <== works; just one character console( name ) end
I’m trying to convert the midi-message to Akai Character one by one here:
function covertNames( midiMessage ) programName = MemoryBlock() c = MemoryBlock() size = midiMessage:getSize() -- Size received midi bytes if size == 20 then -- if sysex string is 20 bytes long nameStringHex = MemoryBlock( midiMessage:getData():getRange( 08, 12 )) -- memoryblock with 12 char bytes for i = 1, 12, 1 do c = akaiAlphabet( nameStringHex:getByte( i ) ) programName:append( c:getData() ) end end return programName end
Here’s Atom’s function with some extra error messages.
So we’ll get an error when our number is out of bounds:function akaiAlphabet( c ) if c >= 0 and c <= 41 then akaiAlphabet = {'0','1','2','3','4','5','6','7','8','9',' ','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','#','+','-','.'} return (akaiAlphabet[ c ]) elseif c == "nil" then error("NIL is NOT an Akai Character") else error("This byte is NOT an Akai Character") end end
So if anybody can point out my mistake or tell me what to read or what DEMO-panel to look at… I would be very happy!
yes… I’m afraid so… I made a mistake…
It was coded by hand, and it should have read BLAHBLAHBLAH…But have you cracked it? The name decoding? I’m a bit further but am still having trouble with my input string.
For some reason the link doesn’t show up in above reply…
Not shure if this is what you mean… but have you read this:
To convert a MemoryBlock to a hex string
mb = MemoryBlock ("f0 f1 f2 f3 f7") console (mb:toHexString(1))
And more interesting “Blahblahblah” π
- This reply was modified 9 years, 3 months ago by BartBral.
The exact info i get back is as such
RAW:[f0 47 00 03 48 01 00 1d 16 0b 1a 0a 0c 0b 1d 1d 0a 0a 0a f7]Cheers man nice one!
If you could get your decoded result to go into my decoder as a string s=βblahblahblahβ Then i think it would work..
Sorry I don’t get that…
try this string: π
f0 47 00 03 48 01 00 0d 16 0b 12 0d 16 0b 12 0d 16 0b 12 f7
@Atom:
Yes, that will clean up a lot of the clutter. Thanks!I’ll try that. And try to put in the error message as well somehow, because I liked that when trying to get it to work before (it told me if my code was wrong or the data I was feeding it).
By the way: I read about “escaping” special characters with a “%”-sign in a few Lua tutorials… Didn’t I understand that or aren’t our characters special enough?
- This reply was modified 9 years, 3 months ago by BartBral.
It’s a shame you’re getting errors now π
I’ve been trying and can’t get it to work either.
See my idea below.Maybe somebody can tell us what’s wrong.
I can’t really debug it with the sampler attached, because i’m at home. And Sampler is in the studio.
It might be the string i’m feeding it, I have tried:
{ 01, 0a, 0e } and { 0x01, 0x01, 0x0a, 0x0e } and…
{ ‘0x01, 0x01, 0x0a, 0x0e’ } and etc. etc.What is the exact format of a recieved Sysex string?
------------------ -- This function requests a list of programs from the Akai Sampler ------------------ function requestProgramList() m = CtrlrMidiMessage( {0xF0, 0x47, 0x00, 0x02, 0x48, 0xF7} ) -- Req: List Programs in Memory panel:sendMidiMessageNow( m ) -- Send the request end ------------------ -- recieveAndCovertName() recieves midimessage and extracts namehexstring -- then converts this byte by byte to Akai Name string ------------------ function recieveAndCovertName( midiMessage ) programName = {} size = midiMessage:getSize() -- Size received midi bytes if size == 20 then -- Sysex string is 20 bytes long nameStringHex = midiMessage:getData():getRange( 08, 12 ) -- memoryblock with 12 char bytes for i = 1, 12, 1 do c = byte2AkaiChar( nameStringHex:getByte( i ) ) programName:append( c ) end end return programName end ------------------ -- byte2AkaiChar() gets called by above script. -- it takes bytes and coverts them to Akai-Characters ------------------ function byte2AkaiChar(byte) if byte == 0x00 then c = '0' elseif byte == 0x01 then c = '1' elseif byte == 0x02 then c = '2' elseif byte == 0x03 then c = '3' elseif byte == 0x04 then c = '4' elseif byte == 0x05 then c = '5' elseif byte == 0x06 then c = '6' elseif byte == 0x07 then c = '7' elseif byte == 0x08 then c = '8' elseif byte == 0x09 then c = '9' elseif byte == 0x0A then c = '%s' elseif byte == 0x0B then c = 'A' elseif byte == 0x0C then c = 'B' elseif byte == 0x0D then c = 'C' elseif byte == 0x0E then c = 'D' elseif byte == 0x0F then c = 'E' elseif byte == 0x10 then c = 'F' elseif byte == 0x11 then c = 'G' elseif byte == 0x12 then c = 'H' elseif byte == 0x13 then c = 'I' elseif byte == 0x14 then c = 'J' elseif byte == 0x15 then c = 'K' elseif byte == 0x16 then c = 'L' elseif byte == 0x17 then c = 'M' elseif byte == 0x18 then c = 'N' elseif byte == 0x19 then c = 'O' elseif byte == 0x1A then c = 'P' elseif byte == 0x1B then c = 'Q' elseif byte == 0x1C then c = 'R' elseif byte == 0x1D then c = 'S' elseif byte == 0x1E then c = 'T' elseif byte == 0x1F then c = 'U' elseif byte == 0x20 then c = 'V' elseif byte == 0x21 then c = 'W' elseif byte == 0x22 then c = 'X' elseif byte == 0x23 then c = 'Y' elseif byte == 0x24 then c = 'Z' elseif byte == 0x25 then c = '%#' elseif byte == 0x26 then c = '%+' elseif byte == 0x27 then c = '%-' elseif byte == 0x28 then c = '%.' else error("This byte is NOT an Akai Character") end return c end
Well anyway hope you get the idea… And that someone can help.
- This reply was modified 9 years, 3 months ago by BartBral.
Can only help you a bit… because I don’t know $#IT about everything… But:
01. File>New Panel
02. Choose Panel>Panel Mode
03. Right click somewhere on the empty screen…
Choose Add Component> The component of your liking.
(I find a Toggle button best for my simple debugging tests)
04. Choose Panel>Lua Editor
05. Select LUA on the left… Right click > Add Method
06. Type in name for your Method…
07. Copy your code, Where it says “Your code here”
08. Change your print(s) to console(s)
09. File>save and compile.
10. Go back to your Panel an select the button (or whatever)
11. Choose the name of your Method > Called when component value changes.
12. click your button and see what happens in console window in Lua editor.===
But I have tried your code and couldn’t get it to work without errors… And am not sure what the problem is exactly. But it has something to do with the gsub() call…
Good luck hope this helped a bit… Hope some smarter people can help you with your gsub / naming conversion.
- This reply was modified 9 years, 3 months ago by BartBral.
Attachments:
You must be logged in to view attached files.Nice!
But isn’t it a bit prone to error?
Say you have a name: WT1F = 211E0110… What will it do then?And the code to remove the sysex container bytes (F0, F7) and the header bytes, I think you should use something like:
nameString = midiMessage:getData():getRange(08, 12)
(where midiMessage would be s in your case). That would take a string of just the name data if I’m not mistaken.
ps… is there a specific reason why yo remove “F7” twice?
Well you might be the last one still using them π
I’m trying to get them up and running again.
I’m one of those MPC-people as well the last few years. But still have a whole rack of hardware samplers: Akai s612, Akai CD3000xl (fully loaded with filter, fx and ram), 2x Emu ESI 32 (without any @#$%?!-ing sysex), Roland VP9000 and a Yamaha A4000.
That CD3000xl was the love of my life… So I am going to dust that of in the near future…
====
Good luck with the research… Let us know when you find something!
- This reply was modified 9 years, 3 months ago by BartBral.
Can’t help you with the Lua (i’m just getting started with this thing called CTRLR)
But am planning in the future to do a pannel for my CD3000xl, so thought let’s see.A bit of logical sense and a little pinch of Googling got me the answer underneath.
I’m sure there should be more characters… Can’t remember for sure but I can be wrong it’s been a while…SLAP BASS = [f0 47 00 03 48 01 00____1d 16 0b 1a__0a__ 0c 0b 1d 1d 0a 0a 0a____f7]
PERC LOOP = [f0 47 00 03 48 01 00____1a 0f 1c 0d__0a__16 19 19 1a 0a 0a 0a____f7]
D.DRUM SET = [f0 47 00 03 48 01 00____0e 28 0e 1c 1f 17__0a__1d 0f 1e 0a 0a____f7]0 = 00
1 = 01
2 = 02
3 = 03
4 = 04
5 = 05
6 = 06
7 = 07
8 = 08
9 = 09
SPACE = 0A
A = 0B
B = 0C
C = 0D
D = 0E
E = 0F
F = 10
G = 11
H = 12
I = 13
J = 14
K = 15
L = 16
M = 17
N = 18
O = 19
P = 1A
Q = 1B
R = 1C
S = 1D
T = 1E
U = 1F
V = 20
W = 21
X = 22
Y = 23
Z = 24
# = 25
+ = 26
– = 27
. = 28Used this link to decode the characters:
https://github.com/Captain-Sandwich/akai.pyI know even less about Python scripts then about Lua… But there’s loads of usefull sysex commands in that scripts.
Good luck… Might join you later on when I know what I’m doing. I’m still trying to make her older sister (Akai s612) do what she’s told π
Bart
Cheers Dasfaker!
This really helps in understanding Dumps a lot!
I’ll try this to make an Akai s612 spit out it’s data…
…and feed it back later on.Nice post!
I’m using Snow Leopard (OSX 10.6.8) with the Latest Build (Ctrlr-5.3.50.dmg),
and it’s working…The only thing is that in Stand-Alone application, the Lua script panel is very buggy.
It seems to me that the background color doesn’t update. So when you scroll down or up all the characters stay where they where and the new ones get put over them. It’s unusable in that state. When I first started CTRLR the font was set to color FFFFFFFF as wel… If I’m not mistaken that is white… So that’s why didn’t see any Lua script at first.
(You’ll find some screenshots of the graphical glitch attached)
I then tried it as a plugin… and it seems okay as a VST in Live 9…
I can’t say for sure because I’m just starting to learn this software.(By the way: Cheers for this lovely software!!!… I hope it’ll breath new live into my dusty pile of hardware)
Attachments:
You must be logged in to view attached files. -
AuthorPosts