A Method to Layer Piano and Sustained Instruments (Pads, strings)

I love layering piano and strings. I have my strings controlled by an expression pedal so that I can recreate string swells, etc. This works very well for melodic and lyrical music. However, this has created problems when I’m playing more fast paced music and I use the sustain pedal. Here’s an example. Let’s say I’m playing a fast and repeated C major arpeggio. For the piano layer, using sustain sounds nice. But the the sustain pedal also sustains the strings layer. All the string notes build up, increasing in volume. The result is a very muddy messy sound. And when I release the sustain in order to go to the next chord, that wall of sound that built up drops suddenly in volume, only to build up again in the next chord.

Here are some solutions I’ve been pondering. I’m curious if anyone would know how to implement them. Let’s say I’m playing the following sequence of notes: CEG CEG with the sustain pedal.

  1. Create a midi script that prevents repeated notes from being retriggered so long as the sustain pedal is pressed. In this manner, if I play a C E G C E G on the keyboard, only the first 3 notes will play and the second 3 wouldn’t be retriggered at all.

  2. Some sustain pedals have continuous values. Is there a way to program Cantabile such that when the sustain pedal is fully depressed, both the piano and strings are sustained, but when I lift my sustain pedal halfway, the piano sound continues sustaining, but the strings are “latched” in such a way that no new notes will be triggered, but the notes that were sounding right before the sustain pedal was lifted halfway, continue to sound until the pedal is fully released.

  3. Programming a midi script that triggers pre-made chords on the strings layer. In this setup, the lowest note I play on the keyboard with my left hand will trigger the desired chord and will sustain it until I release the pedal. This will allow my right hand to play the piano layer with nearly complete freedom.

Ultimately, the goal is to allow me to play the piano layer like a piano, uninhibited by concerns of the build up of sound in the strings or pads.

Any thoughts?

I just filter out the sustain pedal CC on the string/pad to fix this one. John

The most obvious solution would be to limit the polyphony of the string plugin. So if you set it to 3 (or maybe 6 is better) they will not build up.

Interesting approach - looks like something that could easily be implemented using ReaJS. Just needs a bit of fiddling to avoid stuck notes; don’t want to lose a relevant note-off. If I find some coding time in the next days, I might take a shot at this…




Hi Cordaro and Welcome,

I have some ideas for your question but was wanting a few more details about your playing style so I am sure what you want. Do you enter the layered string or pad notes you want to sustain (or latch) as an arpeggiation or as a straight chord or both depending on the flow of the song? Also you say you use a swell pedal and a single damper pedal to perform, is that correct? It looks like an Alesis Q88 on the site, is that what you have? It matters because that keyboard model can’t use a continuous CC type of damper to be of any help. Damper pedals that have continuous capability for half pedaling piano dampers are not on every controller, they require a TRS plug like on your expression pedal. Roland’s version of the damper has a switch to flip between continuous CC and switch FWIW but your keyboard would have to be equipped with a proper jack. I think you might be able to use a pedal like this to get the job done but it’s mute if your keyboard doesn’t have a continuous CC input jack for that. (most only have one for expression but some pianos have them on all their pedal jacks (Roland RD800 or RD2000 for example).

I do this kind of setup on the RD2000 using Cantabile route filters (Big thx to @Torsten for showing the value of these filters) to achieve what you are suggesting already, Pressing the damper pedal part way (past a midi value of 64) allows the damper to sustain notes and pressing all the way down (midi value past 120 and all the way to 127) filters out the newer unwanted notes from the pad or strings but the ones that are latched stay on until you release the pedal. the pedal has 3 effective zones, one for off, one for loading sustain notes and one for stopping more notes from loading into the sustain buffer. This behavior is confined to the pads only of course. A song layout would look like this example with an EP and a string pad.

The route for the strings has a filter (at the bottom of the pic below under “Condition”) on the control panel that does the work. From MIDI value 0 -63 the pedal is OFF. From MIDI value 64 -119 the notes are added to the sustain or hold buffer and from MIDI value 120-127 the route is disabled so no new notes can be added to the buffer. When you release the pedal it kills all notes in the buffer and resets everything.

The route for the EP has no filter and behaves as if it sees a normal sustain pedal. So, using your 3 note arpeggio example you would press the pedal to a point past halfway and play the first arpeggio, press the pedal all the way down and play the rest of you fast arpeggios over the top. The piano would be the only instrument still adding notes to the sustain buffer.

A script is your best bet if you don’t have this hardware capability but at least you know how to do it if you get some gear that has these type of MIDI CC input jacks on them. A second expression pedal input would work if you had it as well since it’s effectively the same thing. There are MIDI controller surface boxes that could provide the needed hardware without getting a different keyboard. Behringer BCR2000 for example but there are a host of others too.

Love your website and your groups instrumentation!



1 Like

Oh man! Dave, thank you for this! I’m gonna give this a try later this afternoon! I’ll let you know how it turned out for me.

So I go back and forth between a Roland RD800 and an Arturia Keylab 88. I love these keyboards precisely because they have all the pedal inputs.

But yes, depending on the flow, I may start first with a chord or with an arpeggio.

One thing before I give this a try. Would this work the same if I set the pedal to add pad notes to the sustain buffer only when all the way down, but stops adding when I release pedal halfway, while still sustaining those initial pad notes until a complete release of the pedal?

Right! That’s what Dave was suggesting too. I’m gonna give that a try. Thanks, John!

Hey Cordaro,

I don’t think that would work because the Vsti’s are set to believe that the CC64 input is a switch that turns the buffer on after the value exceeds 63 and turns it off and clears it out. It sounds like you would like to be able to play non sustained notes over top your held string chords with your piano. To do that trick it would require some more thought but if you have the inputs for more pedals that would be a way to do it. You would have a pedal for the piano set regular and one for the strings that latched the notes and stopped the entry of more notes when pressed down and reset all when released. It makes it weird to use your swell pedal with the 2 dampers but I think you could figure out a technique that worked for you. Let me know how it goes!


I see. What’s so weird is that I noticed two different plugins responded differently to CC64.

The piano vst that I use, for example, turns on the sustain at 64 and above. However, the strings patch I use in Kontakt will not sustain until I hit 127, and will continue sustaining until it gets back to 0.

At any rate, the method you suggested was nearly perfect! I was blown away that I hadn’t been doing this all along. And it seriously cuts down on polyphony and taxes my computer much less.

I only had a couple issues. First, because the sustain on my strings patch only triggers after 127 has been reached, the strings will not sound if the damper pedal is pressed all the way. This means that I have to play the chord before I hit the sustain pedal. In a sense, it operates somewhat like a sostenuto pedal. So I have to have impeccably choreographed timing between my foot and hands (which I’m still working on, haha).

The second issue is that once all the notes that I want sustained are in the “sustain buffer,” they can no longer be controlled by my expression pedal. The held notes are stuck at whatever dynamic/volume they were at at the time the pedal was pressed. I would love to be able to control their dynamics even while sustained.

Because my string patch interacts with the sustain pedal in such an odd way, I thought that remapping some CC controller ranges might help, but I can’t wrap my head around how to do it. A midi script might be necessary.

In a sense, I want the following to happen.

Step 1: Pedal at 0
No sustaining strings

Step 2: Pedal 1 - 126
As pedal is pressed between these values, the strings will not sustain… and in fact, cannot sustain for some reason with the patch that I’m using.

Step 3: Pedal 127
Once the sustain pedal is all the way down, the sustain buffer opens and all notes currently sounding are sustained.

Step 4: Pedal 127 to 1
Once the pedal released to less than 127, the buffer closes and no new notes can be sustained. I’m open to the strings still sounding in a non-sustained fashion, or even not sounding at all.

Step 5: Pedal at 0
All sustained notes being held are released.

Any thoughts on how this can be achieved? Even if there are no ideas on how to do this, I’m super happy to have gotten this close.

On a separate note, is there some place I can go to learn how to write scripts?

Thanks again, Dave… and everyone who has given me some ideas on how to do this!

Thank you Torsten!

Any luck in finding anything? Where could I go to find some coding and/or how to implement it in Cantabile?

Most of the scripting to accomplish what you’re after will happen in Kontakt. Here’s a series of articles that can help you get started:

1 Like

Hi Cordaro,

It looks like it is responding as a hold switch as opposed to a damper. This is probably a function of the Kontakt script for that patch. I’ll have to look into this for any possible logic solution but what I described is definitely not what you need. Sorry if it produced a rabbit hole for you …

FWIW I have been able to use a binding to route the expression pedal to it even though it is blocked on the input route by the filter like this (using cheesemachine as example)

Even though the input route is blocked by the filter you can still use bindings to send CC data to the plugin. It acts as an alternate CC route for one parameter at a a time.

I’ll get back yo you on the other issue ASAP


1 Like

The plugin I use for custom wizardry is ReaJS, part of the free ReaPlugs bundle.

There’s a bit of a learning curve involved - ReaJS processes MIDI data in chunks of audio buffers, and its programming language (JSFX) is a bit of a funky beast. But you can get interesting things done with it.

Haven’t gotten to tackling your issue yet - not sure when I have some time for that…



OK, I took a shot at this and whipped up a little ReaJS script to “deduplicate” notes.

You’ll need to set up your song like this:

So the route from your keyboard to the strings goes through ReaJS.

Paste the contents of the script below into a plain text file (but without .txt extension) in the Reaper effects/midi directory (depends if you have Reaper installed or not; you may have to set the location of your effects directory in reajs.ini) called “midi_deduplicator”. Then load this script in ReaJS - it should become active right away and need no configuration.

Now any note repetitions played with the sustain pedal down (> 63) will be ignored; the script should also catch notes held before the sustain pedal was pressed and released afterwards.

Give it a try and let me know if something doesn’t work quite like it should - I’ve given it a bit of a shake, but not too thoroughly… But it does clean up a string layer nicely :slight_smile:



Here is the script (also attached as a zip file for convenience):
midi_deduplicator.zip (841 Bytes)

desc:MIDI Deduplicator
//tags: MIDI processing



notes = 128;
i = 0;
loop(128, notes[i]=0; i += 1;);

pedal_down = 0;

NOTE_ON = 9;


  while (
    input = midirecv(mpos, msg1, msg23);
    input  ? (
      statusHi = (msg1/16)|0;
      statusLo = (msg1-(statusHi*16))|0;

      data2 = (msg23/256)|0;
      data1 = (msg23-(data2*256))|0;
// .... for Note Ons
      statusHi == NOTE_ON && data2 > 0 && data1 >= slider1 ? (
          pedal_down ? (
          // pedal is down --> deduplicate
        notes[data1] == 0 ? (
            // no previous note --> play and register
          notes[data1] = 1;
          midisend(mpos,msg1, msg23);
        ); // else: previous note active or released --> ignore
      ) : (
          // pedal is up --> simply register notes played
        notes[data1] = 1;
        midisend(mpos,msg1, msg23);
// .... for Note Off
    statusHi == NOTE_OFF || (statusHi == NOTE_ON && data2 == 0 ) ? ( 
        pedal_down? (
          // pedal is down --> deduplicate
        notes[data1] == 1 ? ( // active note to kill
            notes[data1] = 2; // remember that note was released with pedal on
        ); // no "else" necessary; all other note off ignored
      ):( // pedal up
          // simply register note off and send
        notes[data1] = 0;
    ) :
// .... for CC 64
      statusHi == CONTROL_CHANGE && data1 == 64 ? (
        data2 > 63 ? (
          pedal_down = 1;
      ) : (
          pedal_down = 0;
          i = 0;
          loop(128, notes[i]==2? notes[i]= 0; i += 1;);
    ) : (
// .... anything else    
          midisend(mpos, msg1, msg23);

BTW: the easiest way to find your ReaJS script directory is like this:

Insert ReaJS in a song and open its editor:

Now click “load” and load any effect script from the “midi” category:

Hit the “Edit” button and the editor will open - you’ll find the correct directory for your midi scripts at the top of the window:




That’s excellent @Torsten, thank you!! I often hit this multiple notes thing when using M-Tron Pro, which also accumulates duplicate notes on separate voices. Not any more - this handy tool is going right in a rack for easy re-use!! :slight_smile:

1 Like


Brilliant Torsten!! You never cease to amaze. :mage:

1 Like

Wow! Thank you so much! This worked super well!

The only complication I have is that in the event that I do want to play the same note twice in a row on the piano, the accompanying string layer will cut off. For example, for the following chords, where the capital letter is the melody line:

Piano : (ceG) --> (bdG)
Strings: (ceG) --> (bd_)

Here, the G cuts off even though I released and pressed the pedal.

It’s more of a timing issue. If I do it very slowly and deliberately, I’ll get lucky and it’ll sound.

But either way, this is super super helpful. I think what I’ll do is have a separate sustain pedal that controls this type of deduplicating sustain. Therefore, whenever I do need the notes to repeat, I’ll just switch to the regular sustain pedal.

Thanks again for this Torsten!

Hi Cordaro

can you show where in this sequence you press the pedal and when you release it? I have an idea about potential timing issues - but that only applies in a very small milliseconds range. But there might be some other gremlin in the script - happy to hunt it :wink:



1 Like

Hi Cordaro,

just tested this for a while - deactivated the piano layer to hear better, and tried to reproduce your scenario. Couln’t really reproduce it - played your chords both arpeggio and en bloc, with pedal releases in between; none of the notes got cut off. Not sure if there’s something about your configuration that messes with the sequence of notes and pedals in the MIDI stream?