This is a re-implementation of Robotron: 2084's sound wave generator function.
The following values are inputs for the function. b1-b7 are byte values (8 bits), u1 is a short (16 bits)
Github Repo
Adapated by spacejack from this source.