If I play a perfect fifth on the piano using C4 and G4 they sound consonant. And If I start on C4 and play out the harmonic series in order I wont come across the note G4 but only the G5 an octave higher up. So whats the connection to the harmonic series and why does those two notes sound consonant? I was also wondering why there is so many fraction describing intervals in music when according to the harmonic series simple ratios are meant to sound better?
If I play a perfect fifth on the piano using C4 and G4 they sound consonant.
And If I start on C4 and play out the harmonic series in order I wont come across the note G4 but only the G5 an octave higher up.
So whats the connection to the harmonic series and why does those two notes sound consonant?
Let's forget we're talking about the piano for a moment, and imagine we're playing an instrument that only outputs the fundamental frequency - a sine wave, with no extra harmonics.
If you played a C4 and G4 with this 'sine' instrument, they'd STILL sound consonant - even though there are no harmonics! The notes sound consonant because C4 and G4 have a simple frequency ratio relationship, of 2:3.
So you can still have harmony without harmonics.
If you have notes with more complex timbres (such as with a piano), then you have to look at the way that each of the harmonics in one note interacts with each of the harmonics in the other. Often, there will be some clashes (complex ratios), and some simple ratios. Considered all together, this will give you the degree of consonance of two notes.
However, not all instruments' sounds have harmonics that follow the harmonic series. Some instruments have harmonics 'missing', while others have partials that are not in the harmonic series. These things will also affect how harmonies work with different instruments.
I was also wondering why there is so many fraction describing intervals in music when according to the harmonic series simple ratios are meant to sound better?
To modern ears, it's not true that simple ratios sound 'better'. They sound more consonant, but if you only have consonant sounds, many people would think that tends to make the music sound very boring. Typically, a piece of music takes the listener on a journey through different consonances and dissonances to keep the music interesting.
A good place to start if you want to study how the harmonic series can be used to choose which pitches should be found in scales is the idea of limits in music:
Harry Partch, Ivor Darreg, and Ralph David Hill are among the many microtonalists to suggest that music has been slowly evolving to employ higher and higher harmonics in its constructs (see emancipation of the dissonance). In medieval music, only chords made of octaves and perfect fifths (involving relationships among the first three harmonics) were considered consonant. In the West, triadic harmony arose (Contenance Angloise) around the time of the Renaissance, and triads quickly became the fundamental building blocks of Western music. The major and minor thirds of these triads invoke relationships among the first five harmonics.
So - while there is a connection between the harmonic series, the idea of consonance and dissonance, it's not as direct as you suggest in your question - we don't have to directly choose notes corresponding to pitches in the harmonic series to make consonant intervals.