Welcome to %s forums

BrainModular Users Forum

Login Register

Midi Array Module?

Tell us what you'd like Usine to do
Post Reply
bsork
Site Admin
Posts: 1334
Location: Asker, Norway
Contact:

Unread post by bsork » 11 May 2010, 22:13

Would it be much trouble creating a Midi Array Module? It would simpllify some things.
Bjørn S

jeanrene
Member
Posts: 91
Location: Caen Normandy France
Contact:

Unread post by jeanrene » 12 May 2010, 12:07

+1 for bsork, I approuved at 127%
PatcherKit at work.

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 12 May 2010, 15:35

It's a good suggestion but do you have noticed that the Pianoroll can work as a midi array?

http://www.sensomusic.com/wiki/doku.php ... _pianoroll

bsork
Site Admin
Posts: 1334
Location: Asker, Norway
Contact:

Unread post by bsork » 12 May 2010, 15:47

Yes, I know about that one, but I was more thinking of an "ARRAY OF tMidi" kind of module.
Bjørn S

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 12 May 2010, 18:22

It's not so easy to implement because the midi event contains 4 x 8bit elements.
and TMIDI is in fact an array.
So it means array of array.

But more basically what is your idea behind that?
Why do you need array's of Tmidi?

bsork
Site Admin
Posts: 1334
Location: Asker, Norway
Contact:

Unread post by bsork » 12 May 2010, 19:16

I don't want you to put much effort into this, as I can easily spread the MIDI data out in a "conventional" array just like you've done in the piano roll - I've done that before and was about to do it again when I came up with this suggestion.

My ideas behind it was to ease programming/storing sets of MIDI messages to be used as some kind of cross between a SysEx array and a Create Midi Message.

Just because I'm curious (again :)): I thought the MIDI messages was declared as a 4 byte record and "packed" to look like a Single when passing between modules. It certainly looked like that when tracing values through the wires sometimes.
Bjørn S

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 12 May 2010, 19:45

My ideas behind it was to ease programming/storing sets of MIDI messages to be used as some kind of cross between a SysEx array and a Create Midi Message.
still not very clear in my mind... Sometime I'm slow...
Let me think about it.
Just because I'm curious (again :)): I thought the MIDI messages was declared as a 4 byte record and "packed" to look like a Single when passing between modules. It certainly looked like that when tracing values through the wires sometimes
exactly, 4 bytes packed so can look like a 32bits float if they are connected,for example, to a math module.

gurulogic
Member
Posts: 1019
Contact:

Unread post by gurulogic » 12 May 2010, 20:54

bsork wrote:My ideas behind it was to ease programming/storing sets of MIDI messages to be used as some kind of cross between a SysEx array and a Create Midi Message.
.
This idea remins me a bit of the midiCCreset vst plugin by pizmidi http://www.kvraudio.com/forum/viewtopic.php?t=192282
that he kindly made at my request some time ago.
The idea is that the plugin will store whichever CC#'s and CC values last received and then release them when triggered. Is this something like what you are getting at? Kind of like a battery that stores multiple midi values? (which I suppose is like what an array is)

bsork
Site Admin
Posts: 1334
Location: Asker, Norway
Contact:

Unread post by bsork » 12 May 2010, 22:33

Well, sort of. My immediate interest in such a module would by for storing messages to be sent when triggered from my foot controller. This is all built around a script so it's not much hassle to use a normal array to store the values outside of the script and construct the MIDI messages when needed, but in other cases something more similar to the VST you mention could be done without scripting.
Bjørn S

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 13 May 2010, 08:44

ok, I understand the idea of creating a midi buffer.
But the midiCCreset can be implemented in usine with 2 data array's?


just an off-topic suggestion:
did you try the sampler to record midi data's. Normally it should work?

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 13 May 2010, 14:43

senso wrote:exactly, 4 bytes packed so can look like a 32bits float if they are connected,for example, to a math module.
a bit OT too, but im interested. is there a way, a math trick or i don't know, to do the reverse: 'unpack' some 32bit floats via modules, a bit like what does the shr fonction in scripts on 24bit colors to get the 3x8bits independant RGB? get 4x 8bits.
it could be virtually some arrays of arrays if can pack 4 values, manipulate in arraysas float32, be able to save to pm then redepack
on needz?

@bsork: didn't test but can't we store some tmidi arrays to a selector/dispatcher as they can handle arrays, then use 4xGetArray to unpack selected output to create midi module?
edit: mmm no doesn't work, as it's perceived as a single 32bit float? so wouldn't this kind of bits manipulation tool/math trick to encode ie 3 or 4x 8bits to 24 / 32 and demultiplex be useful? a script could actually do that. or indeed use 2x arrays is probably simpler at patch level in fact...
still, by curiosity im interested in that pack/unpack possible trick, a bit abstact to think in binary ;)

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 13 May 2010, 17:00

you're right a Bit manipulation pack is missing.
the only solution is a script with a a couple of AND and SHR operators.

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 13 May 2010, 17:11

thanks for infos gonna experiment with script.
im just wondering how that works for 32bits to repack:

so to recompile a 24bit we do byte1 + byte2*$100 + byte3*$10000.. so + byte4*$10000000 for 32bit?

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 13 May 2010, 19:06

so to recompile a 24bit we do byte1 + byte2*$100 + byte3*$10000.. so + byte4*$10000000 for 32bit?
yes


23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 06 Jun 2010, 17:21

mmm but midi shown is float32 is not like it was an int32

i don't manage to extract bytes as shr is awaiting an integer, what's the trick? how to convert a float32 to Dword?
or extract bytes from a float?

bsork
Site Admin
Posts: 1334
Location: Asker, Norway
Contact:

Unread post by bsork » 07 Jun 2010, 07:50

You can use both functions like Round and Trunc as well as type casting to explicit convert between data types. When type casting, you use the data type name - Byte, Integer, Single, DWord, whatever - like any other function name. For instance floatVar := Float(intVar);

BTW, remember that X shr N and X shl N do the same as raising X to the power of N. In the case of shl it's like using positive values for N, for shr it's like using negative numbers.
Bjørn S

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 08 Jun 2010, 01:16

woa i dindn't knew the float(intVar) thing go to try this out maybe this is exactly what im after, but i mnot sure, i guess it rounds.

cause in the midi case, i think we can't trunc or round the value, as it would mess the 4bytes we are trying to extract?
in fact let's say midi look like 2,7643678 , that's a float 32 ,so can't use shr, but it's 4 bytes corespond to some int midich,msg,code1,2.
if i round/trunc i get 2or3 , extracting the bytes of 2 value with shr will not be the same as what would be extracting first byte of 2,776.
i must admit i don't catch shl r, and the binary world very well, i got to try that out.
from what i understand it needs first to transform a float32(1+23+8) in 'what would be an int32' if adding it's 4bytes(8,8,8,8),(or inother words directly extract its bytes and convert to int) wich is not the same of rounding it .. from dk i see what i mean?
anyway that's complex for nothing really useful in most cases as we saw. more curiosity..

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests