Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #454
| Newsgroups | comp.sys.apple2.programmer |
|---|---|
| Date | 2012-09-04 19:19 -0700 |
| Message-ID | <e7224bc4-cb23-490e-9411-fd1f4df103e2@googlegroups.com> (permalink) |
| Subject | Music format for Mockingboard |
| From | BLuRry <brendan.robert@gmail.com> |
This is my draft music format for a 6-channel (+2 noise channel) mockingboard music format. I took the liberty to do a few things to make this music file format very flexible and yet maintain space constraints. The really funny part is that I started this tracker before I started Jace (remember I mentioned that I started Jace by writing but never finishing a Mockingboard emulator?) This tracker has been sitting unfinished in the Jace source tree and it is called: Woz Tracker (I know, really original eh? ;-) Some background: I've written Amiga-style mods since '92. Granted, I don't use that 4-channel format anymore, but I still use trackers. Naturally, when preparing to make a music playback routine I decided to stick with the familiar. A song consists of a set of patterns and the patterns are arranged in a song order, such that patterns can be played back in any order and any number of times. When the song order has reached its end, the song is over. As for a pattern, it is a linked-list of commands. The register values (commands 1, 2 and 3) are the AY registers. The rest of this corresponds to tracker effects. A separate volume column and a separate effects column look nice in a user interface but it is a waste of memory and I'm trying to go for something as small as possible. Likewise, I never liked only having one effects column. Some effects can be chained, meaning the player keeps processing pattern data as if it were on the same row. Other effects are not chained, so they mark the end of the row. Also, the high-bit of the command data represents the duration for that set of commands. Patterns will usually have a lot of empty space -- rows with no data -- so this lets the player know there is nothing to do for a few rows. That way there is no need to waste memory over it. To save even more space and also to make it easier to do repetitive things (e.g. beats, arpeggios, basslines) there is a macro command which essentially lets you layer a macro at a given spot. A macro is like a mini-pattern, except that if a pattern specifies other commands, they override the data from the macro. Only one macro can be used at a time though. This not only makes for an easier composing experience, but it also essentially lets the composer divide the song into huffman codes and can lead to very compressed song files. ;-) This data format only represents the replayer format -- it is entirely possible that a user interface only provides a limited set of functionality (e.g. a limited set of effects columns) or maybe a cleaner set of controls "per channel" are provided, and then renders down the user-entered data into this format. ;----------- Song data ; Bytes 0-3 = format id "woz0" ; Bytes 4-5 = file size (little endian) ; Bytes 6-37 = Song name (space-padded) ; Bytes 38-69 = Author name (space-padded) ; Bytes 70 = Song length (order list size) ; Bytes 71 = Pattern count ; Bytes 72-73 = Offset of macro start ; Bytes 74-137 = Song order ; Bytes 138-139 = Offset of pattern 0 ; Bytes 140-141 = Offset of pattern 1 ... ; Bytes 138 + (numPatterns * 2) ; Start of pattern 0 data ; ... ; Start of pattern 1 data ; ... ; Macro start = ; Count of macros (1 byte) ; Ofset of macro 0 (2 bytes) ; . ; Offset of macro n (2 bytes) ; Macro 0 data (same as pattern data) ;----------- Pattern data ; If a pattern command starts with #00, that is treated as the end of the pattern and playback immediately jumps to the next order in the sequence ; The low nybble represents a command ; 0 = Rest - Not chained, Also used to end chains and set period duration ; 1 = Commands for AY1 only - No chain ; followed by reg bitmask and then register values ; So for example if setting register 1 and 2: ; %00000011, Reg1 value, Reg2 value ; 2 = Commands for AY2 only - No chain ; followed by reg bitmask and then register values ; 3 = Commands for AY1 and AY2 - Chained ; followed by reg bitmask and then register values for AY1 and then bitmask/values for AY2 ; 4 = Pitch slide - Chained ; byte 1: ; low nybble represents AY1 (bit 0 = A, bit 1 = B, bit 2 = C, bit 3 = noise period) ; high nybble represents AY2 (bit 4 = A, bit 5 = B, bit 6 = C, bit 7 = noise period) ; byte 2: pitch slide amount (7-bit 2's compliment) ; if positive, pitch will go up. If negative, pitch goes down ; 5 = Vibrato - Chained ; Same as pitch slide except the second byte is the tremolo amount ; It works the same as pitch slide going up and down rapidly. ; 6 = Volume slide - Chained ; Same data as pitch slide except it affects volume (note, AY only uses volume ranges 0-15 so use low slide numbers!) ; 7 = Tremolo - Chained ; Same data as volume slide except it goes up and down rapidly ; 8 = Set global detune - Chained ; Same data as pitch slide except it is a global adjustment to each channel and is held until reset ; A = All notes off - Not chained ; This takes a channel voice bitmask as a single parameter ; This cuts all voices off but leaves global detune and other parameters active ; This takes no paramters ; B = Channel reset - Not chained ; This takes a channel voice bitmaks as a single parameter ; This cuts all voices off and resets all parameters ; C = Playback control - Not chained ; 0 : Jump to next pattern ; 1 : Jump to order (followed by order #) ; D = Set ticks per beat - Chained ; Only one byte, the number of ticks per beat ; E = Set 6522 timer period - Not chained ; followed by two bytes (low/hi for period) ; F = Macro (followed by 1 byte: macro number) - chained ; Note: Only one macro can be used at a time, and pattern data overrides them
Back to comp.sys.apple2.programmer | Previous | Next — Next in thread | Find similar
Music format for Mockingboard BLuRry <brendan.robert@gmail.com> - 2012-09-04 19:19 -0700
Re: Music format for Mockingboard aiiadict@gmail.com - 2012-09-05 07:47 -0700
Re: Music format for Mockingboard BLuRry <brendan.robert@gmail.com> - 2012-09-05 08:07 -0700
Re: Music format for Mockingboard aiiadict@gmail.com - 2012-09-05 12:55 -0700
Re: Music format for Mockingboard Michael J. Mahon <mjmahon@aol.com> - 2012-09-06 00:19 -0500
csiph-web