Reputation: 1
I want to find pitch of a 4-string Bass Guitar. I have the following information available-
I don't know how to map this information to find the pitch. Need some help.
Upvotes: -1
Views: 194
Reputation: 2346
The "algorithm" for computing the note at a given string and fret position on guitar or bass fretboard is pretty simple, and there's a standard formula for computing the specific pitch (frequency) of a given note.
These are described in more detail below, but the TL;DR version is this:
to determine the note at fret F
take the open string tuning and add F semitones; i.e., each fret changes the pitch by exactly one note (including sharps/flats)
the frequency of the note N
semitones (frets) away from A4 (440 Hz) is given by 440 Hz * (2^(1/12))^N
Hence while there is a programming/algorithmic angle to this question, I think what you're primarily missing is some music theoretical context. Toward that end let me try to clarify a few relevant "terms of art" here:
Pitch describes the "highness" or "lowness" of a sound. In a precise, technical sense, pitch is both relative and perceptual. I.e., it's function of how your ear (and your brain) subjectively perceives the sound rather than a fundamental attribute of the sound wave itself. But that's an overly pedantic definition. For most practical purposes - especially in the context of computer generated sound - you can think of "pitch" as the frequency of the sound wave.
A (musical) note is essentially a name or label that we've assigned to a specific pitch. In contemporary Western music we describe a note by "key" or, more accurately, "pitch class" (like C, C#, D, D#, etc.) and by "octave" (an integer roughly in the range of 0 to 8, where for a given pitch class the frequency doubles with each octave).
In this context tone describes a number of different qualities or aspects of a sound, above and beyond the fundamental frequency or pitch, such as timbre, "color", or "warmth" (and arguably, things like loudness, resonance, and harmonic overtones). From a physics perspective, tone is influenced by the shape of the sound wave rather than just the frequency.
For example, we describe the sound generated by a guitar string, violin string, piano string, or speaker cone vibrating at ~262 Hz (cycles per second) as having the pitch C4 (middle C). It doesn't matter what kind of oscillator - string, reed, bell, vocal chord, speaker, etc. - is used to generate the sound. Anything vibrating at 262 Hz generates the pitch we call C4.
But for a given pitch, different oscillators will generate sounds with different tones. E.g. a guitar string, a xylophone bar, and violin string will generate distinct sounds, even if they are all vibrating at 262 Hz. For that matter, properties such as string, fretboard, and body materials, hole placement, body shape, etc. impact the tone of given class of instrument (like an acoustic guitar).
With this in mind, your third input ("Pickup Setting") is probably irrelevant for what you're trying to do. The pickups have a lot more to do with tone than with pitch, and the pickup configuration is just one of many factors that will influence tone. (Some other notable factors include string material, string wind, body material, guitar knobs and amp settings, not to mention finger vs. pick, plucking position and dynamics, etc.)
That said, the rest of what you are trying to do is straightforward:
Note that your first input (the tuning) is slightly underspecified. You've listed the pitch class for each string, but not the octave. If you want to compute the exact pitch for a given string+fret position you'll need to take into account the octave as well as the pitch class. Specifically the conventional EADG bass tuning, including octaves, is E1, A1, D2, G2. (But if the pitch class or key is sufficient for your purposes you can just ignore the octave numbers.)
Each fret on the guitar or bass represents one "semitone" or "half step" - the distance between two notes in the 12-note chromatic scale. I.e., if you make a list of all 12 notes (including sharps/flats) - as in C, C#, D, D#, E, F, F#, G, G#, A, A#, B - then moving up one fret will move up one note in that list (wrapping around and incrementing the octave number when you reach the end). For example, if the open string is tuned to E1 then the 1st fret yields F1, the 2nd fret yields F#1, the 3rd fret yields G1, etc. (Note that by convention the octave number changes when you go from B to C. I.e., after B1 comes C2.)
If the named note is all you're looking for then that would be sufficient. If you want to get to an actual frequency for a given named note (pitch-class + octave) there are formulas for doing that. Specifically the frequency of the note N
half-steps away from A4 (440 Hz) is given by 440 Hz * (2^(1/12))^N
. E.g., C4 is -9
half-steps from A4 (9 half-steps before A4), so the frequency of C4 is given by 440 * (2^(1/12))^(-9) ≈ 440 * 1.05946^(-9) ≈ 440 * 0.594604 ≈ 261.6 Hz
. But there's only ~130 notes to be concerned with in practice, so you may just want to consult a lookup table rather than computing each frequency on the fly.
You may want to spend some time reviewing a fretboard reference chart like this one for your EADG bass tuning case to get a better sense of how the fretboard "math" works out and how the notes are laid out by fret and string. Basically moving up or down one fret on a guitar or bass fretboard is like moving up or down one key on a piano keyboard (if you ignore the difference between the black and white keys).
Upvotes: 0