electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » Clavia Nord Modular » Nord Modular G2 Discussion
G2 patch format deciphered
Post new topic   Reply to topic Moderators: Nord Modular Editors
Page 2 of 4 [78 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: Previous 1, 2, 3, 4 Next
Author Message
mosc
Site Admin


Joined: Jan 31, 2003
Posts: 18247
Location: Durham, NC
Audio files: 225
G2 patch files: 60

PostPosted: Fri Mar 17, 2006 6:01 pm    Post subject: Reply with quote  Mark this post and the followings unread

Congrats... thumb up
_________________
--Howard
my music and other stuff
Back to top
View user's profile Send private message Visit poster's website AIM Address
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24451
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Fri Mar 17, 2006 6:35 pm    Post subject: Reply with quote  Mark this post and the followings unread

Can confirm it to be working on patches, after trying a few. For performances it must ne a little different.

edit :

with this code :

Code:

function CRCClavia( Seed: Integer; X: Integer): Word;
var
   i    : Integer;
   iCrc : Integer;
   k    : Integer;
begin
   k    := ((( Seed shr 8) xor X) and 255) shl 8;
   iCrc := 0;
   for i := 1 to 8
   do begin
     if ( iCrc xor k) and $8000 <> 0
     then iCrc := ( iCrc shl 1) xor $1021
     else iCrc := iCrc shl 1;
     k := k shl 1;
   end;
   Result := (( Seed shl 8) xor iCrc) and $ffff;
end;



too much coffee

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
jamos



Joined: Jun 01, 2004
Posts: 514
Location: Eugene, Oregon, USA
Audio files: 4
G2 patch files: 41

PostPosted: Fri Mar 17, 2006 7:01 pm    Post subject: Reply with quote  Mark this post and the followings unread

I suspect that the header length is different in prf2 files; I just used a fixed length in my test code, whereas the correct way to do it would be to search for the first byte after the null terminator in the header string.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24451
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Fri Mar 17, 2006 7:07 pm    Post subject: Reply with quote  Mark this post and the followings unread

Ok, performances work as well. Just do not start at a fixed offset of 0x50 but instead scan for the first occurance of \0, set the starting point just past that \0 then execute the crc over the rest of the bytes (but not the last two (*1)). This will be "better" for patches as well of course :)

*1 : when you do however include the last two byte in the CRC calculation the result will be zero, a known property for CRC's alowing for a somewhat easier check for correctness.

Edit : we cros posted :)

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
monobass



Joined: Nov 30, 2004
Posts: 275
Location: UK
G2 patch files: 12

PostPosted: Sat Mar 18, 2006 9:38 am    Post subject: Reply with quote  Mark this post and the followings unread

I missed this thread in the past. Good work Smile

It must make the Clavia developers chuckle reading this.. I hope it does anyway. Why they don't just give away the patch format I'll never know though... they must know it'll be reverse engineered eventually. Still.. It would be a shame to deny you guys the challenge!

_________________
Steve
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24451
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Sun Mar 19, 2006 4:57 pm    Post subject: Reply with quote  Mark this post and the followings unread

I found a little bug in http://www.dewb.org/g2/pch2format.html regarding the Module List. As stated a module entry in the module list takes 50 bits always, but I noticed that for an OscC module 56 bits are used (so there are 6 more unknown bits) - there will undoubtedly be more exceptions. This is ugly Evil or Very Mad

A partial dump :

Code:

  ModuleList
  (
    {0000}  #01000000 #10000010 #01000000 #01000000  #00000000 #00000000 #00000000 #00010000
    {0008}  #00000010 #01000000 #10000000 #00000011  #00000000 #00000000 #00010000 #00000000
    typeId    = $4A // not included in binary above
    ByteCount = 16  // not included in binary above
    Location    = VA
    ModuleCount = 2
    Modules[
      Module
      (
        {0000}  #00000001 #00000000 #00000000 #00000000  #00000000 #00000001
        ModuleType  = 9
        ModuleIndex = 1
        Col         = 0
        Row         = 0
        Color       = 0
        Unknown1    = $00
        Unknown2    = $0
      ) // Module
      Module
      (
        {0000}  #00100100 #00001000 #00000000 #00110000  #00000000 #00000000
        ModuleType  = 0
        ModuleIndex = 36
        Col         = 4
        Row         = 0
        Color       = 12
        Unknown1    = $00
        Unknown2    = $0
      ) // Module
    ] // Modules
  ) // ModuleList



and a screen shot of the patch :


apatch.jpg
 Description:
a patch
 Filesize:  12.32 KB
 Viewed:  7555 Time(s)

apatch.jpg



_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
dasz



Joined: Oct 16, 2004
Posts: 1644
Location: victoria, canada
Audio files: 29
G2 patch files: 56

PostPosted: Sun Mar 19, 2006 7:11 pm    Post subject: Reply with quote  Mark this post and the followings unread

and another nasty part is they may change the format at any time. But probably too easy, since it means h/w programming too. easier than dsp tho.

In Revolve days we reversed engineered the rebirt 1.5 and 2.0 file formats, and then the Propellerheads released the format for 2.0, thanks guys!

/Dasz
Back to top
View user's profile Send private message
ian-s



Joined: Apr 01, 2004
Posts: 2672
Location: Auckland, New Zealand
Audio files: 42
G2 patch files: 626

PostPosted: Sun Mar 19, 2006 8:02 pm    Post subject: Reply with quote  Mark this post and the followings unread

I imagine there are some changes with 1.4, exclude from mutator etc.
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24451
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Sun Mar 19, 2006 8:03 pm    Post subject: Reply with quote  Mark this post and the followings unread

I know Dasz.

I compiled a table of the bit counts for all modules, see attachment.

Edit : attachement update.

Edit : atachment deleted, see later post on same date as last edit.

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.

Last edited by blue hell on Wed Mar 22, 2006 7:37 pm; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
3phase



Joined: Jul 27, 2004
Posts: 1189
Location: Berlin
Audio files: 13
G2 patch files: 141

PostPosted: Mon Mar 20, 2006 3:42 am    Post subject: Reply with quote  Mark this post and the followings unread

I wonder why they keep the format so secret...
Is there any harm for the product possible?

There was such nice freeware tools for the NM. I think it can be rather beneficial for the instrument when you guys succed.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mosc
Site Admin


Joined: Jan 31, 2003
Posts: 18247
Location: Durham, NC
Audio files: 225
G2 patch files: 60

PostPosted: Mon Mar 20, 2006 7:03 am    Post subject: Reply with quote  Mark this post and the followings unread

I don't know what the Clavia line on this is, but I've developed programs for personal use and ones which were made public. If the level of work is 1X to develop a program, then it is 10X to support it. Some would say I'm underestimating.

During a program's life one often changes internal data structures and intermediate file formats. If these were public, then any change would have to be throughly documented and and tested - not only for whatever use the developers make of them, but for any conceivable use anyone else has devised.

I would like Clavia to continue to spend whatever resources they can devote to the G2 on improvements (new modules particularly). If they made the file format of interal operations public, then they'd have less resoruces for new stuff.

One could argue that if it were "opened up" then independent developers could make the improvements and develop new modules. I have made such arguments myself in the past. But it would then become an open source project. I love open source software, but it isn't for everyone. Such projects often diverge down separate incompatible paths; that wouldn't be very good.

_________________
--Howard
my music and other stuff
Back to top
View user's profile Send private message Visit poster's website AIM Address
Fozzie



Joined: Jun 04, 2004
Posts: 875
Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49

PostPosted: Mon Mar 20, 2006 7:30 am    Post subject: Reply with quote  Mark this post and the followings unread

mosc wrote:

One could argue that if it were "opened up" then independent developers could make the improvements and develop new modules. I have made such arguments myself in the past. But it would then become an open source project. I love open source software, but it isn't for everyone. Such projects often diverge down separate incompatible paths; that wouldn't be very good.

I'm no programmer, but isn't this two steps ahead of just releasing the file format? The old NM file format was very open, which allowed people to make specific user applications (outside of the editor). It didn't allow them to mess with the editor or the modules themselves, nor make it an open source project.
Back to top
View user's profile Send private message
dasz



Joined: Oct 16, 2004
Posts: 1644
Location: victoria, canada
Audio files: 29
G2 patch files: 56

PostPosted: Mon Mar 20, 2006 9:37 am    Post subject: Reply with quote  Mark this post and the followings unread

I agree with mosc. Opening any file systems to the public means some kind of support. Like I and others keep saying, Clavia is no big shop, so any additional work is carefully considered. Each of the Clavia guys put in a LOT of time developing their products -- a lot more time than I would ever consider putting in on a regular basis.

Speaking from experience, one possble reason the G2 format is binary and not ascii (text based) is the speed of parsing the thing. A binary file loads quicker as there is minimal parsing involved. A human readable format takes longer (especially on a h/w platform). Since Clavia introduced a performance file, which is equivalent to 4 patches, this may have enforced the reason. I'm just guessing for Clavia's reasons.

well-done well-done I applaud this effort at reverse-engineering well-done well-done .
It's not easy, but it is do-able! Like I said before, we at Revolve (thanks to Frank --- aka Green Boy who did the reverse engineering) did succeed to figure out both Rebirth File format 1.5 and 2.0 with no help from Pheads.

/Dasz
Back to top
View user's profile Send private message
Afro88



Joined: Jun 20, 2004
Posts: 701
Location: Brisbane, Australia
Audio files: 12
G2 patch files: 79

PostPosted: Mon Mar 20, 2006 3:04 pm    Post subject: Reply with quote  Mark this post and the followings unread

They don't have to open it up, document and support the patch format. They just have to leave it in the un-encrypted text format and say they don't support any use of the G2 with non-Clavia programs. Solved.

But I guess by encrypting they avoid any external programs screwing up their support.
Back to top
View user's profile Send private message Visit poster's website
dasz



Joined: Oct 16, 2004
Posts: 1644
Location: victoria, canada
Audio files: 29
G2 patch files: 56

PostPosted: Mon Mar 20, 2006 3:14 pm    Post subject: Reply with quote  Mark this post and the followings unread

I'd rather have pattern memories in sequencers rather than an easier to decipher file format. And loop length changes which do not reset the sequence to 1 immediately. And muteless patch loading. And ...

/Dasz
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24451
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Mon Mar 20, 2006 7:40 pm    Post subject: Reply with quote  Mark this post and the followings unread

A little update.

The extra length needed for some modules probably contains the the mode(s). You'll recognize a mode on that the patch needs to be recalculated when it changes. For the delay modules it's the delay time, for oscillator like things, when present, it's the wave shape. Each mode needs 6 extra data bits above the usual 50. The logic gate module is the only module having two modes, and it (indeed) needs 62 data bits. No modules have more than two modes.

In the file I posted earlier the Phaser was mentioned twice (one should be flanger), and there was a typo in a module name somewhere, I'll post an update above.

An example dump for a module having one mode.

Code:

      MRndClkB
      (
        {0000}  #11001110 #00000001 #00000000 #00000000  #00010000 #00000000 #01000000
        Knowledge[
          BitSize    = 56
          ShortName  = 'RndClkB'
          LongName   = 'Random Clock B'
          Height     = 3
          Inputs     = []
          Outputs    = []
          Params     = []
          Modes      = [ 'Character']
        ] // Knowledge
        ModuleType  = 206
        ModuleIndex = 1
        Col         = 0
        Row         = 0
        Color       = 4
        Unknown1    = $00
        Unknown2    = $1
      ) // MRndClkB


Still quite some work to be done on that, but I've got the bit lengths OK now I think and so I can start parsing the next sections ... I'll need a proper cable dump before being able to determine the order of the inputs/outputs, and a proper parameter dump to be able to determine the module parameters' order.

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24451
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Tue Mar 21, 2006 4:14 pm    Post subject: Reply with quote  Mark this post and the followings unread

Something changed in the cable list w.r. to the specs on http://www.dewb.org/g2/pch2format.html

it says :
Code:

2 bits location
1 byte Cable count


I need to read 24 bits into the data though instead of 10 to reach the last bit (lsb) of the cable count. Now for version 1.4 I think the maximum amount of cables to have was changed from 255 to something larger. Having 22 bits for the cable count seems a bit overdone though, so I, arbitrarily, decided to use the following working definition fttb :

Code:

 2 bits location
12 bits unknown
10 bits Cable count


So here is a version dependency, and something more to guess.

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24451
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Wed Mar 22, 2006 7:36 pm    Post subject: Reply with quote  Mark this post and the followings unread

Better module knowledge, no parameters yet. Present are the modes for all modules and the in/outs for about a third or so.

I'll delete the old module info file, the bit counts can be calculated from this one as 50 + mode_count * 6.

Edit : Comment( 'Learned 138 from 166, 28 to go')

Edit : Comment( 'Learned 166 from 166, 0 to go')

Edit : some error fixing, added a html version, added some params from existing module table.


The Extension 'html' was deactivated by an board admin, therefore this Attachment is not displayed.


module_table.txt
 Description:
some g2 module knowledge

Download (listen)
 Filename:  module_table.txt
 Filesize:  42.24 KB
 Downloaded:  184 Time(s)


_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.

Last edited by blue hell on Sat Mar 25, 2006 3:41 pm; edited 6 times in total
Back to top
View user's profile Send private message Visit poster's website
3phase



Joined: Jul 27, 2004
Posts: 1189
Location: Berlin
Audio files: 13
G2 patch files: 141

PostPosted: Thu Mar 23, 2006 3:21 am    Post subject: Reply with quote  Mark this post and the followings unread

wow..you are really working on it ...
thanks for the time you people involve in that...
I am pretty sure that once you ve suceeded there will be a practical applikation from this effort earlier or later...
good luck...
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Hyde



Joined: Jul 15, 2004
Posts: 118

G2 patch files: 2

PostPosted: Thu Mar 23, 2006 1:46 pm    Post subject: Reply with quote  Mark this post and the followings unread

props
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24451
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Thu Mar 23, 2006 6:11 pm    Post subject: Reply with quote  Mark this post and the followings unread

Code:
Comment( 'Learned 138 from 166, 28 to go')


But I'm going to have a heavy day tomorrow, so no more now.

I'll update the file above.

BTW, it's the parameters that is going to take time. Not only would I like to know what index has what name, but for the info to be useful the ranges must be known as well,and preferably the the exact meaning of each value.

Anyway, after the last 28 for in/outputs I'll go on with parameters, starting with just gathering names and indices. Hopefully I'll see a pattern in the meanings of the parameter values, that would be helpful.

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24451
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Fri Mar 24, 2006 7:16 pm    Post subject: Reply with quote  Mark this post and the followings unread

Code:
Comment( 'Learned 166 from 166, 0 to go')


I'll update the file above, watch the edit date/time.

Right ... whats next, parameters ....

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24451
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Sat Mar 25, 2006 3:33 pm    Post subject: Reply with quote  Mark this post and the followings unread

Did some error fixing and made a pretty printer first, that is HTML output. And I copied some parameter things from the original table.

I'll update the txt file I'll add the HTML file.

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24451
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Sat Mar 25, 2006 8:19 pm    Post subject: Reply with quote  Mark this post and the followings unread

The bithose class has been very helpfull, youu'll want to have defined someting like
Code:

type

  TBitCell   = type Cardinal;            // Cardinals used for bit cells - strong type checking
  TByteArray = array of Byte;            // Array of byte with a variable number of elements

const

  CellSize = 8 * SizeOf( TBitCell);      // Nr of bits in  each cell
  AllOnes  = TBitCell( -1);              // A TBitCell with all bits set to 1

type

  TBitIndex = 0 .. CellSize - 1;         // Range for bit indices
  TBitCount = 0 .. CellSize;             // Range for bit counts
  TBitValue = 0 .. 1;                    // Possible values for a single bit.

  TBitHose = class
  private
    FData     : array of TBitCell;
    FSize     : Integer;
    FWritePtr : Integer;
    FReadPtr  : Integer;
  private
    Procedure   SetSize( aValue: Integer);
    Function    GetBits( anIndex: Integer; aBitCount: TBitCount): TBitCell;
    Procedure   SetBits( anIndex: Integer; aBitCount: TBitCount; aValue: TBitCell);
  public
    Constructor Create;
    Destructor  Destroy;                                               Override;
    Procedure   AddBits( aBitCount: TBitCount; aValue: TBitCell);
    Procedure   ShiftInSeptets( Const aData: TByteArray);
    Procedure   ShiftInOctets ( Const aData: TByteArray);
    Procedure   AddSeptets( Const aData: TByteArray);
    Procedure   AddOctets ( Const aData: TByteArray);
    Procedure   Reset;
    Procedure   Clear;
    Function    GetOctets : TByteArray;
    Function    GetSeptets: TByteArray;
    function    ShiftOutBits( anAmount: TBitCount): TBitCell;          overload;
    procedure   ShiftOutBits( var aData: TByteArray; anAmount: Integer);   overload;
  public
    Property    Size: Integer Read FSize Write SetSize;
    Property    Bits[ aBitIndex: Integer; aBitCount: TBitCount]: TBitCell Read GetBits Write SetBits; default;
    Property    ReadPointer: Integer Read FReadPtr Write FReadPtr;
  end;



bithose.pas.txt
 Description:
a bithose

Download (listen)
 Filename:  bithose.pas.txt
 Filesize:  7.76 KB
 Downloaded:  165 Time(s)


_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24451
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Sun Mar 26, 2006 8:52 am    Post subject: Reply with quote  Mark this post and the followings unread

Found another change.

In the name dump section http://www.dewb.org/g2/pch2format.html speciefies :

Code:

1 byte  - 0x5a
2 bytes - length
2 bits  - area
8 bits  - Module Count


I however have to use

Code:

1 byte  - 0x5a
2 bytes - length
2 bits  - area
6 bits  - unknown
8 bits  - Module Count


or any other combination of count and unknown ...

example :
Code:

  ModuleNames
  [
    {0000}  #00000000 #00000001 #00000001 #01100001  #01110000 #01100101 #01101011 #01101111
    {0008}  #01101111 #01101100 #00000000
    typeId    = $5A
    ByteCount = 11
    Location  = FX
    NameCount = 1
    Names[
      ModuleIndex = 1
      Name        = 'apekool'
    ] // Names
  ] // ModuleNames

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Nord Modular Editors
Page 2 of 4 [78 Posts]
View unread posts
View new posts in the last week
Goto page: Previous 1, 2, 3, 4 Next
Mark the topic unread :: View previous topic :: View next topic
 Forum index » Clavia Nord Modular » Nord Modular G2 Discussion
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use