For well over a year, I have been asked to add pitch bends to my music engine Pently. How are pitch bends typically notated in a musical score?
As a child, I took piano lessons and played trumpet in the school concert band. The piano is a discrete-pitch instrument. So are most instruments in a concert band, which use keys or valves to select a pitch. Only a fretless instrument is capable of a continuous pitch slide from one note to another. These include voice, fretless string instruments, and slide wind instruments such as the trombone or slide whistle. I really wasn't exposed to a lot of music heavily exploiting this while growing up, other than as a variant realization of grace notes. So the music theory that grew in my head over these years didn't have much to say about pitch bends.
A pitch can be represented in one of three ways:
Most of classical music theory is based on relationships in the log frequency domain. Equal temperament measures intervals in "semitones", a logarithm to the base twelfth root of two. For example, an octave (2:1 frequency ratio) is 12 semitones, and a perfect fifth (3:2 frequency ratio) is 7 semitones.
But synthesizers don't directly use log frequency. Instead, they use either period or frequency. Like string instruments, classic square wave based synths (e.g. AY-3-8910, SN76489, Atari TIA, 2A03, VRC6, and Game Boy PSG) use period, as do some samplers (Amiga and Nintendo DS). FM chips (e.g. YM2612) and other samplers (e.g. Sony S-DSP) use frequency instead, sometimes with a power-of-2 prescaler to set the octave.
Because my experience before designing Pently was for discrete-pitch instruments, I designed Pently to use discrete pitch. But later, I ran into issues with video game music composers who rejected Pently for not having the portamento and vibrato effects. I figured out a way to make vibrato whose depth in log frequency is the same at any pitch, using an algorithm that would be easy to adapt to either a period synth or a frequency synth and with the oscillation frequency fixed at 4 to 5 Hz, which I found most typical in instrumental music.
But portamento is a different beast entirely, as it involves two different pitches. Try to slide the period linearly, as most Amiga-style trackers do, and it'll sound faster at high pitches because there each period step is larger in log-frequency space. Try to slide the frequency linearly, and it'll sound faster at low pitches because there each frequency step is larger in log-frequency space. Sliding the log frequency is difficult on an 8-bit processor, as many music engines operate using a lookup table from log frequency to period or frequency, with one entry per semitone. For a pitch bend of less than an octave, a linear period or frequency slide is unlikely to matter. But the composer who requested this feature has a habit of using bends that are both very slow (a semitone over the course of a quarter note) and very fast (multiple octaves in a sixteenth note), and a multi-octave bend sounds noticeably different when done as period, frequency, or log frequency.
So I was hoping to look for inspiration from musical notation for strings, trombone, or voice to see how they approach pitch bend.
If you fail to understand anything in this question, let me know the first thing you failed to understand, and I will try to explain further or draw and attach an illustration.
As a child, I took piano lessons and played trumpet in the school concert band. The piano is a discrete-pitch instrument. So are most instruments in a concert band, which use keys or valves to select a pitch. Only a fretless instrument is capable of a continuous pitch slide from one note to another. These include voice, fretless string instruments, and slide wind instruments such as the trombone or slide whistle. I really wasn't exposed to a lot of music heavily exploiting this while growing up, other than as a variant realization of grace notes. So the music theory that grew in my head over these years didn't have much to say about pitch bends.
A pitch can be represented in one of three ways:
- Period: Time between repeats of the waveform
- Frequency: Repeats of the waveform per unit time, reciprocal of pitch
- Log frequency: Logarithm of the ratio between the frequency of the waveform and that of the first note of the scale. This most closely matches human perception of pitch.
Most of classical music theory is based on relationships in the log frequency domain. Equal temperament measures intervals in "semitones", a logarithm to the base twelfth root of two. For example, an octave (2:1 frequency ratio) is 12 semitones, and a perfect fifth (3:2 frequency ratio) is 7 semitones.
But synthesizers don't directly use log frequency. Instead, they use either period or frequency. Like string instruments, classic square wave based synths (e.g. AY-3-8910, SN76489, Atari TIA, 2A03, VRC6, and Game Boy PSG) use period, as do some samplers (Amiga and Nintendo DS). FM chips (e.g. YM2612) and other samplers (e.g. Sony S-DSP) use frequency instead, sometimes with a power-of-2 prescaler to set the octave.
Because my experience before designing Pently was for discrete-pitch instruments, I designed Pently to use discrete pitch. But later, I ran into issues with video game music composers who rejected Pently for not having the portamento and vibrato effects. I figured out a way to make vibrato whose depth in log frequency is the same at any pitch, using an algorithm that would be easy to adapt to either a period synth or a frequency synth and with the oscillation frequency fixed at 4 to 5 Hz, which I found most typical in instrumental music.
But portamento is a different beast entirely, as it involves two different pitches. Try to slide the period linearly, as most Amiga-style trackers do, and it'll sound faster at high pitches because there each period step is larger in log-frequency space. Try to slide the frequency linearly, and it'll sound faster at low pitches because there each frequency step is larger in log-frequency space. Sliding the log frequency is difficult on an 8-bit processor, as many music engines operate using a lookup table from log frequency to period or frequency, with one entry per semitone. For a pitch bend of less than an octave, a linear period or frequency slide is unlikely to matter. But the composer who requested this feature has a habit of using bends that are both very slow (a semitone over the course of a quarter note) and very fast (multiple octaves in a sixteenth note), and a multi-octave bend sounds noticeably different when done as period, frequency, or log frequency.
So I was hoping to look for inspiration from musical notation for strings, trombone, or voice to see how they approach pitch bend.
If you fail to understand anything in this question, let me know the first thing you failed to understand, and I will try to explain further or draw and attach an illustration.