PureStyle file format reference

Styles are the versatile automatic accompaniments found on digital keyboards from Yamaha and other manufacturers. There are thousands of Yamaha-format style files available for purchase or download on the Internet. Styles are employed to create custom accompaniments — a virtual backup band for performances. Styles may be installed on keyboards or used in computer programs like the Accompaniment Machine.

Conventional Yamaha-format styles were not intended as a standard for data exchange. In fact, they have many characteristics to maintain proprietary content:

  • Because the format evolved over several decades in a closed environment, a considerable amount of non-musical information has been appended.
  • There is no official documentation of the standard.
  • Many styles are modified to function only on specific keyboard models, leading to a multiplicity of redundant styles.
  • Some features are incompatible with computer MIDI output through soundfonts

A problem in designing software that utilizes styles is that users assume the program is at fault when a style fails to run or makes a strange or grating sound. To ensure that all styles distributed with the Accompaniment Machine perform correctly, we have created PureStyle a new standard for style files. PureStyle files have the following advantages:

  • The files contains nothing but standard MIDI messages. Consequently, they are compact and may be modified with most MIDI editors.
  • The format is open and well documented.
  • A PureStyle file generates good-quality sounds with any keyboard, synthesizer or computer soundfont.
  • The format is compatible for direct loading on all existing Yamaha digital keyboards.
  • The files are smaller, an important factor for loading on keyboards with byte limits.

This article documents the PureStyle format and describes utilities for modifying the files.

A knowledge of the organization of standard Yamaha-format style files is necessary to understand the advantages of PureStyle. Reference 1 gives a brief summary while Reference 2 provides a detailed description.

A PureStyle file is a standard MIDI[3] binary file of Type 0. It contains a header chunk and a single track chunk. The file name has the form

DescriptiveText_Tempo_TimeSig_ps.sty

The quantity DescriptiveText is a title for the style using only letter and number characters. Punctuation marks and spaces are not allowed. An underscore and the tempo (in quarter notes per minute) follows. This quantity is the default starting tempo for style sections. Tempo changes may occur during the musical sections, typically ritardandos in Endings. The time-signature appears after the next underscore in the form numerator-hyphen-denominator. Finally, the letters ps after the next underscore indicate that the style is in PureStyle format. The file extension is always sty. Here are some examples:

AfroCuban_200_4-4_ps.sty
AfterYouveGone_120_4-4_ps.sty
AfterYouveGone_180_4-4_ps.sty
AfterYouveGone_232_4-4_ps.sty
Again_87_4-4_ps.sty
MIDI Microscope display of a PureStyle file.

Figure 1. MIDI Microscope display of a PureStyle file.

Because PureStyle files follow a standard MIDI format, a good way to understand the structure is to view the file with MIDI Microscope. Figure 1 shows the display with a PureStyle file loaded. The binary values appear in the left-hand box. The right-hand box shows a text explanation of the content. We will concentrate on these entries — Ref. 3 shows how the information is represented in binary format. The file is divided into two chunks: the header chunk and a single track chunk. The header chunk contains the following information:

HEADER CHUNK
 Chunk length: 6
 Midi file type: 0
 Number of tracks in file: 1
 Pulses per quarter note: 1920

The chunk contains six data bytes. The values of the chunk length, MIDI file type and number of track chunks are the same for all style files. A MIDI file of Type 0 includes a single track that contains the musical information. The final quantity defines how pulses (the time units in a MIDI file) are related to a quarter note. In this case, one pulse equals 1/1920 of a quarter note.

The beginning of the track chunk contains information like the following:

TRACK 001 CHUNK
 Chunk length: 21646
 0     Non-MIDI event, time sig: 4/4 Notes/click: 24 Clock/quat: 4
 0     Non-MIDI event, tempo change: 422535 microseconds/quarter note
 0     Non-MIDI event, marker: SFF1
 0     Non-MIDI event, marker: SInt
 0     Program change, channel 09    Percussion
 0     Control change, channel 09    Bank select:   7F
 0     Control change, channel 09    LSB for Control 0 (Bank Select):   00
 0     Control change, channel 09    Channel Volume:   68
 ...
 0     Control change, channel 0C    LSB for Control 0 (Bank Select):   00
 0     Control change, channel 0C    Channel Volume:   58
 0     Control change, channel 0C    Pan:   24
 0     Control change, channel 0C    Effects 1 Depth:   00
 0     Non-MIDI event, marker: Main A
 0     Note on, channel 09    Note: 1A   Velocity: 3C
 0     Note on, channel 09    Note: Bass Drum 1   Velocity: 50
 0     Note on, channel 0A    Note: Bass Drum 1   Velocity: 32
 0     Note on, channel 0C    Note: F4   Velocity: 40
 0     Note on, channel 0C    Note: A4   Velocity: 41
 8     Note on, channel 0C    Note: G4   Velocity: 42
 ...

The track chunk header and the chunk length are followed by a series of standard MIDI messages. The quantity in the first row of each message defines the timing. It equals the number of pulses to wait before sending the message. The series of zeros indicates that the initial entries are setup messages that should be sent to the synthesizer immediately on startup.

The first three messages appear in all PureStyle files:

  • Byte values that specify the time signature.
  • The baseline tempo in microseconds per quarter note. The program or synthesizer uses this information to relate pulse values to absolute intervals of time. In the current case, each pulse equals 220 microseconds. The base tempo may be modified in some of the style sections (e.g., to implement a ritardando in an Ending).
  • The marker message SFF1. The dummy information is included for keyboard compatibility. The designation of SFF1 or SFF2 format has no function in PureStyle.

Remaining MIDI marker messages designate the starting point of style sections. In PureStyle, the baseline channel voices (synthesizer patches) are gathered in the SInt section. Each channel used in the style has a program change message and optionally a set of control change messages to set up the MIDI output device. The control change messages may include XG voice settings, although for style distribution it is recommended that the contain only GM (General MIDI) definitions. PureStyle files use the following channel conventions:

08h: Subrythm — this channel is often used for supplemental percussion instruments, although it could be defined for a pitch instrument. For percussion sounds, the style file must include program information to set the channel as a drum set. In this case, note values are interpreted as percussion sounds rather than pitches.

09h: Rhythm — the MIDI convention is that this channel  is used only for percussion and is always associated with a drum set.

0Ah: Bass notes — instruments like a string bass or tuba.

0Bh: Chord 1 — polyphonic instruments to create harmony, like a guitar or piano.

0Ch: Chord 2 — a second polyphonic instrument.

0Dh: Pad — usually a floating voice like strings or a choir.

0Eh: Phrase 1 — a melody instrument, usually appearing in introductions and endings.

0Fh: Phrase 2 — a second melody instrument.

The SInt section is followed by a set of style sections that contain the musical information. The start of each section is designated by a marker message. The following standard marker values may appear: MainA, MainB, MainC, MainD, IntroA, IntroB, IntroC, EndingA, EndingB, EndingC, FillAA, FillAB, FillBA, FillBB, FillCC and FillDD. Many styles do not include all sections. The only required section is MainA. The musical sections are in standard MIDI format with no channel redirection, key changes or other features supported by the CASM section of standard style files. A PureStyle file makes the correct sounds when played on any MIDI player. The musical sections follow the ideal style convention defined in Ref. 2 — the pitch instruments play in the key of C and the polyphonic instruments should suggest a CMaj7 chord. Tempo changes and voice changes may occur within a section.

The above information constitutes a complete definition of PureStyle. In contrast, the definition of the standard Yamaha-format style file with all its variants and idiosyncrasies occupies 55 pages in Ref. 2. We feel that PureStyle files create a comparable sound, particularly when the Style Customizer utility is used to tune the voices for a specific output device. Use this link if you want to inspect the complete MIDI Microscope listing for the PureStyle example, AFoggyDay_142_4-4_ps.sty.

We have developed two utilities that enhance the utility and versatility of the PureStyle format:

ShapeShifter
Performs automatic bulk conversion of an entire directory of standard Yamaha-format styles in either SFF1 or SFF2 format to PureStyle. During the conversion, ShapeShifter eliminates corrupted style files and removes duplicate styles that may differ only in tempo or voice assignment. This program is discussed in detail in the following article.

Style Customizer
An interactive program to set the channel voices, baseline tempo, time signature and other characteristics of PureStyle files. Style Customizer converts individual Yamaha-format styles in any format to PureStyle with options to correct any content that may be incompatible with GM devices. Because PureStyle files are in standard MIDI format, in principle they may be created or modified with any MIDI editor or digital workstation. In practice, available editors scramble the position of the marker messages needed to organize the musical content into sections. Style Customizer reads a PureStyle file, creates a subdirectory and then writes individual MIDI files for each section: SInt, MainA, MainB,….  Each file may then be modified and saved with conventional MIDI editors. Given a subdirectory, the program seeks files with standard section names and reassembles them into a single PureStyle file.

Footnotes

[1] What’s In a Yamaha Style File.

[2] Peter Wierzba and Michael P. Bedesem, Style Files – Introduction and Detail.

[3] A good reference for creating binary MIDI files, About MIDI Files.

[4] Find out more about KBD-Infinity: Home page.

[5] If you have comments or questions, please contact us at info@kbd-infinity.com.

Comments are closed.