Saturday, May 23, 2015

UPDATED: A new MIDI sostenuto pedal solution with Pianoteq

In my video on rolled chords with the independent sostenuto pedal, the piano sound is generated by Pianoteq 5, indispensable software for anyone who wants to get a realistic acoustic sound from a MIDI keyboard. At the time I published the video, Pianoteq didn't support the independent sostenuto pedal. This has been fixed as of last month—there's now an option to have the sostenuto pedal ignore dampers raised by the damper pedal!

My original method of hacking a sostenuto pedal can now be greatly simplified. I still use a Pure Data patch to "convert" my USB pedal into a sostenuto pedal. However, the patch only needs to send controller messages to the Pianoteq virtual instrument; the sostenuto effect is correctly managed within Pianoteq. My new patch is here: http://edwardneeman.com/sostenutoPianoteq.pd

The setup instructions are still the same as before. However, Pianoteq will be receiving MIDI data from two separate sources: the MIDI keyboard, and Pure Data. To send MIDI data from Pure Data to Pianoteq, I do the following (this is Mac specific):


  1. Open the Application "Audio MIDI Setup".
  2. Under the Window menu, select "MIDI Studio".
  3. Doubleclick IAC Driver to open the "IAC Driver Properties" window.
  4. Make sure the "Device is online" box is checked.
  5. In the Pure Data application, select "MIDI Settings" under the Media menu.
  6. Set the Output Device to IAC Driver.
  7. Pianoteq will now need to accept MIDI data from both the IAC Driver and the external MIDI from the keyboard.
  8. In Pianoteq, select "Audio/MIDI Setup" in the File menu.
  9. Make sure all the relevant inputs are checked under "Active MIDI inputs", or just check "Listen to all MIDI inputs".
  10. Don't forget to select the independent sostenuto option! Right-click (or control-click) the sostenuto pedal and check the "Ignore the damper pedal" box.
Happy pedaling!

Wednesday, March 18, 2015

Using the Independent Sostenuto Pedal for Rolled Chords

In a previous post and video, I dealt with how an independent sostenuto pedal—that is, a sostenuto pedal that works even when the damper pedal is depressed—can be used to expand the possibilities of pedaling technique. I recently posted a video that gets much more specific, focusing on how the independent sostenuto can be used to pedal rolled chords.

I covered the technique involved in my previous post (under the heading “Only Hands Small”). In cases where the notes of the rolled chord cannot be held simultaneously, the sostenuto pedal can catch one or more notes (usually the bass notes). The damper pedal can thus be used with much more flexibility, since it’s no longer required at the beginning of the roll to sustain the full chord.

In the video, I use this example from the Nocturne in C minor, Op. 48, No. 1 by Frédéric Chopin:



By catching the bass notes of the arpeggiated chords on the sostenuto pedal, it becomes possible to change the damper pedal at the end of each roll, keeping a legato line in the treble voice.



Gabriela Montero’s splendid performance of this Nocturne is a good example of how the treble voice can end up with gaps due to pedaling, without the assistance of the sostenuto. Here is my demonstration of how to use overlapping pedal in the passage.

I should mention that there is another common pedaling technique to get a legato melody line without using the sostenuto pedal at all. By holding the melody notes over the pedal changes, it’s possible to avoid gaps in the melody.



The melody will be slightly blurred, because consecutive notes will overlap on a single pedal, but it is so subtle that it is unlikely to be a problem. The passage from the Nocturne is particularly amenable to this technique, because the overlapping melody notes usually fit with the following chords. Lugansky’s performance of this Nocturne is a stellar example of how this can work. However, it can be more difficult with small hands, because the speed of the roll and the quiet dynamic require the chords to be played legato with stretching.

Compared with holding melody notes, the main advantage of overlapping pedals is legato transitions between the full chords, not only between the top melody notes. Actually, the two techniques are closely related; both involve sustaining notes over pedal changes. This is an important technique for advanced pianists and one that is greatly enhanced by the independent sostenuto pedal. Holding the bass notes of rolled chords is just the tip of the iceberg.

Symphonic Etudes

In my video, I demonstrate how the opening rolls of the Symphonic Etudes, Op. 13, by Robert Schumann can be played with the assistance of the sostenuto pedal. I have highlighted the notes that I catch on the sostenuto pedal in the example below:



This example is more complicated, because the music seems to ask for quicker rolls than in the Chopin Nocturne, and it requires some quick footwork to get the desired notes on the sostenuto. I use a slightly different technique for more reliable results. Instead of catching the desired note during the roll, I catch that same note from a previous chord, using the partial sostenuto technique. After playing the chord, I press the damper pedal, lift all the other notes, and press the sostenuto pedal to catch only the desired note. Here is how it works:



The disadvantage of this method is that the E will slightly blur the F sharp minor chord on the first beat of the second bar, but the blurring is usually too slight to be heard. I use this technique on two of the three chords highlighted above; in the case of the final chord, I find that catching the B sharp from the first beat of the fourth bar compromises the D sharp dominant seventh on the next beat.

Hommage à Rameau

In the second movement of Images, Book 1 by Claude Debussy, the sostenuto pedal can be used to assist with a rolled A major chord, abruptly returning to a piano dynamic after a crescendo:




I roll the chord hand over hand in order to have more time to catch the bass with the sostenuto pedal. If played as written, the left hand has to jump immediately after playing the bass A octave, leaving only a very tight window to catch those notes.

Many pianists, including Marc-André Hamelin, take advantage of the sudden shift to make a dramatic break in the melodic line. This is a very effective and musically justified solution. However, I like the effect of a sudden piano without such an obvious gap, as if the music were in free fall and elegantly landed into a soft A major web. In fact, this is one of my favorite applications of the independent sostenuto pedal in the standard piano literature. Regardless of one’s preference, having the option of using the sostenuto pedal greatly enhances the musical possibilities of this passage.

Constructing a Virtual MIDI Sostenuto Pedal

This post explains how I created the sostenuto pedal that I used for this video.

An independent sostenuto pedal is a pedal that catches the dampers of any keys that are being played at the time the pedal is pressed. It works slightly differently from the sostenuto pedal on an acoustic piano. Normally, the damper pedal can interfere with the acoustic sostenuto—if the damper pedal is down, the sostenuto pedal can’t be pressed effectively until the damper pedal is raised again. The independent sostenuto pedal removes this limitation, allowing the two pedals to be used together freely and intuitively.


In an earlier post, I showed how to “hack” the acoustic mechanism to create an independent sostenuto pedal. This can be a great way to experience its potential on your own instrument, but the method can be complicated and time consuming and doesn’t work on every piano. Fortunately, the “mechanism” of an electronic keyboard is much simpler (at least until the point of sound production), so creating a sostenuto pedal on a keyboard is quick and reliable.


On most three-pedal keyboards, the middle pedal works like an independent sostenuto pedal by default. If you invested in something like this, you're already set.


However, a three pedal set for a keyboard can be a bit pricey, and it may not be worth it if you play mostly acoustic instruments. Here’s a simple way to construct a virtual sostenuto pedal that costs less than $20. You will need the following:
  • A laptop (if you don’t have one, this is still your cheapest option)
  • A MIDI to USB cable (available here for $7.15 at time of writing)
  • A USB foot pedal (available here for $10.75 at time of writing)


I still own a keyboard with a traditional MIDI hookup (Casio PX-120), but these are almost obsolete. More recent models have a USB connection, meaning the MIDI to USB cable would be swapped out for a normal USB cable, saving a few more dollars.


The Principle


My virtual sostenuto pedal works by sending the MIDI data from the keyboard to the laptop, altering that MIDI data, then sending it back to the keyboard. MIDI is a code that electronic instruments use to speak to one another and to computers. There’s MIDI code for a wide variety of things, including pushing the damper pedal (sends a value of 127 to controller 64), pitch bend (sends a value between 0 and 16,384 to the pitch wheel), or an emergency “reset” button that turns off all sound (“All Notes Off”, or a value of 0 to controller 123). In a typical keyboard performance, the vast majority of MIDI data are note events. Note On events occur when a note is pressed. They specify the key number (from 0 to 127, middle C is 60, A4 is 69) and how hard the key is struck (also called "velocity" with a value from 1 to 127). Note Off events occur when a key is released. They also specify a key number and have a velocity of 0.


At the time the sostenuto pedal is pressed, it checks which keys are being played. Our virtual sostenuto pedal will need to keep track of the MIDI note events so that it knows which keys to sustain. As long as the sostenuto pedal isn’t used, any MIDI data sent to the computer gets bounced straight back to the keyboard. When the sostenuto pedal is pressed, a “snapshot” of the state of the keyboard gets saved. Any notes that were being played will not be released as long as the sostenuto remains down. That means that the certain Note Off events coming from the keyboard won’t be passed back. When the sostenuto pedal is released, those Note Off events are sent all at once, with the exception of those that correspond to a note still being held at the time.


The Setup


Even though it’s not too difficult to manipulate the flow of MIDI data as outlined above, I don’t currently have a quick solution. My system is the result of hours of experimentation, and even once you’re equipped with all my tools it takes a while to set up. I’d welcome any ideas of how to streamline the process. I made a rudimentary patch using Pure Data, a free and open source visual programming language especially designed for musicians. I’ve posted my patch here.


Here are the steps to configuring your sostenuto pedal:


  1. Connect the keyboard to the computer using the MIDI to USB cable.
  2. Connect the USB pedal to the computer.
  3. Turn off the Key Repeat option on the computer. On my Mac, this option is in System Preferences->Keyboard. If you don’t do this, the USB pedal may not work properly.
  4. Download and install Pure Data, then download and open my thirdpedal.pd patch. Note that Pure Data is a powerful program with a steep learning curve. It's a valuable tool for musicians though, and I highly recommend learning the basics of its operation. This is a great tutorial.
  5. Check to see if the MIDI is working correctly. When you play notes on the keyboard, the keyboardStatus graph in the thirdpedal patch should change. If not, check the MIDI settings in Pure Data or in the system preferences. On my Mac, the MIDI preferences are hidden in a separate application “Audio MIDI Setup”.
  6. Click the “toggle sostenuto function” button at the top of the thirdpedal patch so that an X appears.
  7. Try out the USB pedal. When you push the pedal, it will send a keystroke to the computer. You can figure out which keystroke by checking the key number box at the top left of the thirdpedal patch. My USB pedal will function like a giant “B” key by default, which is key code 98.
  8. If your pedal sends a different keystroke, you can set the number by clicking and dragging in the number box below the “toggle sostenuto function” button. (The box that says “set the pedal number here”).
  9. Turn the local control off on the keyboard. This will cut the connection between the physical keyboard and the keyboard’s audio output. This step is important, because you want the MIDI data to be filtered through the computer before it comes back to the keyboard and is converted into audio, like in this diagram:

I haven’t tried to adapt any of this process to any setup other than my own. If anyone does attempt to set up their own virtual sostenuto, I would be happy to help where I can, and would welcome any feedback! Good luck.



What Happens


You can view the status of the keyboard (which notes are pressed, and at what velocity) in the keyboardStatus graph on the thirdpedal patch. Pushing the sostenuto pedal will copy the data in the keyboardStatus graph into the pedalStatus graph (which looks exactly the same, but inverted). The patch will filter out any Note Off MIDI commands that correspond to notes with a positive pedalStatus value. The number of blocked Note Off commands is recorded in the suppressedReleases graph. It is important to keep track of the suppressedReleases, because when the sostenuto pedal is lifted, the appropriate number of Note Off commands have to be sent for every pitch that was held on the sostenuto pedal.