Designing a generative music system for iOS, using OpenFrameworks, I'd need to provide a mode in which the user could listen the music produced by the application when:
Some applications like BLOOM, or alarm clock, works like that and propose to users a switch to enable/disable this feature.
Any tips for that ?
Playing Background Audio
An app that plays or records audio continuously (even while the app is running in the background) can register to perform those tasks in the background. You enable audio support from the Background modes section of the Capabilities tab in your Xcode project. (You can also enable this support by including the UIBackgroundModes key with the audio value in your app’s Info.plist file.) Apps that play audio content in the background must play audible content and not silence.
Apple reference "Playing and Recording Background Audio"
Ensuring That Audio Continues When the Screen Locks
For enabling/disabling this feature I found Activating and Deactivating Your Audio Session, I haven't tried it myself, but it looks like what you need.