Wired USB iPad rig

After investigating a wireless iPad-based rig for church gigs, I decided to take a 180 and try wired! The urge was inspired by a recent thread in the MusicPlayer Keyboard Forum about taming the rat’s nest of wires that engulf our keyboard set-ups.

My approach goes all-in with MIDI over USB. Both the Korg Microkey Air 49 and the Boss EV-1-WL wireless MIDI expression pedal have full-size USB-B device ports, so it made sense to start with them and build out.

I really detest the iPad 3.5mm audio jack on my 3rd generation iPad Air. That may sound like crazy-talk to people owning phones and iPads without a 3.5mm audio jack. However, the jack’s placement exposes an inserted 3.5mm plug to all sorts of physical and sonic abuse. Every time I pick up or move the iPad, the jarred plug causes all manner of crackles, pops and hum — at loud volume, no less.

Thus, an external USB audio interface is a necessity. I pulled out an old Behringer UCA222 2-in/2-out USB audio interface, which was my PC audio workhorse for many years. (Now replaced by a Yamaha AG-06 mixing console and audio interface). The UCA222 is not the best interface, but it’s inexpensive. Sweetwater is selling these for about $10USD and you can’t go wrong at that price.

Based on my success with UCA222, I put a Creative Labs Sound Blaster Play 3 external USB sound adapter on order ($20USD). The Play 3 is even smaller and will do 24-bit, 96kHz given driver and control panel support. The Play 3 is not spec’ed as IOS compatible, but folks are having success with Play 3 and iPad.

For extra credit, I would eventually like to control IK Multimedia B-3X with a Crumar D9U DIY drawbar controller. The D9U hasn’t seen much action lately and it would be good to get it into the mix. The D9U can do MIDI over USB through its micro USB port. That particular test must await another rainy (snowy?) day as I need to adapt the D9U Arduino sketch for B-3X.

Well, if you were counting, that’s four (4) MIDI devices. The Apple Lightning to USB 3 Camera Adapter has only one USB-A host port. Uh, oh. We need a hub. Fortunately, I have a few Sabrent HB-MCRM 4-port portable USB 2.0 hubs on hand. The Sabrent HB-MCRM is small, light and cheap (less than $10USD).

One could use an olde style Apple USB Camera Adapter, but why put yourself through the agony? Better to have the Lightning charge/power port than fight electrical current restrictions. BTW, I wish the Belkin RockStar™ had three ports: USB-A host, Lightning charge and 3.5mm audio.

It’s not rocket science, so plug it all in and success! Core MIDI merges the MIDI input streams together. Korg Module Pro and Crudebyte iSymphonic Orchestra respond to the Microkey Air and the Boss EV-1-WL expression pedal. I expect the D9U to function correctly, too, if I get its sketch right.

                                 S   <---->  Microkey Air 49
a
Apple b H <----> EV-1-WL expression pedal
iPad Air <----> USB <----> r u
Adapter e b <----> UCA222 audio
n
t <----> D9U drawbars

As to power, the EV-1-WL is not bus-powered. It needs either an external power adapter (9V 500mA center negative) or two AA batteries. The Korg Microkey Air and the Behringer UCA222 draw power from the Apple adapter through the Sabrent hub. (The Sabrent hub itself is not a powered hub, keeping things simple.)

A Lightning extension cable connects the Apple adapter to the iPad. This means only one cable to the iPad. The Lightning connector is reliably tight and eliminates the pops and crackles when moving the iPad. Most of the cabling sits on the floor out-of-sight.

As to audio connection, there are two options. Option 1 is running a long-ish unbalanced analog cable to the monitor. (The monitor is a Behringer B205D with a balanced XLR OUT to front-of-house.) Option 2 adds a USB extension cable between the hub and the audio interface (UCA222) for most of the distance with a short unbalanced cable from the interface to the monitor. Option 2 keeps things digital as long as possible, eliminating hum and other noise problems due to a long unbalanced cable run. Of course, there are limitations to USB extension (USB 2.0: 5M, USB 3.0: 3M).

Well, there you have it — an inexpensive, super-light, wired iPad rig. I haven’t found Bluetooth MIDI latency to be a problem, but wired latency should be less, if that is your concern. The USB approach seems to be less fiddly as to pairing, merging, etc.

If you’re curious about my wireless MIDI adventures, check out:

More blasts from the past about the Crumar D9U:

The Crumar D9U works pretty well with the Yamaha Reface YC, too.

Copyright © 2021 Paul J. Drongowski

ChordPro to MIDI accompaniment: Demo

Work continues on my Java program to translate ChordPro songs to Yamaha accompaniment (SMF). The code is fairly stable and mostly I’ve been writing example songs in ChordPro format for testing. The range and variety of musical craziness is amazing: weird chords (“Superstition”, “Michelle”), changing time signatures (“Two Of Us”), changing key signatures (“My Girl”), unusual time signature (“Everybody Wants To Rule The World”), and more.

Today, I want to give a taste of what to expect. I plan to distribute the Java executable as a “jar” file and will also make the source code available. To keep things simple, the program runs from a command line — no graphical user interface:

    java -jar cp2mid.jar ItsTooLate.cho

The program is named “cp2mid” and “cp2mid.jar” is the Java executable. We need to invoke java explicitly because it is an interpreted language and the executable consists of Java bytecodes.

The above command produces a Type 0 Standard MIDI File (SMF) named “ItsTooLate.mid”. This file must be sent to a Yamaha arranger like Genos™ by whatever means you have at your disposal, i.e., a USB flash drive or Yamaha Musicsoft Downloader.

Here is the first part of “ItsTooLate.cho”. The song begins with set-up directives including “{stylecode: }”, which selects the accompaniment style (“Cool8Beat”). You could leave out key, time, tempo, or stylecode and go with the current panel settings. This flexibility allows experiments with different tempos or different styles, including USER styles.

{t: It's Too Late }   
{key: Am}
{artist:Carole King}
{time: 4/4}
{tempo: 104}
# Style: Cool8Beat
{stylecode: 5635}

{start_accomp}
[Am7][*IA]

# Introduction (intro riff)
{start_of_instrumental}
[Am7][*MA] [D6] [Am7] [D6]
{end_of_instrumental}

{c: Verse 1}
[Am7] Stayed in bed all morning just to [D6] pass the time.
[Am7] There's something wrong here there can [D6] be no denying.
[Am7] One of us is changing
Or [Gm7] maybe we've just stopped [Fmaj7] trying. [Fmaj7][*FA]

{start_of_chorus}
And it's too [Bbmaj7][*MB] late baby now [Fmaj7] it's too late
Though we [Bbmaj7] really did try to [Fmaj7] make it.
[Bbmaj7] Something inside has [Fmaj7] died
And I can't hide [Dm7] and I just can't [Esus4:2][*FB] fake it. [E7#9:2]
{end_of_chorus}

The screenshot above shows the Genos song player with “ItsTooLate.mid” loaded and ready. Choose either the Lyrics or Score display (optional). Then hit play!

The next screenshot shows the Lyrics display. It should look familiar if you have played a Yamaha arranger. The arranger highlights the current lyric syllable or phrase in time with playback. Compare the screenshot with the ChordPro song and you’ll get an idea of what to expect for each ChordPro construct. A lyric phrase is not broken into syllables, but is associated with the chord preceding the phrase.

The following screenshot shows the Score display. It’s a different view of the same song. Lyrics appear below the staff and chords appear above. The time and key signature are displayed on the first page. Follow the bouncing ball during playback.

So, how does it sound? Listen to a quick demo (MP3) with me noodling on top.

That’s a taste of what’s ahead. I hope you will try cp2mid when it’s ready.

Copyright © 2021 Paul J. Drongowski

ChordPro auto-accompaniment: MIDI messages

I’ve made quite a bit of progress with my Java program that translates extended ChordPro songs into a Yamaha-compatible accompaniment MIDI file. This blog post describes the stuff inside the MIDI files produced by the program (cp2mid).

The MIDI file contains MIDI meta and SysEx (System Exclusive) messages which drive the Yamaha accompaniment engine. When the MIDI file is played back on a compatible Yamaha arranger keyboard (e.g., Genos), the keyboard generates an accompaniment as directed by the chord and section change messages in the MIDI file. It may sound odd to hear this, but the MIDI file doesn’t contain a single note ON or note OFF message! It’s all accomplished through control messages and the accompaniment is produced in real-time.

The MIDI file is a Type 0 Standard MIDI File. It starts with a bunch of set-up messages:

  F0 05 7E 7F 09 01 F7                           GM Reset 
F0 08 43 10 4C 00 00 7E 00 F7 XG System ON
FF 58 04 04 02 18 08 Time signature
FF 59 02 02 00 Key signature
FF 51 03 07 EF eb Tempo
F0 0D 43 73 01 51 05 00 03 04 00 00 2C 05 F7 Style code
F0 04 43 60 7A F7 Accompaniment Start

All of these message types are defined in the Yamaha Genos™ Data List PDF document. The messages beginning with “F0” are System Exclusive (SysEx) messages. Messages starting with “FF” are MIDI SMF meta messages. All messages are Yamaha proprietary (code “43”). The trick, of course, is filling in the correct values for the tempo, key, etc.

GM Reset and XG System ON initialize the tone generator. Time signature, key signature and tempo are SMF meta messages which control and arranger’s sequencing engine. The Style Code message selects one of the many built-in accompaniment styles. The Accompaniment Start message tells the accompaniment engine to get busy.

Once set-up is complete, the rest of the MIDI file consists of Chord, Lyric and Section Control messages. Again, these messages are all defined in the Genos Data List PDF document.

Here is a typical chord message:

    F0 08 43 7E 02 37 08 37 7F F7          Chord Bm/B

It tells the accompaniment engine to play a B minor chord (0x37 0x08) with a B bass note (0x37 0x7F). The neatest thing about the ChordPro conversion program? It makes it easy to play and hear difficult to finger chords like slash chords and unusual chord types like Cminmaj7-9.

Lyrics are inserted into the MIDI file using the SMF Lyric meta message:

    FF 05 len [Data]

For example, this Lyric meta message:

    FF 05 04 79 6F 75 20      0x79='y', 0x6F='o', 0x75='u', 0x20=' '

encodes the syllable text “you “.

No attempt is made to separate lyric text into syllables or to assign syllables to individual beats. When a lyric phrase is encountered in the ChordPro file, the phrase is inserted right after the preceding Chord message, i.e., it has the same MIDI timestamp as the preceding Chord message.

A Section Control message selects the current accompaniment section (pattern). The following message:

    F0 06 43 7E 00 09 7F F7               Section Control Main B: ON

selects the “MAIN B” section (0x09 0x7F). Because playback is fully automated, section changes are precise.

The penultimate message stops accompaniment:

    F0 04 43 60 7D F7                     Accompaniment Stop

The final SMF meta message ends the SMF sequencer track:

    FF 2F 00                              End Of Track (mandatory)

Overall, that’s a lot of power with just a few message types! Most of the Java code involves scanning the ChordPro input, book- and time-keeping. Java has a good MIDI library which makes coding easier.

As to time-keeping, all MIDI events (messages) have a timestamp. Messages issued from set-up directives before start_accomp occur in the first song measure. The start_accomp directive advances the MIDI clock to the first beat of the second measure. Thus, the first chord and lyric (if any) occurs at the beginning of the second measure. Thereafter, MIDI time advances in accord with each chord beat count (default: a full measure as determined by the current time signature).

Look here for more information about ChordPro format.

Copyright © 2021 Paul J. Drongowski

ChordPro for Yamaha accompaniment

Time to take the wrapping paper off my current development project.

It starts with ChordPro. ChordPro Format is perhaps the most popular notation for rock, pop, soul and folk tunes. A ChordPro format song contains lyrics and chords, usually formatted for easy display and reading. Strummers and plinkers everywhere use ChordPro songs as lead sheets.

It ends with Yamaha Genos, Tyros and PSR accompaniment. Genos — and other recent Yamaha arrangers — play MIDI files containing chords and lyrics. Genos displays either a running score or lyrics (plus chords) during playback.

What is missing is the bridge between ChordPro and Genos. My current project is the bridge. It translates an extended ChordPro file to a MIDI file which is compatible with Genos and other mid- to high-end Yamaha arranger keyboards. So far, I have a prototype up-and-running.

I emphasized the word “extended” because ChordPro format by itself is not sufficient for playback. The format does not have a precise notion of time. ChordPro relies on the musician to interpret the song on the fly. It assumes that the musician has heard the song before and knows when to change chords. As usual with computer stuff, playback needs more precise semantics. That’s where the extensions come into play.

Since there are a gazillion ChordPro songs on the Interwebs, I wanted to play back ChordPro files with as few modifications as possible. Thus, the first rule is “Each notated chord is held for one measure.” Of course, many songs change chords within a measure, too. (Even “Louie, Louie”!) Enter the first extension. A notated chord may have an optional beat count which specifies the number of beats to hold the chord, or more precisely, the number of time divisions (quarter notes or eigth notes) to hold the chord.

As I discovered during testing, existing ChordPro song files have a fair number of warts. Sometime the chord progressions are whack. The files often have random playing directions which ChordPro happily snarfs up as lyric text. ChordPro is very forgiving as it is primarily a formatting representation and tool. The initial goal — playing a ChordPro song with just a few additions — is unrealistic; expect to do some clean-ups.

Plain, unchanging accompaniment is pretty boring after a short while. Therefore, I added annotations for section changes, fills and breaks. Certain ChordPro directives are optional, but strongly recommended: key, tempo, and time signature. Tempo and time signature obviously guide playback speed and the interpretation of chord hold time. The key signature will set the arranger’s score display to the appropriate key.

Stylecode is an extension. It is a decimal number that selects the arranger accompaniment style, .e.g., 60sVintageRock, Oldies R&R, etc. A style name would be more convenient, but then I would need to develop a style name to code database for each arranger. Forget it; keep it simple. Besides, the PSR Tutorial site has such spreadsheets — just look up the style code yourself.

Start_accomp and stop_accomp are extensions, too. Start_accomp should (must) appear after all the basic playback settings are made. When the MIDI file is played back, the arranger will start or stop the accompaniment engine as directed. Start_accomp begins playback from the second measure; the first measure is reserved for set-up.

The translation program does not implement every and all ChordPro directive. It ignores formatting related directives and it doesn’t handle tablature (tab).

Let’s put all of this together and look at an example. Here is a snippet of “It’s Too Late” by Carole King.

{t: It's Too Late } 
{key: Am}
{artist:Carole King}
{time: 4/4}
{tempo: 104}
# Style: Cool8Beat
{stylecode: 5635}
{start_accomp}

[Am7][*IA]
# Introduction (intro riff)
[Am7][*MA] [D6] [Am7] [D6]

{c: Verse 1}
[Am7] Stayed in bed all morning just to [D6] pass the time.
[Am7] There's something wrong here there can [D6] be no denying.
[Am7] One of us is changing
Or [Gm7] maybe we've just stopped [Fmaj7] trying. [Fmaj7][*FA]

{start_of_chorus}
And it's too [Bbmaj7][*MB] late baby now [Fmaj7] it's too late
Though we [Bbmaj7] really did try to [Fmaj7] make it.
[Bbmaj7] Something inside has [Fmaj7] died
And I can't hide [Dm7] and I just can't [Esus4:2][*FB] fake it.[E7#9:2]
{end_of_chorus}

Lines beginning with ‘#’ are comments. Lines beginning with ‘{‘ are directives. Each directive must have a closing ‘}’ and consist of one line only. My translation tool supports the following simple directives:

  • title (or ‘t’): Song title
  • key: Song key
  • artist: Performing artist
  • composer: Song composer
  • copyright: Copyright information
  • comment (or ‘c’): Comment to be ignored
  • time: Time signature
  • tempo: Song tempo in BPM
  • stylecode: Yamaha style code (a decimal number)
  • start_accomp, stop_accomp: Starts and stops the accompaniment

As I mentioned, time, tempo and stylecode are optional, but necessary — unless you are willing to roll with the defaults. Start_accomp must be the final directive before the first chord and lyric in the song. Start_accomp generates the magic message needed to start accompaniment.

Chords look like regular ChordPro chords. Chord names are surrounded by square brackets, e.g., “[Am7]”. Nothing looks amiss until the end of the chorus, e.g., “[Esus4:2]” and “[E7#9:2]”. “:2” is a beat count. Each chord is held for two quarter notes — quarter notes because the number of divisions per bar (the “denominator”) of the time signature is four. It’s our job to make sure that the counts add up to a full measure in order to keep everything synchronized to measures.

The translation program (yet unnamed!) is very forgiving when it comes to chord spelling. However, it only recognizes and generates the 34 Yamaha chord types which are supported by Yamaha arrangers:

    Maj        7        min        minMaj      aug      dim 
Maj6 7sus4 min6 minMaj7 aug7 dim7
Maj7 7b5 min7 minMaj7-9
Maj7#11 7-9 min7b5
Maj9 7#11 min9
Maj7-9 7-13 min7-9
Maj6-9 7b9 min7-11
7aug 7aug
8
5
sus2
sus4

If the chord is not recognized, you will get a major or minor triad.

ChordPro allows annotations, that is, constructs beginning with “[*” and ending with “]”. Annotations ordinarily are playing instructions that are displayed in a pretty-printed ChordPro song. Annotations are extended with accompaniment section control commands:

  • Introduction: [*IA] [*IB] [*IC] [*ID]
  • Main section: [*MA] [*MB] [*MC] [*MD]
  • Fill in: [*FA] [*FB] [*FC] [*FD]
  • Break: [*BR]
  • Ending: [*EA] [*EB] [*EC] [*ED]

A section control command usually follows a chord and takes effect at the same time as the chord change.

ChordPro supports paired formatting directives like:

    {start_of_chorus} 
...
{end_of_chorus}

I am currently experimenting with these directives to control lyric and chord formatting. Yamaha’s lyric display allows line breaks and page breaks. Start of chorus (abbreviated “{soc}”) generates a page break. I added a new directive pair for handling long instrumental breaks, e.g.,

    {start_of_instrumental} 
[Cmaj7][*MC] [Fmaj7] [Fmaj7] [Am7] [Gm7] [Fmaj7]
[Dm7] [Esus4:2][*FC] [E7#9:2]
{end_of_instrumental}

Yamaha’s lyric display runs chords together when no lyric text is present. The new directive provides some separation between chords by generating filler lyric text (dashes, to be exact).

That’s the story. Testing continues. I will make the Java source code available as soon as possible. So far, so good. The concept works.

Copyright © 2021 Paul J. Drongowski