Tap-Tap-Tap

Most Yamaha-format accompaniment styles for keyboards include multiple introductory sections (IntroA, IntroB, IntroC). The loose convention is that IntroA is relatively simple and starts with a measure of downbeats. This presents a problem if you want to use the introduction in a performance. Furthermore, the downbeat is unnecessary in the Accompaniment Machine — the program includes a visual beat indicator. Here’s a quick way to silence the taps when you’re in the AutoSequence mode of the Accompaniment Machine:

 -4 0 IntroA
 -4 0 StyleVolume 0.00
 -4 0 G
 -3 0 StyleVolume 1.00
  1 0 MainA

The command sequence drops the volume to zero through one measure of the five measure introduction. In performance, you need to remember that there will be a measure of silence after you start the accompaniment.

A cleaner solution is to modify the style to eliminate the measure. I’ll go through the steps in this article. We’ll see how to use the Export and Import functions of Style Master and how to set up automatic program launching in MIDI File Organizer. Then, we’ll review some techniques for the useful Speedy MIDI utility.

 

Step 1. Use MIDI File Organizer (or another file management program) to set up a work environment. Figure 1 shows an example. The working directory, C:\TEMP, contains a subdirectory to hold individual sections of the style.

Set up a directory to hold the individual style sections.

Figure 1. Set up a directory to hold the individual style sections.

 

Step 2. Run Style Master and load the style (Figure 2). If you preview IntroA, here’s what it sounds like:

It’s a nice introduction to the song if we can eliminate the downbeat. Click the Export button, navigate to the directory C:\TEMP\SmallHotel and click OK. Style Master breaks the style into the individual MIDI sections (right-hand window of Fig. 1).

Style Master with the sample style loaded

Figure 2. Style Master with the sample style loaded.

Step 3. Speedy MIDI is an essential freeware program to install if you do any work with MIDI files. You can download the program at https://sourceforge.net/projects/speedymidi/. Over the years, I have tried at least ten different MIDI editors and digital workstations. There is no perfect solution. Here are the pros and cons of Speedy MIDI:

Pros

  1. It has by far the best display of the structure of MIDI files of any available program.
  2. It does the things it does simply and logically. These things include changing the MIDI file structure (e.g., remove tracks, remove measures,…), set the MIDI channel voices, listen to file, make global changes like transpositions,…

Cons

  1. Speedy MIDI was not designed for composing or musical editing. You can’t modify individual notes. MuseScore (https://musescore.org/en) is a good option for creating or modifying the musical content of MIDI files.
  2. There are no instructions, neither a manual nor even a help file.

In light of the later, I will go over the Speedy MIDI operations for this simple example in detail.

 

Step 4. Speedy MIDI has another drawback — when you want to open a new file, the load dialog always starts in a default directory rather than the last place you were working. This problem is easily rectified with MIDI File Organizer. In the Settings window, you can define a tool to launch a highlighted file automatically in Speedy MIDI. Figure 3 shows the setup for Speedy MIDI and MuseScore. Now, you can highlight a file in either navigation window of MIDI File Organizer and then right-click and choose the Speedy MIDI tool. The file is immediately available in the program. Use this method to open IntroA.mid in C:\TEMP\SMALLHOTEL.

Settings window of MIDI File Organizer

Figure 3. Settings window of MIDI File Organizer showing a tool to launch a file in Speedy MIDI.

 

Step 5. In Speedy MIDI, press Control-F to display all tracks (Fig. 4). In this case, each track corresponds to a MIDI channel. There are no additional tracks (e.g., lyrics) because Style Master exports Type 0 files with only musical information. Click the green arrow in the toolbar at the top if you want to listen to the section content. An inspection of Fig. 4 shows that the downbeat occurs in the style percussion channel (09h). There is no musical information in the other channels, so we can simply eliminate the first measure. Click in the measure box above the first track to highlight the measure in all tracks (Figure 5). Then press Control-Delete to remove it. Save the file.

Speedy MIDI display with IntroA of the style loaded

Figure 4. Speedy MIDI display with IntroA of the style loaded.

Speedy MIDI with the first measure highlighted

Figure 5. Speedy MIDI with the first measure highlighted.

 

Step 6. If we inspect the modified IntroA.mid with MIDI Microscope, we find that Speedy MIDI has saved the information to a Type 1 MIDI file with individual tracks for each MIDI channel. This brings up a general issue of MIDI editors. Because musical data allows many interpretations, editors always seem to do something that you don’t want. In this case, there is no problem because Style Master automatically converts the information to the required Type 0 format on import. Click the Import button in Style Master, choose the directory C:\TEMP\SMALLHOTEL\ and click OK. The section files are reloaded, reformatted if necessary and organized. Now when you preview IntroA, the downbeat is gone. The final step is to save the modified style.

I’ll discuss other Speedy MIDI operations in future articles. In the meantime, the program logic is straightforward and you can discover most capabilities by experimenting with test files.

Footnotes

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

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

Creating and editing keyboard styles

Styles are the automatic accompaniments on digital keyboards from Yamaha, Roland, Korg and other manufacturers. They can create the sound of a backup group, turning a simple melody into a performance piece. Style files in Yamaha format are the most common. Thousands of styles in every genre are available for download on the Internet.

The content of standard Yamaha-format style files is poorly documented, cumbersome and arcane. One consequence is that the same styles may appear in individual versions for specific keyboards, leading to considerable redundancy. Another problem is that styles for high-end keyboards like Tyros may be sandbagged with hidden information giving a poor sound on ordinary keyboards.

We have taken two steps to make style files an open, standardized medium of information exchange. The first is the creation of the PureStyle format described in this reference. With the elimination of unnecessary information, PureStyle files contain only MIDI messages that follow simple organization rules. The styles are compatible with all Yamaha keyboards and performance software like the Accompaniment Machine. Extensive libraries of PureStyle files are available on our site.

The second step is the addition of new features to our Style Master program. With the software, you can now edit or create Yamaha-format styles using any MIDI editor or digital workstation. The problem we addressed is that most MIDI editors cannot directly edit styles. They make changes to the structure of the file and do not preserve the correct order of marker messages used to identify style sections. For example, many editors divide MIDI channels (instruments) into individual tracks when loading and save files in Type 1 format. Style Master uses the following solution:

  • On export, the program saves each section (e.g., MainA, EndingB,…) of the currently-loaded style as an individual standard MIDI file in a working directory.
  • On import, Style Customizer searches the working directory for section files, converts them to Type 0 format and then loads them in correct order, adding marker messages as needed. The resulting data may then be saved in PureStyle format using any of the filters available in Style Master .

The conversion of a style into an organized set of MIDI files has additional applications. For example, style sections may be imported into sequencers. Section 6 of the Style Master instruction manual gives a complete description of the capability.

Footnotes

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

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

Menu bars in Xojo applications

Menu bars appear near the top of most applications. They consist of menus (e.g., File, Edit, Help,…), each containing several action options (e.g., Load, Save, Quit,...) that appear when you click the menu. Oddly, I found it difficult to locate guidelines for implementing this basic feature in either the Xojo documentation, examples supplied with the package or Internet forums. I found many discussions of advanced features but nothing on how to make a simple setup. I solved it eventually, but there were several features that were non-intuitive. For my own information and to save others needless effort, I’ll document the operations in this article.

I’ll limit this discussion to building menu bars and assigning properties in the App design phase (that is, static menus). I won’t cover dynamic menus (i.e., those that depend on the current state of the user’s computer) and contextual menus (i.e., right-click). These are covered fairly well in the Xojo Language Reference entries for MenuBar and MenuItem.

Step 1. In your project, add a menu bar. Click Insert and choose Menu Bar. You can add and customize multiple bars. Each bar can be used in one or more windows. For a simple app with one window, the single bar is typically called MainMenuBar.

Step 2. If you have multiple windows with multiple menu bars, you can set which window uses which bar (or whether a window has no menu bar). Highlight the window and view the properties with Inspector (Figure 1). The option to choose a menu bar appears at the bottom.

Connect a menu bar with a window

Figure 1. Connect a menu bar with a window.

Step 3. Important definitions. A Menu contains one or more MenuItems. Actions are associated with MenuItems. One or more Menus appear across the menu bar. Clicking on a Menu displays its set of Menu Items in a dropdown. A Menu Item may be converted to a Menu to display a SubMenu of MenuItems (generally, off to the side).

Step 4. When you highlight a menu bar, the central section if the IDE changes to a menu bar editor, as shown in Figure 2. Menu bars are created with two default menus: File and Edit with a set of default selections. To remove them, highlight them and press the Delete key. Note that you need to click twice to highlight a menu — the first click highlights the Menu Name.

Menu bar editor

Figure 2. Menu bar editor.

Step 5. Build the menu using the tools above the display area. The tools (left to right) have the following functions.

a) Create a new Menu in the MenuBar.
b) Create a new MenuItem in the highlighted Menu.
c) Add a separator line to the Menu.
d) Create a new SubMenu in the Menu.
e) Convert an existing MenuItem to a Menu to support a new SubMenu.

Within a Menu, you can change the order of MenuItems by dragging them.

Step 6. Highlight a Menu Item to display its properties in Inspector.

a) The Name is important because it will be used to connect with the associated menu action.
b) You can liven the appearance by displaying on icon on the command line.
c) You can add a keyboard shortcut. For example, to invoke the menu command with Control-G, activate MenuModifier and enter the letter G.
d) There is also a button the convert the MenuItem to a Menu (the same function as Tool e).

Step 7. If you run the program at this point, all the menu entries are inactive. They will become active only when they are connected with actions. The actions may apply in all windows that use the Menu Bar, or you may set things up so that different actions occur in different windows. To set up global actions, highlight the App, click Insert and choose Menu Handler. An entry called Menu Handlers will be added as a category of App contents (joining such categories as Constants, Event Handlers,…). To set window specific actions, highlight the target window and add a Menu Handler. Here is the non-evident part. To add a Menu Item, highlight Menu Handlers and again insert a Menu Handler. The IDE actually creates a MenuItem. Highlight it. In the Inspector on the right hand side, supply the Menu Item Name to correspond to the name of one of the Menu Items in the Menu Bar. You can then type in the action in the central edit area. When you click the MenuItem in the Menu Bar, the action is executed.

Here’s a link to a simple sample project: Xojo Menu Test Project.

Footnotes

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

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

New features in MIDI Doctor

MIDI Doctor (Fig. 1) is a versatile tool to fix or to customize MIDI files. With it, you can adjust the volume and instrumentation of MIDI channels, transpose the key, modify the tempo, remove channels and perform several other operations. Recently, we’ve added powerful new capabilities. One improvement is a display of the exact temporal position in the file during playback (lower arrow in Fig. 1). This is a useful feature when excerpting sections (discussed below). We’ve also added the feature to MIDI Microscope, MiniMIDI player and MIDI File Organizer.

MIDI Doctor, main window

Figure 1. MIDI Doctor, main window.

A new Global settings button brings up the dialog shown in Fig. 2. There are three operations: 1) adjust the dynamic range, 2) adjust the play duration and 3) make an excerpt. The operations are global in the sense that they change the entire file.

MIDI Doctor, global settings dialog

Figure 2. MIDI Doctor, global settings dialog.

Dynamic range

There are many differences between western art music (i.e., classical) and popular music. One of them is that classical music gets soft and loud while popular music proceeds at a fairly uniform volume level. I was sharply reminded of this when I hoped to relax in the evening by listening to a MIDI file of Rachmaninoff’s Rhapsody on a Theme by Paganini. It was a great file except that the arranger had gone overboard with the dynamics. It ranged from inaudible to painful, and I was constantly clicking the volume control on my headphones.

In response, I added a method to compress or to expand the dynamic range of MIDI files. When the Global settings dialog opens, MIDI Doctor computes the minimum, maximum and average velocity values of all NoteOn messages with non-zero velocity. You can set new values in the boxes. The choices allow you to change the average volume or to compress/expand the low and high volume ranges individually. Click the Apply button to change all velocity values in the file. Be sure to save the modified file with a different name. There are many possible applications of this tool, including converting classical music to easy listening. Here are examples of effect that you can download: Original file with high dynamic range. Modified file with compressed dynamic range.

Play duration

One of the advantages of working with MIDI is that you can change the tempo of a piece without affecting the pitch. With this tool, you can set an exact duration for the file playback. One application — suppose you’re creating a video and need background music that ends exactly at the last fade. When the dialog opens, MIDI Doctor shows the current file duration in minutes and seconds. Simply fill in the desired values, click the Apply button and save the modified file.

Make excerpt

Use this tool is you want to make a demo or to pull out a favorite section. The end result is a modified file that only plays the specified interval. When the dialog opens, the Start and End values are set to the beginning and end of the file. Narrow the range to make an excerpt by changing the times. You can use the time display in the main window to determine values.

You may notice that when you save the excerpted file, it has the same length as the original file. This is because it’s tricky to cut out a piece of a MIDI file. The state of the synthesizer at any time depends on the sequence of all preceding MIDI messages. If you simply cut out a set of messages, you may wind up with a hanging note that plays to infinity. The solution I used in MIDI Doctor was to include all messages in the file, but to adjust those before the excerpt so they play at t = 0 with the velocity of NoteOn messages set to zero. The message time within the excerpt is adjusted to (t – TStart). Messages after the excerpt are all sent at (TEnd – TStart) and NoteOn message have zero velocity.

Footnotes

[1] MIDI Doctor users — to update, download and run the installer at download_software.html. The program will be replaced with affecting your license activation.

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

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

Running AMac on a Windows tablet

In the past, there were limited choices of tablet computers running Microsoft Windows, generally in the price range $700 and up. Now, you can get models for less than $100. A user recently asked whether the Accompaniment Machine will run on a small Windows tablet, so I decided to check it out.

As of April, 2018, there are two low-price choices on Amazon: the Nuvison 8″ at about $70 and the RCA Cambio 10″ at about $100. Besides the larger screen, the RCA device includes a detachable keyboard, a built-in stand and a real USB port to supplement the standard micro port. This was a major decision point for me because of the need to attach a keyboard. True, you can buy an OTG USB hub for the smaller tablet, but it’s not possible to charge the tablet and use the USB functions at the same time.

I purchased the RCA tablet and also a utility kit that included a USB hub, wireless mouse and HDMI cable. Figure 1 shows the RCA tablet (with keyboard detached) running AMac in Windows 10. The hub attached on the left accommodates the mouse adapter, the keyboard connection and a USB stick with MIDI files. Installation of the Yamaha keyboard driver was no more difficult than on any Windows computer.

Accompaniment Machine on a tablet computer

Figure 1. The Accompaniment Machine running on an RCA Cambio tablet driving a Yamaha keyboard.

The Accompaniment Machine is ideally suited to this type of computing environment. It was designed to make efficient use of CPU resources as well as screen area. We have run the program successfully on an old Windows NT HP Netbook, so there are no problems on this relatively powerful machine. The program display fits nicely on the tablet (1280 x 800 resolution). From the beginning, AMac featured control by screen buttons rather than menus. This means that you can invoke all performance functions by single touches without the need to navigate menus or raise the popup keyboard. Alternatively, the program can be controlled with the wireless mouse. The tablet runs all of our software, including Pancho.

The RCA tablet provides extraordinary functionality for the price. It’s a nice choice for a portable performance vehicle, and it wouldn’t be a financial tragedy if it got rained on or lost. In addition to music applications, I plan to use it as a business computer for travel. It can run all my standard applications (e.g., OpenOffice). With the addition of a $20 micro SD card, you can raise the built-in storage to 96 GB.

Footnotes

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

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

Installing KBD-Infinity programs using Windows or macOS

Program installation is quite simple. In Windows, use the Download link to retrieve the executable installer. Typically, you would save the file in your Download folder or on the Desktop. In Windows Explorer or other file manager, double-click on the installer icon. The operating system may ask for permission to proceed. Windows 10 may issue the message:

Windows protected your PC
Windows Defender SmartScreen prevented an unrecognized app from
starting. Running this app might put your PC at risk.
More info

Despite the tone, it simply means that the program is not registered on the Microsoft Store. Click on More info to proceed. The program, instruction manual and examples are automatically copied to the correct locations. The installer also makes a shortcut on the Desktop. Double-click on the shortcut to run the program. Press F1 to open the instruction manual.

For the macOS, when you click the Download button a file ProgName.dmg is copied to your Download folder. Open Finder and navigate to the Applications folder. Then, open the Download folder and double click on ProgName.dmg. The compressed disk image is opened and a new Finder window shows the contents, a single folder with the name ProgName. To complete the installation, drag the program folder to the Applications folder. The program folder contains the app, the instruction manual and possibly other documents. After you run the program, the folder will also contain the configuration file which records program features and settings (e.g., the position of the program window).

An icon for the program may or may not appear in Launchpad. When you start the program, the Mac may issue a message like:

“MIDIDoctor” can’t be opened because it is from an unidentified developer. Your security preferences allow installation of only apps from the App Store and identified developers.

To continue, you will need to click System preferences/Security and privacy  Click OK in the previous warning dialog. The option to approve the program appears in the security dialog. Thereafter, the program runs like any other Mac software. To deinstall the package, simply drag the folder ProgName to the trash bin.

Two general usage tips for Mac users:

1) Finder does not include a button to go up one folder in the tree, which makes navigation problematic. For this function, use Command-UpArrow.

2) For compatibility with Windows, our programs make extensive use of mouse right-clicks. New Macs are supplied with a stylish monolith that appears to be a one-button mouse. Actually, it is a disguised two-button mouse with scroll wheel. To realize the full capabilities, go to System preference/Mouse. Uncheck Scroll direction: Natural, which is totally unnatural for Windows users. Check Secondary click/Click on right side to activate two-button performance. If this doesn’t work, note that you can plug any standard two-button mouse into the Mac to get full capabilities.

Footnotes

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

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

New features in MiniMIDI Player

MiniMIDI Player (Figure 1), a component of the MIDI Utility Pack, is a compact program to play MIDI files. It provides a quick method to preview files and to determine their properties. We recently added some features to enhance its utility.

Screenshot of MiniMIDI Player

Figure 1. Screenshot of MiniMIDI Player

MiniMIDI Player can be used as a standard interactive program in a window. It can also be launched from the command line with the target file as the pass parameter. If MiniMIDI Player is defined as the Windows default program for the extension MID, it will launch when you double-click a MIDI file in Windows Explorer or other file manager. It also responds if you click on a link to MIDI file on the Internet in a browser. By default, in command-line mode the program closes after playing the file. If you want to repeat the play or load another file, click either the Play/Stop or Pause/Resume button. In this case, MiniMIDI Player exits command-line mode and stays active until you click the Exit button.

In addition to the MIDI file type and number of tracks, the program now displays the exact play duration in minutes and seconds including effects of tempo changes. Finally, we reduced the program footprint so it occupies minimal space on your desktop.

Footnotes

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

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

 

Building a style library

Styles are MIDI loops included on digital keyboards from Yamaha and other manufacturers from which you can build automatic accompaniments. The feature, which makes a good approximation to a backup band, can turn a simple tune into an interesting performance piece. Yamaha-format styles form the core of our program, the Accompaniment Machine. A typical keyboard has 100-200 built-in styles. With the Accompaniment Machine, you have access to thousands of unique styles available as files on the Internet[1]. The program enables application of the vast archive of Yamaha-format styles to any keyboard brand or model.

A continuing project at KBD-Infinity is to build a comprehensive, standardized style library for the Accompaniment Machine. Choosing the best style for a piece can be a challenge because of the sheer volume of material available. The task is made more difficult by the disorganization of available resources. An archive like the PSR Tutorial contains a huge number of style files, but there is a great deal of redundancy for the following reasons:

  • Many style sets have been appropriated from Yamaha keyboards over the years. Thus, there are hundreds of available sets for specific keyboards, all with similar content. Often, the only differences are variations in orchestration (e.g., device-specific XG voices and drumsets).
  • Although there are many original style sets by independent artists, some developers make only minor changes in orchestration, tempo or format and release the styles with new names.
  • Over the decades, Yamaha has added several arcane features to style files and has introduced a break in the format, SFF1 to SFF2 [2]. There is no official documentation of either format.

The result is considerable frustration for users who search large style sets only to continually encounter the same musical content in different wrappers.

We had two goals in building our style libraries:

  • Create a standardized file format that performs well, either on any digital keyboard via the Accompaniment Machine or directly when loaded on a Yamaha keyboard.
  • Significantly reduce corrupt files and redundancy.

To meet the first criterion, we created the PureStyle format described in the previous article. PureStyle files have the following characteristics:

  • A standardized file name that documents the base tempo and time signature.
  • Elimination of unnecessary and confusing information. The file contains only MIDI data to that conforms to the ideal style standard.
ShapeShifter screen shot

Figure 1. ShapeShifter screen shot.

This article discusses ShapeShifter (Fig. 1), a utility we developed for automatic generation of standard libraries with minimal redundancy. Our initial step in building a library is to gather styles from a variety of sources [1] and to sort them into groups (e.g., Latin styles). The result is a directory that may contain hundreds of style files in a variety of formats. Eliminating musically-similar styles by ear from such a large set would be difficult and time consuming. ShapeShifter corrects and analyzes all files in a directory automatically. The user simply navigates to the working directory and clicks the Convert to PureStyle button. In response, the program performs the following operations:

1) Loop through the files and pick out the ones that are not in PureStyle format. For each member of the set, determine if it is in SFF1 or SFF2 format and then read the contents. Delete the file if it is corrupted. Decode any channel redirection or key changes defined in the CASM section and use the information to correct musical entries in the MIDI section to meet the following requirements:

Rule 1. Only upper MIDI channels are used for the style, leaving the lower channels free for melody voices. The channels serve specific functions, with Channel 09h reserved for percussion.

Rule 2. The pitch instruments should play in the key of C and suggest a CMaj7 chord.

Create a standardized name for the style and write a new file in PureStyle format.

2) Optionally, delete the original style file.

3) Loop through the set of PureStyle files in the directory and record the following information in arrays for each file: the name, the byte length, the tempo, and the time-signature numerator and denominator. ShapeShifter also records a quantity called NoteSum, equal to the sum of note values for all NoteOn messages in the MIDI section.

4) Remove duplicate style files. To do this, we need a criterion for duplication. We recognize that two files with different names, byte lengths, tempos or instrument settings may have identical MIDI roots. There is no reason to include both of them, because it is easy to change tempos or to modify instrument assignments within the Accompaniment Machine or Style Customizer. The key to recognizing duplicates is the NoteSum value, equal if the style files share a common MIDI root. ShapeShifter defines a Boolean array NErase with entries initialized to False. The program loops through each member of the style set that has not been previous marked NErase(n) = True. For each style, the program searches the remainder of the array, marking any styles that share the same time signature and NoteSum value as NErase(m) = True. When complete, the program makes another loop, deleting any style files marked for erasure.

Optionally, ShapeShifter keeps a log of all operations. Here’s typical output for processing a raw group of files purchased from the PSR Tutorial site:

Convert non-pure-style files
 Invalid file format: 16B Pop.sty
 Invalid file format: 8 Beat Roc.sty
 8Bt Standa.sty ==> 8BtStanda_107_4-4_ps.sty
 Ballad3.sty ==> Ballad3_104_2-4_ps.sty
 Basic Rock.sty ==> BasicRock_116_4-4_ps.sty
 Blues R&Ro.sty ==> BluesR&Ro_123_4-4_ps.sty
 C Beat1.sty ==> CBeat1_120_4-4_ps.sty
 ...
 Invalid file format: Singer Son.sty
 Thunderer.sty ==> Thunderer_125_4-4_ps.sty
 WmTellOver.STY ==> WmTellOver_120_4-4_ps.sty
 Number of successful conversions: 24
Delete remaining non-pure-style files
 Delete file: 16B Pop.sty
 Delete file: 8 Beat Roc.sty
 ...
 Delete file: WmTellOver.STY
 Number of files deleted: 30
Analysis of pure style file properties
 n  STempo  STsUp  STsDn   SFileSize  SNoteSum    SFileName
 ====================================================================
 0      107     4     4    14499        80037    8BtStanda_107_4-4_ps.sty
 1      104     2     4    11720        62755    Ballad3_104_2-4_ps.sty
 ...
 22      125     4     4    25841       187149    Thunderer_125_4-4_ps.sty
 23      120     4     4    27775       193746    WmTellOver_120_4-4_ps.sty

In this case all files in the directory are unique, so no files are eliminated. For comparison, these are log entries when there are a number of overlapping style files:

Overlap
 n:    1 Tempo: 120  TsUp: 4  TsDn: 4  NoteSum:  67628  FileSize:  5408 Acoustica_120_4-4_ps.sty
 m:   30 Tempo: 120  TsUp: 4  TsDn: 4  NoteSum:  67628  FileSize:  5408 ChristmasBalladLaidBack_120_4-4_ps.sty
 Overlap
 n:    3 Tempo:  94  TsUp: 4  TsDn: 4  NoteSum: 102811  FileSize:  7553 AlleJahreWieder_94_4-4_ps.sty
 m:  121 Tempo:  94  TsUp: 4  TsDn: 4  NoteSum: 102811  FileSize:  7553 ChristmasQuietBallad_94_4-4_ps.sty
 Overlap
 n:    4 Tempo: 120  TsUp: 4  TsDn: 4  NoteSum: 109838  FileSize: 16226 AllIWant4Xmas_120_4-4_ps.sty
 m:  156 Tempo: 120  TsUp: 4  TsDn: 4  NoteSum: 109838  FileSize: 16226 ChristmasTwoFrontTeeth_120_4-4_ps.sty
 Overlap
 n:    5 Tempo:  58  TsUp: 3  TsDn: 4  NoteSum:  74444  FileSize: 11166 AmazingGospel_58_3-4_ps.sty
 m:   73 Tempo:  58  TsUp: 3  TsDn: 4  NoteSum:  74444  FileSize: 11166C hristmasGospel_58_3-4_ps.sty
 ...

In the end, the directory contains a set of style files in the standardized PureStyle format with no corrupted styles and highly reduced redundancy.

Footnotes

[1] See, for instance, the Style section of the Unofficial YAMAHA Keyboard Resource Site.

[2] See, for instance What’s In a Yamaha Style File.

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

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

 

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 Master 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 Master
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 Master 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.

Tempo corrections in Style Customizer

I added a new feature to the Style Customizer in response to a problem I encountered creating an accompaniment to Memory by Andrew Lloyd Weber. The piece is in 12/8 time and there are few, if any, Yamaha-format styles available with this time signature. On the other hand, there are many available styles in 3/4 time. A simple solution to build a sequence for the Accompaniment Machine is to use a 3/4 style and to count each measure in the score as four measures. The style tempo must be boosted to about 180 quarter notes per minute to achieve the normal flow of the song. The procedure usually works for Main and Fill sections, but problems may occur in Intro and Ending sections. They often contain tempo-change messages to implement ritardandos or accelerandos. Such messages set an absolute tempo that does not match the tempo specified in the Style Customizer or the Accompaniment Machine. The result is that the song may slow to a crawl halfway through the ending.

To correct the problem, I added a new option in the Style Customizer shown by the red arrow in Fig. 1. When Tempo clear is active, the program removes any tempo changes that occur in the style sections. The result is that all sections play at the same rate. In this case, in an Accompaniment Machine performance you have the option of adding relative ritardandos in an Ending by using the TempoChange or TempoSet commands of the Autosequence or Performance modes. The recording below illustrates the ending of the Memory accompaniment with and correction.

Main window of the Style Customizer

Figure 1. Main window of the Style Customizer. The red arrow shows the new TempoChange option.

Regarding a performance of Memory with the Accompaniment Machine, it’s easy to deal with the 6/8 and 10/8 measures that occur in the song. For the 6/8 measures, simply count the measure as two 3/4 groups rather than four. The 10/8 measure can be implemented by adding a OneBeat command at the third 3/4 measure of the 12/8 group.

This short recording illustrates the feature. The first section is the ending of an accompaniment to Memory with no correction. The second section is the result with tempo correction and a specified ritardando.

Footnotes

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

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