eam in which el is found.
If provided, el's offset
in that Stream is used.  Otherwise, the current offset in
el is used.  It is just
in case you are paranoid that el.offset might not be what
you want, because of some fancy manipulation of
el.activeSite

>>> n1 = note.Note('G#')
>>> n2 = note.Note('D#')
>>> s1 = stream.Stream()
>>> s1.insert(20.0, n1)
>>> s1.insert(21.0, n2)

>>> n3 = note.Note('C#')
>>> s2 = stream.Stream()
>>> s2.insert(20.0, n3)
>>> s1.playingWhenAttacked(n3)
<music21.note.Note G#>

>>> n3.setOffsetBySite(s2, 20.5)
>>> s1.playingWhenAttacked(n3)
<music21.note.Note G#>

>>> n3.setOffsetBySite(s2, 21.0)
>>> n3.offset
21.0
>>> s1.playingWhenAttacked(n3)
<music21.note.Note D#>

If there is more than one item at the same time in the other stream
then the first item matching the same class is returned, even if
another element has a closer offset.

>>> n3.setOffsetBySite(s2, 20.5)
>>> s1.insert(20.5, clef.BassClef())
>>> s1.playingWhenAttacked(n3)
<music21.note.Note G#>
>>> fc = clef.FClef()  # superclass of BassClef
>>> s2.insert(20.5, fc)
>>> s1.playingWhenAttacked(fc)
<music21.clef.BassClef>

But since clefs have zero duration, moving the FClef ever so slightly
will find the note instead

>>> fc.setOffsetBySite(s2, 20.6)
>>> s1.playingWhenAttacked(fc)
<music21.note.Note G#>


Optionally, specify the site to get the offset from:

>>> n3.setOffsetBySite(s2, 21.0)
>>> n3.setOffsetBySite(None, 100)
>>> n3.activeSite = None
>>> s1.playingWhenAttacked(n3) is None
True
>>> s1.playingWhenAttacked(n3, s2).name
'D#'
NFİ