GuitarProcessor
A parametric physical model of a guitar.
| Declared in | src/libs/libbahn/bahn/tracker/processor/GuitarProcessor.hpp |
| Inherits | StringInstrumentProcessor |
| Group | bahn |
Detailed description
The same stiff strings and the same modal body as the piano, because both are stiff strings over a resonant box. Four things make it a guitar rather than a keyboard with a guitar timbre, and each is a hook on StringInstrumentProcessor rather than a new engine.
- One voice per string. A string carries one note, and playing a second note on it stops the first — because the finger that stops the new note is on the same wire. This is the defining constraint and it is what makes the instrument play like a guitar.
- A pluck, not a hammer. A released displacement rather than a force impulse, so partial amplitudes fall as
1/n^2instead of1/n. Measured at exactly one power of n apart (specs/physical-instruments §PIR-3). - Far less stiffness. Measured guitar inharmonicity runs from about 1e-6 to 1e-3, one order below a piano's bass and three below its treble, so a guitar is much closer to harmonic.
- Sympathetic ring. An open string sounds when another is plucked, because the bridge carries energy between them. This is most of what separates a guitar from a sampled guitar, and the voices to do it already exist and are already tuned.
Tuning and the compass
Six strings sound at once by default. The compass reaches down to B1 so a seven-string or a baritone tuning works — Tuning selects the table, and value 2 sounds seven strings.
Scale
0.6 to 1.6, a parlor guitar to a dreadnought. It moves stiffness, decay and body frequency together and it does NOT move pitch. A bigger guitar is deeper and purer; a parlor guitar is brighter and harder, because a shorter string is more stiffness-dominated.
Member function documentation
baseDecayFor
[override virtual protected] ProcessorSample GuitarProcessor::baseDecayFor(int note) const
A plucked steel string rings far longer than a piano's treble and far shorter than its bass.
Returns the T60 in seconds for the MIDI note note, before Scale moves it.
A stopped string decays faster than an open one, because the finger absorbs energy. That is a real difference a player hears and it costs one lookup.
baseInharmonicity
[override virtual protected] ProcessorSample GuitarProcessor::baseInharmonicity(int note) const
Guitar stiffness, far lower than a piano's.
Returns the inharmonicity coefficient for the MIDI note note, before Scale divides it. A note outside the compass takes the value of the nearest end.
Measured guitar inharmonicity runs from about 1e-6 to 1e-3 across the strings and the first seventeen frets, rising with fundamental frequency and with fret number — one order below a piano's bass and three below its treble. That is audible as a purer, less stretched tone.
Wound strings carry a caveat: measured and calculated B agree well for plain strings and poorly for wound ones, because the winding adds mass and little bending stiffness. The low end of this curve therefore sits at the bottom of the measured band rather than on the formula.
See specs/physical-instruments §PIR-8.
bodyTable
[override virtual protected] std::vector<ModalBody<double>::ModeSpec> GuitarProcessor::bodyTable() const
The guitar box.
Not a plate. An air cavity coupled to a top plate, and the coupling splits the two resonances apart. The three low modes with (0,0) character are the Helmholtz air mode and two body modes, and the classic worked example puts them at 100, 123 and 214 Hz. Measurements on a Martin D-28 put the first longitudinal cavity resonance at 383 Hz.
Modes 5 through 10 are a deliberately generic upper body and carry no source, which the user documentation is required to say rather than imply otherwise (§PIU-3).
Ordered loudest first, so truncating the table is the quality budget. The gains are peak gains now that ModalBody normalises correctly, and a guitar needs a loud box: an unamplified steel string on its own is nearly inaudible, and the body is most of what a listener hears.
See specs/physical-instruments §PIR-5.
damperT60
[override virtual protected] ProcessorSample GuitarProcessor::damperT60(const StringInstrumentProcessor<StiffString<double>>::Voice &v, ProcessorSample freeT60) const
A guitar has no damper, so a string rings until something stops it.
Returns the T60 in seconds that the voice v has now. freeT60 is the T60 of the note with nothing touching the string.
Three things can: a new note taking the string, which is the finger moving and stops the old note hard; the palm mute, which is the heel of the hand resting on the strings at the bridge; and nothing at all, which is the normal case and is why a guitar rings the way it does.
exciteVoice
[override virtual protected] void GuitarProcessor::exciteVoice(StringInstrumentProcessor<StiffString<double>>::Voice &v, ProcessorSample velocity)
The pluck.
Plucks the string of the voice v. velocity sets how far the string is bent before it is released, which sets both the loudness and the brightness.
Pick position runs from over the soundhole to near the bridge. Brightness is pick hardness: a plastic pick reaches further up the partial series than a thumb, and a harder pluck reaches further still because the string is bent further before it is released.
stringBodyMix
[override virtual protected] std::pair<ProcessorSample, ProcessorSample> GuitarProcessor::stringBodyMix() const
The body is most of a guitar.
A piano is 55 per cent string; an acoustic guitar is the other way round, because the string alone moves almost no air and the top plate is the radiator.