If you are playing along with another instrument, it is essential that your guitar be in tune with that instrument. Tune the open strings of your guitar to the corresponding notes of the accompanying instrument.
For example, To tune to a piano, tune the open 6th string to the E note on the piano, as shown on the keyboard diagram. Then tune your guitar to itself from this note using the method outlined previously, or tune each string of your guitar to those notes of the piano shown on the keyboard diagram.