Update: I've updated this for clarity and with some context regarding how I interpret this passage, but my fundamental question remains the same. I really hope someone could help me parse out this passage fully in modal/jazz theory.
See the melody notated below and which can be listened to here starting at 0:10 . I really want to be able to write like this and would like to analyze it in terms of modes and/or jazz theory. Why Jazz theory, you may wonder? I personally don't see classical theory being very instructional here at all, for the primary reason being that the passage never includes a direct tonic-dominant relationship (in terms of triadic harmony). If we read the passage in B, the dominant chord would be F# Major, which only appears (briefly) in the first half of bar 4 with the A# in the melody. But this chord never resolves to the tonic, B. Instead, at the end of the bar we get a resolute feeling simply as the melody comes back down to F#. If we read the passage in F#, the same problem arises. The only place we get a leading tone in the key of F# is in the first bar (the E# in the melody), and it's not a part of any dominant (or C# Major) triad. If you listen to the audio, you'll realize that after this melody it repeats and then simply jumps to a different tonality, where it repeats in that tonality. Thus, I personally can't see any way classical theory is equipped to describe the tonic-dominant relationship of this passage. Yet, somehow it feels like it is a complete phrase with a tonic-dominant relationship in there somewhere.
I can see that Bar 1 is F# Ionian, then it becomes F# Mixolydian in Bar 2, and eventually back to Ionian in Bar 4, but it was my hope that someone (maybe someone with experience playing Jazz music?) could help me parse further what's going on in Bars 2 and 3, rather than just blanketing them with the "Mixolydian" mode. But perhaps that's the extent to which Jazz theory can analyze the passage. I simply don't know.