Piano realism using the ACT command

Richard Bettis
For some time I have been attempting to use the Upright instrument to its full potential in transcriptions of piano music. One of the problems in achieving this in a straightforward manner lies in the fact that a piano can hold one note while playing another, an effect which can be achieved by holding a note down while playing the next, or by using the 'loud' pedal.
In AMPLE, it is easiest to program a part using one voice, but this leads to a 'clipped' style. For example
"cutoff" [SCORE 24, CDefG 0,^]
A more realistic sound needs further effort.
One technique that I had tried was to give each line several voices, and swap the notes between voices:
"sustain" [READY 2 VOICES Upright
SCORE 24, C(^)/(D)e(/)/(f)G(/)^(^)]
Since AMPLE assumes that you want a 'hold' on any voice you don't give explicit instructions for, this can be reduced to:
"sustain" [READY 2 VOICES Upright
SCORE 24, C /(D) e /(f) G ^(^)]
though I've kept the spaces to show each 'new' note.
However, I found using this technique required a lot of time in Notepad, and made a simple transcription from sheet music on to the Staff Editor virtually impossible. It is the AMPLE equivalent to holding down the piano keys, and it required nearly as much programming time as you might spend practising to be able to achieve the same effect on a real piano.
I also found I wasn't alone in using this technique - for another example see the Pilgrim Beart piece ('ppach') in AMPLINEX 003.
Then I read (in AMPLINEX 002) of the joys that only the ACT command can bestow - could I use ACT to automate this 'voice swapping', to give me an AMPLE 'loud' pedal?
It seemed I could use it to cycle round a number of voices in turn, keeping track of where it was using a 'voice' variable. This would need a separate variable for each player, but that was solved in the 'Data Storage' article from AMPLINEX 002:
"voice" [PNUM 8 DIM ARRAY]
which gives each player its own space in an array.
I then had to find out the significance of the three VOICE commands described in Andy Thomas' ACT article. Perhaps the Programmer Guide would tell me all this, but it appeared that a new note has all three set to the required VOICE, a hold has all three set to '0' and a tie has the PITCH voice set, but VEL and GATE voices as '0'.
So I wrote a new ACT command to swap between voices for each new note, using the GATE voice as a check that a new note was required:
"act" [1 voice #!
ON ACT(5 FVAR #? 0 #=
IF(1 FVAR #?
   0 #= IF(1 FVAR #?)ELSE(voice #?)IF
             VOICE 2 FVAR #? PITCH
   3 FVAR #? VOICE 4 FVAR #? VEL
   5 FVAR #? VOICE 6 FVAR #? GATE
   7 FVAR #? DURATION
   )ELSE( voice#? 1 #+ #11 3 #>
   IF(#2 1 voice#!)ELSE( voice#!)IF
    voice #? VOICE 2 FVAR #? PITCH
    voice #? VOICE 4 FVAR #? VEL
    voice #? VOICE 6 FVAR #? GATE
                   7 FVAR #? DURATION
   )IF)ACT
]
By way of explanation (AMPLE words like this always strike me as incomprehensible) this is how it works:
- The first line sets the 'voice' variable to 1, ready for the first time the new ACT is used.
- The next line checks if the GATE voice is zero.
- If it is, then the PITCH voice is checked. If this is zero, then zero is used, otherwise the last value of voice is substituted.
- Over the next four lines, the ACT command is carried out.
- If the GATE voice wasn't zero, a new voice is required. The current 'voice' is retrieved, 1 is added and a copy of this new voice number is made. This is checked to see if it is too big (in this example there are 3 VOICES).
- If it is too big, the current number is dropped and 'voice' is set to 1; otherwise 'voice' is set to the incremented value.
- The value of 'voice' is then used as an otherwise normal ACT command carried out.

Related files on this disc:
F.pACTex - an example of the ACT command discussed in the above article

Published in AMPLINEX 005, May 1988