On Tue, 13 Oct 2015 14:05:35 +0300, Athanasios Silis wrote: >On Tue, Oct 13, 2015 at 2:05 AM, Ralf Mardorf wrote: >> Control Change bits of the three bytes are >> >> Byte 1, nnnn is for channel 0 to 15 >> >> 1011 nnnn >> >> Byte 2, ccc cccc number of controller >> >> 0ccc cccc >> >> Byte 3, vvv vvvv value >> >> 0vvv vvvv >> >> It's not too hard to write a function using amidi that allows you to >> use it like that >> >> my_function interface channel controller value >> >> my_function 0 10 7 127 >> >> It's comfortable to have a function that alows >> values from -63 to 0 to 64 and Oops, I made a mistake. Sometimes MIDI does use two's complement, IOW from -64 to 0 to 63 but IIRC this never is used for control change values. >> values from 0 to 127. >> >> Unfortunately I don't have time to search my scripts for such a >> function, but IIRC it wasn't hard to write it. >thank you Ralph, i'll look into it. > >I took a midi dump (through arecordmidi) from my BCR2000 controller and >realised while reading the midi file that 2 byte values are stored >locally in a midi file lsb first. This is opposite to what I see here >http://www.somascape.org/midi/tech/mfile.html#midi . for example the >midi *MThd* : Header chunk, was written in the midi file as 54 4D 64 >68 . and chunklen as 00 00 06 00 . So this is one thing that I should >keep in mind when I send hex numbers. > >also based on your analysis, can I just forget about all those headers >when I send a midi cc command? can I just send the midi even directly? > >yes writing a function is not too hard = i do work in low lelvel >programming after all, biut I dunno if by mistake I send some cmd that >can fuck up the controller :) I don't have knowledge about MIDI files, for simply sending MIDI data headers are only needed for SysEx. I would use variables, e.g. mx_header="F0 10 06" F0 Beginn SysEx transmission 10 Oberheim ID 06 Matrix-6/6R/1000 Device ID then follows the data and after that a checksum could be required, but sometimes it's not necessary eox="F7" F7 End of SysEx Now to your MIDI data, 54 is binary 0011 0110, hence not a MIDI command/not a status byte. For MIDI commands you don't need SysEx headers, but the first byte must be a status byte. FWIW ignore running status. When using amidi add all bytes to the send option, amidi likely will transform to running status. Running status allows to send data without a leading status byte, but again, you don't need to know how this works. For command bytes, aka status bytes bit 7 is set: 1xxx xxxx For data bytes bit 7 is cleared: 0xxx xxxx http://www.midi.org/techspecs/midimessages.php A control change example: 1011nnnn Status byte, were n is for the MIDI channel 0 - 15. 1011 is for control change, IOW hex Bn were n is the MIDI channel hex 0 - F, IOW dec 0 - 15. So the control change status byte must be B0, B1, B2, B3 ... B9, BA, BB, BC ... BF regarding the used MIDI channel After the status byte follow 2 data bytes. The data bytes are explained by your device's user manual. Most likely the used control changes for your device are for sending LSB and MSB and they are vendor/device specific. To send e.g. volume control to an averaged synth on MIDI channel 1, max volume send B1 07 7F B1 Control Change, MIDI channel 1 07 First data byte, 07 is for volume control 7F Second data byte, the max value, dec 127 and binary 0111 1111 LSB and MSB is needed if more than 128 values are needed (value 0 and 1 up to 127 = 128 values) then a pair needs to be send B1 xx yy B1 xx yy instead of a single B1 xx yy Regards, Ralf _______________________________________________ Linux-audio-user mailing list Linux-audio-user@xxxxxxxxxxxxxxxxxxxx http://lists.linuxaudio.org/listinfo/linux-audio-user