Notes joined by a beam usually have all the stems pointing in the same direction (up or down). The average pitch of the notes is used to determine the direction – if the average pitch is below the middle staff-line, the stems and beams usually go above the notehead, otherwise they go below.
