SXFORMAT Help

havenhamilton's icon

hi all, i'm having trouble using variables with the sxformat plugin. my midi piece requires a checksum, and i can't figure out a way to come up with a acceptable changeable argument for the variable checksum...i keep getting a checksum error in the midi gear. can anyone help??

sxformat 240 65 9 0 28 18 0 1 12 0 / is $i1 / / is $i2 / / ??? / 247

i have no problem running an object like:

sxformat 240 65 0 0 28 18 0 2 0 3 15 108 247

it's the changeable argument for the checksum that gets me in trouble. thanks!

Gary Lee Nelson's icon

Are you sending this to an external synthesizer? What is it?

On 10/28/07 2:19 PM, "havenhamilton" wrote:

>
> hi all, i'm having trouble using variables with the sxformat plugin. my midi
> piece requires a checksum, and i can't figure out a way to come up with a
> acceptable changeable argument for the variable checksum...i keep getting a
> checksum error in the midi gear. can anyone help??
>
> sxformat 240 65 9 0 28 18 0 1 12 0 / is $i1 / / is $i2 / / ??? / 247
>
> i have no problem running an object like:
>
> sxformat 240 65 0 0 28 18 0 2 0 3 15 108 247
>
> it's the changeable argument for the checksum that gets me in trouble. thanks!

Cheers
Gary Lee Nelson
Oberlin College
www.timara.oberlin.edu/GaryLeeNelson

havenhamilton's icon

it's a Roland DR770 drum machine. i have no problem sending sysex messages with fixed variables, but when i try sending changeable arguments, i cannot come up with a checksum "equation" that the dr770 will accept!

havenhamilton's icon

the manual says "the checksum consists of a value whose lower 7 bits are 0 when the address, size, and checksum itself are added."

so i figured if i use "sxformat 240 65 0 0 28 18 0 2 0 3 15 108 247", 0+2+0+3+15 = 20

then 128-20 = 108 = checksum.

so, if i change the object each time, re-entering the data and checksum, i can change things in the DR770, but i want to be able to use changeable arguments so i don't have to do that. i was hoping to be able to get a third inlet with "$i3" to calculate checksums outside of the sxformat object, but seems like two inlets are the maximum.

Gary Lee Nelson's icon

Usually it is the sum of all data bytes mod 128 (7 bits). Have you tried
sending the message without a checksum? Just skipping it and ending with
247.

On 10/28/07 3:21 PM, "havenhamilton" wrote:

>
> it's to a DR770 drum machine. i have no problem sending sysex messages with
> fixed variables, but when i try sending changeable arguments, i cannot come up
> with a checksum "equation" that the dr770 will accept!

Cheers
Gary Lee Nelson
Oberlin College
www.timara.oberlin.edu/GaryLeeNelson

Gary Lee Nelson's icon

Two inlets are not the maximum. Perhaps you can run all of the data bytes
through an accum object for $i3.

On 10/28/07 3:35 PM, "havenhamilton" wrote:

>
> the manual says "the checksum consists of a value whose lower 7 bits are 0
> when the address, size, and checksum itself are added."
>
> so i figured if i use "sxformat 240 65 0 0 28 18 0 2 0 3 15 108 247",
> 0+2+0+3+15 = 20
>
> then 128-20 = 108 = checksum.
>
> so, if i change the object each time, re-entering the data and checksum, i can
> change things in the DR770, but i want to be able to use changeable arguments
> so i don't have to do that. i was hoping to be able to get a third inlet with
> "$i3" to calculate checksums outside of the sxformat object, but seems like
> two inlets are the maximum.

Cheers
Gary Lee Nelson
Oberlin College
www.timara.oberlin.edu/GaryLeeNelson

havenhamilton's icon

oh, i see. i didn't leave spaces in between the slashes. let me mess with that a bit.

i also made some headway in the meantime:

sxformat 240 / 65 / 0 / 0 / 28 / 18 / 0 / 2 / 0 / 10 / is $i1 / / is $i2 / / is checksum ( 6, 11,1) / 247

so now i'm getting the object to add the data correctly before the F7. but, roland requires that i subtract the checksum from 128...so if the checksum is 12, the roland actually needs to see 116.

any tips on as to how to do this? within the object if possible...

havenhamilton's icon

i suppose this could work for now:

Max Patch
Copy patch and select New From Clipboard in Max.

Gary Lee Nelson's icon

Yes, you have exactly the right idea. The extra slashes are not needed. I
don't know which bits of data need to be included in the checksum or whether
is is a simple sum mod 128 or a sum mod 128 subtracted from 128. But
whichever, you need the sum and the math for $i3. You must do this outside
the sxformat object. Something like this...

Max Patch
Copy patch and select New From Clipboard in Max.

On 10/28/07 7:49 PM, "havenhamilton" wrote:

>
> oh, i see. i didn't leave spaces in between the slashes. let me mess with that
> a bit.
>
> i also been made some headway in the meantime:
>
> sxformat 240 / 65 / 0 / 0 / 28 / 18 / 0 / 2 / 0 / 10 / is $i1 / / is $i2 / /
> is checksum ( 6, 11,1) / 247
>
> so now i'm getting the object to add the data correctly before the F7. but,
> roland requires that i subtract the checksum from 128...so if the checksum is
> 12, the roland actually needs to see 116.
>
> any tips on as to how to do this? within the object if possible...

Cheers
Gary Lee Nelson
Oberlin College
www.timara.oberlin.edu/GaryLeeNelson

Trond Lossius's icon

Check out Lsum from the Lobjects (more info at maxobjects.com). Use it to
get the sum of all list members except for the check sum byte, then do a
!- 127 to get the check sum, and append the resulting number using append
or zl join.

Best,
Trond

> Two inlets are not the maximum. Perhaps you can run all of the data bytes
> through an accum object for $i3.
>
>
> On 10/28/07 3:35 PM, "havenhamilton" wrote:
>
>>
>> the manual says "the checksum consists of a value whose lower 7 bits are
>> 0
>> when the address, size, and checksum itself are added."
>>
>> so i figured if i use "sxformat 240 65 0 0 28 18 0 2 0 3 15 108 247",
>> 0+2+0+3+15 = 20
>>
>> then 128-20 = 108 = checksum.
>>
>> so, if i change the object each time, re-entering the data and checksum,
>> i can
>> change things in the DR770, but i want to be able to use changeable
>> arguments
>> so i don't have to do that. i was hoping to be able to get a third inlet
>> with
>> "$i3" to calculate checksums outside of the sxformat object, but seems
>> like
>> two inlets are the maximum.
>
>
> Cheers
> Gary Lee Nelson
> Oberlin College
> www.timara.oberlin.edu/GaryLeeNelson
>
>
>