I've written a tool that generates and plays an infinite stream of music. Currently by riffing on Satie's Gnossiennes 1. It's fun! https://github.com/apiarian/twisted_music/blob/master/infinite_gnossiennes_1.py (inspired by Mouse Reeve's Infinite Gnossienne https://github.com/mouse-reeve/infinite_gnossienne ).
It works pretty well, but it only works while the screen is on or the app is on at least a part of my screen on my iPad. I've got a context manager which prevents device sleep with the
console.set_idle_timer_disabled function, but it would be really nice to just let this run in the background.
Since this is a musical use-case, is there a way to convince iOS to let it run in the background with the screen off indefinitely?
The app currently works by taking an infinite generator (doesn't have to be infinite, but in this case it is) of sound description objects, chunking them up and building temporary WAV files, and playing them with the appropriate delays, one after the other (sometimes overlapping slightly as necessary) using the
sound.play_effect function. Since it is an infinite stream, I can't just ask Pythonista to play an infinitely long file.