sonic-pi-net / sonic-pi

Code. Music. Live.
https://sonic-pi.net
Other
10.86k stars 924 forks source link

Possibility of an iOS version #2194

Open NathanMEvans opened 4 years ago

NathanMEvans commented 4 years ago

In HOW-TO-CONTRIBUTE.md you say

It's not possible to build Sonic Pi for iOS, since Apple does not allow integrating a programming language into iOS apps.

however on checking apple's documentation https://developer.apple.com/app-store/review/guidelines/ they say

Apps should be self-contained in their bundles, and may not read or write data outside the designated container area, nor may they download, install, or execute code which introduces or changes features or functionality of the app, including other apps. Educational apps designed to teach, develop, or allow students to test executable code may, in limited circumstances, download code provided that such code is not used for other purposes. Such apps must make the source code provided by the Application completely viewable and editable by the user.

and I think that sonic pi would be covered by the educational apps exception.

samaaron commented 4 years ago

That's useful to know.

Still, the larger issue is that of resources. Currently I have very limited resources and have to use them wisely. So little that it's been 2 years since the last release of Sonic Pi for Mac and Windows (I'm working hard to remedy that). Porting to a whole new platform represents a huge amount of work which I currently can't even contemplate.

NathanMEvans commented 4 years ago

I was actually wondering if it was worthwhile for me to attempt to create Sonic Pi for iOS myself. I've been working as an iOS developer for a few years and been looking for a project to attempt in my spare time (and would love to be able to play with Sonic Pi on my iPad).

samaaron commented 4 years ago

Oh, well any attempt in that direction would be massively appreciated! I would be happy to support you in any way I could.

xavriley commented 4 years ago

I just wanted to add some thoughts on this. Like Sam said, this seems like it would be a lot of work but it does seem like a cool idea and it might be possible.

In terms of the major moving parts, the following components are all (theoretically) supported on iOS

These are some that I'm less sure about

An alternative would be to reimplement some or all of that code using something like Opal (Ruby -> Javascript transpiler) but again there are differences and the biggest one is not having threads! (which Sonic Pi uses heavily)

I've thought about the Javascript implementation in the past (as you could use WebAudio and have everything be self contained) but I've not been able to solve the threading issue and haven't had the time to investigate other options.

Another alternative would be to implement the client code as an iOS app and then we could edit the main app to (optionally) expose a server and stream the audio somehow. That seems a bit more tractable to me and you'd still get to play with things on your iPad at least.

peterkos commented 4 years ago

Just to throw an alternative to SuperCollider in here, AudioKit has some very flexible APIs. Might be easier to create an initial version, although it does remove parity from the desktop apps by not using SuperCollider.

You mention Qt, but there might be a strong benefit in doing everything natively (with Storyboards, or just going straight to SwiftUI). The iOS version of SonicPi could be more like the Swift Playgrounds app -- and use more intuitive input controls that are really optimized for coding on iOS (or rather, iPadOS as Apple calls it now!)

Edit: Although, a native rewrite would be less of a port and more of a spiritual successor.