Re: [linux-audio-dev] Cakewalk file format

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] Cakewalk file format
From: Kevin Hremeviuc (khremeviuc_AT_yahoo.com)
Date: Tue Aug 31 2004 - 02:42:09 EEST


Hi Pedro,

I found a Cakewalk wrk to midi converter program put
out by cakewalk themselves that handles cakewalk
version 1 or 2 (can't remember which) files.
Unfortunately all my files are version 3. It worked on
some of them though.

Let me know if you want a copy. Maybe you can look at
the program to get some hints.

Kev

 --- Pedro Lopez-Cabanillas <plcl_AT_telefonica.net>
wrote:
> Hi,
>
> I've posted the following message in
> Rosegarden-devel mailing list, and
> Michael pointed me to an old thread from you about
> the same subject:
>
http://www.mail-archive.com/linux-audio-dev_AT_music.columbia.edu/msg03322
>
> Attached is a little program summarizing what I have
> found about the file
> format at this moment. I would like to know if you
> have more information,
> ideas or want to collaborate in this task.
>
> Regards,
> Pedro
>
> On Sunday 29 August 2004 01:50, Pedro
> Lopez-Cabanillas wrote:
> > Hi,
> >
> > I have many old songs, stored as Cakewalk "WRK"
> files, and I don't use
> > Cakewalk or Sonar anymore. I'm not planning to do
> so in the future, 'cause
> > I'm sure I will use Rosegarden. Of course.
> >
> > So, I need to convert my old WRK files to
> Rosegarden. But the WRK file is a
> > closed format, and not publicly documented. It
> will be necessary to reverse
> > engineer it, to rescue my old loved melodies along
> with the pile of shit.
> >
> > My plan is to first write a 'cake2rg' standalone
> utility, to start learning
> > the file format and meanwhile to produce some
> practical results. After
> > that, I hope to be able to import the files
> directly into Rosegarden. This
> > won't happen before 1.0-final.
> >
> > If somebody had the same idea and has the work
> almost finished, please let
> > me know ;-). Let's avoid duplicated work.
> >
> > Comments, please.
> >
> > Regards,
> > Pedro
> > /*
> * Cakewalk (WRK) file format test
> *
> * Copyright (c) 2004 Pedro Lopez-Cabanillas All
> rights reserved.
> *
> * This program is free software; you can
> redistribute it and/or modify
> * it under the terms of the GNU General Public
> License as published by
> * the Free Software Foundation; either version 2 of
> the License, or
> * (at your option) any later version.
> *
> * This program is distributed in the hope that it
> will be useful,
> * but WITHOUT ANY WARRANTY; without even the implied
> warranty of
> * MERCHANTABILITY or FITNESS FOR A PARTICULAR
> PURPOSE. See the
> * GNU General Public License for more details.
> *
> * You should have received a copy of the GNU General
> Public License
> * along with this program; if not, write to the Free
> Software
> * Foundation, Inc., 59 Temple Place, Suite 330,
> Boston, MA 02111-1307 USA
> */
>
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
>
> FILE *file;
> char *buffer;
> char *HEADER = "CAKEWALK";
> int vma, vme;
>
> #define BUFSIZE 1024
>
> #define TRACK_CHUNK 1
> #define STREAM_CHUNK 2
> #define VARS_CHUNK 3
> #define METER_CHUNK 4
> #define TEMPO_CHUNK 5
> #define SYSEX_CHUNK 6
> #define MEMRGN_CHUNK 7 // ???
> #define TIMEBASE_CHUNK 0x0A // if present should be
> the first chunk in the file.
> #define END_CHUNK 0xff
>
> void readBuffer(long count)
> {
> if (count > BUFSIZE)
> fseek(file, count, SEEK_CUR);
> else
> fread(buffer, count, 1, file);
> }
>
> void readFileVersion()
> {
> fgetc(file);
> vme = fgetc(file);
> vma = fgetc(file);
> }
>
> int readChunk()
> {
> int len;
> int ck = fgetc(file);
> if (ck != END_CHUNK) {
> fread(&len, sizeof(len), 1, file); // not portable
> readBuffer(len);
> }
> printf(" %02x", ck);
> return ck;
> }
>
> void cakeTest(char *fileName)
> {
> int ck_id;
> printf("File: %s\n", fileName);
> file = fopen(fileName, "r");
> if (!file) {
> printf(" Error reading the file\n");
> } else {
> readBuffer(strlen(HEADER));
> if (strcmp(buffer, HEADER)) {
> printf(" Bad file format\n");
> } else {
> readFileVersion();
> printf(" file version: %d.%d\n", vma, vme);
> printf(" file chunks:");
> do
> ck_id = readChunk();
> while (ck_id != END_CHUNK);
> fgetc(file);
> printf("\n");
> if (!feof(file)) {
> printf(" Corrupted file\n");
> }
> }
> fclose(file);
> }
> }
>
> int main(int argc, char *argv[])
> {
> int i;
> buffer = malloc(BUFSIZE);
> for (i = 1; i < argc; i++)
> cakeTest(argv[i]);
> return EXIT_SUCCESS;
> }
>

        
        
                
___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Tue Aug 31 2004 - 02:52:46 EEST