Custom Music Rolls Perforator File Format for .prf Files Richard Tonnesen May 23, 2003 This file format document is provided for general use in interpreting existing files or for creating new files. Introduction: The perforator file consists of two parts, a text header containing identifying and control information, and a data portion that contains the note-on/off commands for each perforator step. The file was designed to be as compact as possible and still be relatively simple to interpret and create. The initial implementation used paper tape as the storage medium. The files were converted to the present form to be used on Macintosh computers starting in 1984. Header Format: The header part uses the Macintosh text file standard of terminating each line with only a carriage return character (0x0d). The first line of the file identifies the type of roll. This value is used to select the chaining patterns and trailing edge truncation. * TR: XX XX is the upper case (or numeric) ASCII code for the roll type, one of the following: 88 88 note AA Ampico A AB Ampico B DA Duo-Art WE Welte Licensee WR Welte Red WG Welte Green RE Recordo AL All channels punched with same chain pattern as note holes IM Image file. Punch exactly as coded. Chain bridge pattern generation and trailing edge truncation are both suppressed The type-of-roll line in hexadecimal is 2a 20 54 52 3a 20 yy zz 0d yy and zz are the hex codes for the roll type letters (38 38 for '88 note', 41 42 for AB, etc.) The header file contains other free form data to describe the pertinent facts about the file such as roll number, date, artist, composer, title, tempo, and so on. These lines consist of an upper-case key word (or words) starting at the left margin, a colon, a space, and the text related to the keyword. The TEMPO: xxx line is especially important when the files are used for playback by piano emulation or for conversion to MIDI format. The order of the lines is not important except that the End-of-Header line must be last and must be present. Keywords in use: ROLL NR: Manufacturer's roll identifying number. May contain digits, letters, or possibly other characters. This number is punched into the end of the roll when the file is punched. A maximum of 10 characters may be present in the number. A 5 x 7 pixel array is used for each character on the roll. MFR: Manufacturer's name TITLE: Title of composition on roll. More than one title line may be present. COMPOSER: Composer(s) of the music PLAYED BY: Pianist (if known) ORIG DATE: Date provided on original roll, usually the Copyright date CURR DATE: Date file was created or last edited. This date is punched into the end of the roll when the file is punched. A maximum of 10 characters may be present. A 5 x 7 pixel array is used for each character. TEMPO: Tempo marked on roll. Used in emulation COMMENTS: Any text information associated with the roll. More than one comment line may be present. End-of-Header (/*) The last line of the header contains only the slash and asterisk characters (/*), so it may be identified by the four hex code sequence 0d 2f 2a 0d, which does not occur any place else in the header. THIS LINE MUST BE PRESENT AS THE LAST LINE OF THE HEADER. When new files are created, other text information may be placed in the header as long as the end-of-header line appears only once at the end of whatever text is present. Programs that process these files expect the next byte after the end-of-header line to be the start of the roll data. Data Format: The data portion of the file consists of 16 bit event codes describing the turn-on and turn-off of each note hole. The punch program generates new chain bridging as the roll is punched based on the roll type. The data file does not store information about chain bridging. (Except Image Format files). Each event consists of a one byte count of perf steps since the last event, a one bit on/off code (1=turn on), and a seven bit channel number. In binary this is: ssss ssss occc cccc ssss ssss Step count since the last event o On/Off bit, 1 = Turn ON, 0 = Turn OFF ccc cccc Binary channel number, 0 to 101 The punching channels are numbered 1 to 100. Channel 1 is the left most roll channel (Amplifier on Ampico B), and 100 is the right most channel (Sub intensity on Ampico B). Sustain is in channel 4 on most roll types. The first event of the data file should have a non-zero step count. Channel 0 is a non-punching channel code used to maintain the step count when the step count would otherwise overflow. If a long part of a roll has no other activity, a turn-off event for channel 0 is inserted after 255 steps: FF00. Unless special arrangements are made, The perforator operates at a fixed step size of approximately 540 steps per foot. Events coded with zero steps are applied to the same perforator step as the previous event with a non zero time. For example, the two event sequence 0581 0082 indicates that after a delay of five steps, channel 1 and channel 2 both turn on at the same time. If these notes were turned off after one step, the next events would be 0101 0002. The end of roll is indicated by a zero-step turn-off code for channel 101: 0065. Note that after the header, the first event may start on an odd or even boundary in the file, depending on the number of characters in the header. The data portion of the file always has an even number of bytes. Acknowlegment: The data portion of this file format is based on an article by Prentiss Knowlton that appeared in "Datamation" in the late 60's. Notes: 1. All roll files created by the Custom Music Rolls have a line containing "* SS 147". This indicates the steps per sample on the roll reader. The units are determined by the paper advance mechanism on the reader, approximately 6600 per inch. The reader is set to produce a copy nearly the same size as the original. In some cases a larger value is present. This indicates that the copy is being shortened. The "SS" line is not used by any programs. 2. A Welte red tracker bar was used to create T-100 files. These files have the type roll set to "WR". The reading process placed the supply roll at the top, and the paper was pulled down as reading progressed. This is reversed from the way the roll is used in Welte Red pianos. The roll channel numbers in these files must be corrected by subtracting the number in the file from 101. 3. The Mac versions of these files did not use the name.extension format introduced by DOS, but when these files have been moved into the DOS or UNIX environment, they have generally been given names based on the roll type and roll number such as DA1234.PRF for DUO-ART roll 1234.