Algorithms for implementing MIDI pitch bend messages

Are there some common algorithms for implementing MIDI pitch bend for single notes and multi voices (e.g. chords). I am implementing this in kind of an intuitive way, but I would really like to know if I am not totally off-track! For single notes I currently I am sending a pitch bend message to the channel, just before the note on message, and resetting the pitch bend by sending it the center value of 2^13, right after the note off message has been sent to keep the channel clean for the next coming note!
I am specially interested in how to deal with channels for implementing the pitch bends.
Any help or hint to appropriate readings is highly appreciated.

PS: here is how I have implemented pitch bend for a single note (github.com/teymuri/cu/blob/main/mid.py#L61)

Read more here: Source link