
Joe F. answered 01/09/21
Patient and Knowledgeable Music Theory Instructor
Instead of "accidental notes" you mean to say "non-diatonic notes", meaning notes that are not native to the key you are in. These will usually be indicated by using accidentals: sharps, flats or natural signs. Non-diatonic notes occur for different reasons. You could have a chromatic passing tone in a melody, for example: C, C#, D. Or, you could have a temporary non-diatonic harmonization, for example a D major chord in the key of C major would require the introduction of an F#. Find a few pieces of printed music and study them, you will find examples. Find music in the key of C and scan the score visually for any sharps or flats. Then listen to what is happening in those moments. This should help you more than anything to understand the function of non-diatonic notes.