UPDATE: Check out our guides on Authentication and Sharing Sounds for the most recent information.
If you build an app or web service that generates any type of sound, it’s easy to connect it to SoundCloud and enable your users to share their creations across the web. Allowing users to share what they create to their existing social networks and the SoundCloud community brings great value in a variety of use cases. If you have an app for beat making, you can let your users post their creations to a dedicated group on SoundCloud. For aspiring music makers, it’s valuable and fun to get feedback from friends on Facebook. And for someone recording an interview with their phone, it’s super handy to be able to post the audio directly to a blog. In addition, a sharing feature is obviously practical for sending files to collaborators or moving audio between devices.
Letting users share tracks is also a great way of virally promoting your app. Uploaded tracks will automatically be tagged as uploaded with [your app], so when a user shares a track on Facebook, their friends will see what app the track was created with.
Some examples of apps using SoundCloud for sharing:
You’ll find more examples in our App Gallery.
Authentication
To be able to upload tracks, the user must connect the app to their SoundCloud account. For this connection, we use OAuth; “An open protocol to allow secure API authorization in a simple and standard method from desktop and web applications.”
The idea behind OAuth is to make it possible for the user to hand out a “key” to their account, without giving away their email and password to the third-party app. In our case, an app with a key can access the user’s tracks, delete tracks, upload new tracks, make comments on tracks, see who the user is following, etc. In other words, the key gives full access to the user’s account, except the email address, credit card information, and other sensitive data.
This is how the connection flow looks for the user…
The app can store the key so that the user doesn’t have to log in the next time they want to upload a track. The key will work until the user revokes the access in their SoundCloud account settings.
To try the connection flow, check out the following apps: Connect with SoundCloud demo on the web SoundCloud for iPhone SoundCloud for Android
To implement Connect with SoundCloud: Read the API documentation about authentication with OAuth 2.0 See if there’s an SDK for your framework which will simplify the implementation
Uploading Audio
Once the app is connected you can upload with a POST request to /tracks. The only meta data required when uploading an audio file is the track title. You can specify other meta data as well, or edit the data once the track is uploaded. If you don’t set the track to public, it is set to private by default. When the file upload is finished, you get back a track object including the track id and URL. Once you have the track ID, you can read and access all the meta data. The full list of meta data is available here.
Sharing a Track on SoundCloud
Tracks can be shared to other SoundCloud users. You can either share to specific users by id or to email addresses. If the email address is not yet registered with SoundCloud, they will receive an email invitation to the track.
Sharing to Social Networks
An uploaded track can also be shared to Facebook, Twitter, MySpace and Foursquare. Instead of connecting your app to the different networks, we handle the connections and share the track once it’s uploaded and finished processing. Users can enable automatic sharing of new tracks to social networks in their SoundCloud settings. If you want, you can make these options available in the app as well.
This is how the sharing screen looks in our iPhone app:
For Cocoa apps, there is a specific guide here.
If you have further questions about how your app can be integrated with SoundCloud, please contact api@soundcloud.com and we’re happy to help.