yam655 / bittyband

An experimental musical instrument/tool
GNU General Public License v3.0
2 stars 0 forks source link

better single-note looping #43

Open yam655 opened 7 years ago

yam655 commented 7 years ago

We're using pyglet to handle the media, and it doesn't naturally support A to B looping. We'd get better latency if it was all in-ram, and while pyglet supports in-memory media, our use-case consists of 20 minute or longer audio files and that's not going to be feasible.

In pyglet, the StaticSource needs to be called with a normal Source object. It should be possible to wrap a normal pyglet object to fake that the 20 minute file is only the subsecond length of the note. This would allow you to treat a note-length segment as an in-memory object.

While we might not need to even use StaticSource this way, if our wrapping class adds overhead or doesn't properly wrap everything, it wouldn't matter if we were only using the wrapper for the length of time it takes to create the StaticSource. (Accurate wrapping only needs to be done on the things called in the constructor. If it works once, it should always work.)