Move a pitch by whole octaves until the instrument can sound it.
This is what a player does with a line written below the instrument: the note
comes back an octave up, keeping its pitch class and its place in the phrase.
Substituting a different scale degree, or refusing the passage outright, is
the wrong answer for a bass line.
The nearest octave transposition the instrument sounds, taking the
upper one when two are equally near; the pitch unchanged when no
transposition of it is available.
Example
import { BASS_4_STRING, foldIntoRange } from'@libraz/libcantus'; foldIntoRange(27, BASS_4_STRING); // 39 — Eb1 is under the low E
Move a pitch by whole octaves until the instrument can sound it.
This is what a player does with a line written below the instrument: the note comes back an octave up, keeping its pitch class and its place in the phrase. Substituting a different scale degree, or refusing the passage outright, is the wrong answer for a bass line.