Jose,
Can you explain the -= in C, is that subtraction?
It seems your routine is very similar to mine save for the 'twos complement' section - but if you are subtracting rather than adding,perhaps that accounts for it.
I do not know what the VZ checksum should be anyhow - only yamahas.
Is the VZ summing all nybbles and then anding with 7f,or is there something more?
________________________________
From: José Ángel Morente <msxjam@...>
To: CZsynth@yahoogroups.com
Sent: Wednesday, 29 January 2014, 16:18
Subject: Re: [CZsynth] VZ SysEx Format
Some time ago I posted a C program used to convert from VZ1 to standard SYX files. You may take a look at the checksum routine, maybe it can be helpful:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TONES_NO 64;
typedef unsigned char byte;
int main (int argc,char *argv[])
{
char *inputfilestream;
char *outputfilestream;
FILE *inputfile;
FILE *outputfile;
byte tonebuf[336];
byte operbuf[100];
byte syxopen[8]={
0xf0, 0x44, 0x03, 0x00, 0x70, 0x70, 0x02, 0xf7
};
byte syxdata[6]={
0xf0, 0x44, 0x03, 0x00, 0x70, 0x74
};
byte syxclose[7]={
0xf0, 0x44, 0x03, 0x00, 0x70, 0x71, 0xf7
};
int i,j,checksum=0;
byte buffer[10];
if (argc >= 2) {
inputfilestream = argv[1];
if (argc > 2) {
outputfilestream = argv[2];
} else {
outputfilestream = malloc(255);
strcpy(outputfilestream,inputfilestream);
outputfilestream = strcat(outputfilestream,".syx");
}
inputfile = fopen(inputfilestream,"rb");
outputfile = fopen(outputfilestream, "wb");
//write OPEN and DATA sysx messages
fwrite(syxopen,sizeof(syxopen),1,outputfile);
fwrite(syxdata,sizeof(syxdata),1,outputfile);
//process the patches
for (i=0;i<64;i++) {
fread(tonebuf,sizeof(tonebuf),1,inputfile);
checksum = 0;
for (j=0;j<sizeof(tonebuf);j++) {
//update the checksum
checksum -= tonebuf[j];
buffer[1] = tonebuf[j] & 0x0f;
buffer[0] = tonebuf[j] >> 4;
fwrite(buffer,2,1,outputfile);
}
//ignores the bit 7
checksum &= 0x7f;
fwrite(&checksum,1,1,outputfile);
}
//process the operations
for (i=0;i<64;i++) {
fread(operbuf,sizeof(operbuf),1,inputfile);
checksum = 0;
for (j=0;j<sizeof(operbuf);j++) {
//update the checksum
checksum -= operbuf[j];
buffer[1] = operbuf[j] & 0x0f;
buffer[0] = operbuf[j] >> 4;
fwrite(buffer,2,1,outputfile);
}
//ignores the bit 7
checksum &= 0x7f;
fwrite(&checksum,1,1,outputfile);
}
buffer[0] = 0xf7;
fwrite(buffer,1,1,outputfile);
fwrite(syxclose,sizeof(syxclose),1,outputfile);
fclose(inputfile);
fclose(outputfile);
}
return 0;
}
--
On Sun, Jan 5, 2014 at 10:23 PM, <facebook@cain-project.com> wrote:
>
>Happy new year to all,
>
>
>I spent some time during the holidays setting up an smal HTML5 based framework which is intented to act as a librarian for the VZ sound patches.
>
>
>Going through the specs I came over the checksum, which isn't described in detail in the CasioVZ-HohnerHS Sysex Format.pdf.
>
>
>Can anyone help me out on the details here?
>
>
>My idea:
>Create a little helper to rearrange existing sysex files, which will (in the first step) be consolidated in a new sysex file to be uploaded.
>
>
>
>My progress:
>So far I can drag and drop sysex files into the GUI and extract the tone and op names of the banks, also a re-arrangement is possible (from gui side).
>
>
>My need:
>Any help on the internal sysex format - especially on the check sum.
>
>
>Technology:
>HTML5 so anyone could use it. Upload to the VZ would still need an external tool but maybe HTML5 will support that, too in the future.
>
>
>Me:
>I have a VZ10m, HS-2, CZ-3000 and an HT-3000 in my set-up (besides D-110, X3R, AN1x, Phm and sonic|core Scope 5)
>
>
>Any help is appreciated,
>
>
>cheers,
>
>
>Pete
>
>
>(I was in the forum before but lot my ID after a computer crash ;) )
>
>Message
Re: [CZsynth] VZ SysEx Format
2014-01-29 by Lee Borrell
Attachments
- No local attachments were found for this message.