A Python wrapper around the Soundcloud API

Overview

soundcloud-python

A friendly wrapper around the Soundcloud API.

Installation

To install soundcloud-python, simply:

pip install soundcloud

Or if you're not hip to the pip:

easy_install soundcloud

Basic Use

To use soundcloud-python, you must first create a Client instance, passing at a minimum the client id you obtained when you registered your app:

import soundcloud

client = soundcloud.Client(client_id=YOUR_CLIENT_ID)

The client instance can then be used to fetch or modify resources:

tracks = client.get('/tracks', limit=10)
for track in tracks.collection:
    print track.title
app = client.get('/apps/124')
print app.permalink_url

Authentication

All OAuth2 authorization flows supported by the Soundcloud API are available in soundcloud-python. If you only need read-only access to public resources, simply provide a client id when creating a Client instance:

import soundcloud

client = soundcloud.Client(client_id=YOUR_CLIENT_ID)
track = client.get('/tracks/30709985')
print track.title

If however, you need to access private resources or modify a resource, you will need to have a user delegate access to your application. To do this, you can use one of the following OAuth2 authorization flows.

Authorization Code Flow

The Authorization Code Flow involves redirecting the user to soundcloud.com where they will log in and grant access to your application:

import soundcloud

client = soundcloud.Client(
    client_id=YOUR_CLIENT_ID,
    client_secret=YOUR_CLIENT_SECRET,
    redirect_uri='http://yourapp.com/callback'
)
redirect(client.authorize_url())

Note that redirect_uri must match the value you provided when you registered your application. After granting access, the user will be redirected to this uri, at which point your application can exchange the returned code for an access token:

access_token, expires, scope, refresh_token = client.exchange_token(
    code=request.args.get('code'))
render_text("Hi There, %s" % client.get('/me').username)

User Credentials Flow

The User Credentials Flow allows you to exchange a username and password for an access token. Be cautious about using this flow, it's not very kind to ask your users for their password, but may be necessary in some use cases:

import soundcloud

client = soundcloud.Client(
    client_id=YOUR_CLIENT_ID,
    client_secret=YOUR_CLIENT_SECRET,
    username='[email protected]',
    password='janespassword'
)
print client.get('/me').username

Examples

Resolve a track and print its id:

import soundcloud

client = soundcloud.Client(client_id=YOUR_CLIENT_ID)

track = client.get('/resolve', url='http://soundcloud.com/forss/flickermood')

print track.id

Upload a track:

import soundcloud

client = soundcloud.Client(access_token="a valid access token")

track = client.post('/tracks', track={
    'title': 'This is a sample track',
    'sharing': 'private',
    'asset_data': open('mytrack.mp4', 'rb')
})

print track.title

Start following a user:

import soundcloud

client = soundcloud.Client(access_token="a valid access token")
user_id_to_follow = 123
client.put('/me/followings/%d' % user_id_to_follow)

Update your profile description:

import soundcloud

client = soundcloud.Client(access_token="a valid access token")
client.put('/me', user={
    'description': "a new description"
})

Proxy Support

If you're behind a proxy, you can specify it when creating a client:

import soundcloud

proxies = {
    'http': 'example.com:8000'
}
client = soundcloud.Client(access_token="a valid access token",
                           proxies=proxies)

The proxies kwarg is a dictionary with protocols as keys and host:port as values.

Redirects

By default, 301 or 302 redirects will be followed for idempotent methods. There are certain cases where you may want to disable this, for example:

import soundcloud

client = soundcloud.Client(access_token="a valid access token")
track = client.get('/tracks/293/stream', allow_redirects=False)
print track.location

Will print a tracks streaming URL. If allow_redirects was omitted, a binary stream would be returned instead.

Running Tests

To run the tests, run:

$ pip install -r requirements.txt
$ nosetests --with-doctest
..................

Success!

Contributing

Contributions are awesome. You are most welcome to submit issues, or fork the repository.

soundcloud-python is published under a BSD License.

Owner
SoundCloud
SoundCloud
Any-to-any voice conversion using synthetic specific-speaker speeches as intermedium features

MediumVC MediumVC is an utterance-level method towards any-to-any VC. Before that, we propose SingleVC to perform A2O tasks(Xi → Ŷi) , Xi means utter

谷下雨 47 Dec 25, 2022
Jarvis From Basic to Advance - make a voice assistant similar to JARVIS (in iron man movie)

JARVIS (Basic to Advance) This was my attempt to make a voice assistant similar to JARVIS (in iron man movie) Let's be honest, it's not as intelligent

codesempai 17 Dec 25, 2022
?️ Open Source Audio Matching and Mastering

Matching + Mastering = ❤️ Matchering 2.0 is a novel Containerized Web Application and Python Library for audio matching and mastering. It follows a si

Sergey Grishakov 781 Jan 05, 2023
Implicit neural differentiable FM synthesizer

Implicit neural differentiable FM synthesizer The purpose of this project is to emulate arbitrary sounds with FM synthesis, where the parameters of th

Andreas Jansson 34 Nov 06, 2022
User-friendly Voice Cloning Application

Multi-Language-RTVC stands for Multi-Language Real Time Voice Cloning and is a Voice Cloning Tool capable of transfering speaker-specific audio featur

Sven Eschlbeck 19 Dec 30, 2022
MusicBrainz Picard

MusicBrainz Picard MusicBrainz Picard is a cross-platform (Linux/Mac OS X/Windows) application written in Python and is the official MusicBrainz tagge

MetaBrainz Foundation 3k Dec 31, 2022
A voice assistant which can handle your everyday task and allows you to book items from your favourite store!

Voicely Table of Contents About The Project Built With Getting Started Prerequisites Installation Usage Roadmap Contributing License Contact Acknowled

Awantika Nigam 2 Nov 17, 2021
A Python wrapper around the Soundcloud API

soundcloud-python A friendly wrapper around the Soundcloud API. Installation To install soundcloud-python, simply: pip install soundcloud Or if you'r

SoundCloud 84 Dec 31, 2022
An AI for Music Generation

An AI for Music Generation

Hao-Wen Dong 1.3k Dec 31, 2022
A library for augmenting annotated audio data

muda A library for Musical Data Augmentation. muda package implements annotation-aware musical data augmentation, as described in the muda paper. The

Brian McFee 214 Nov 22, 2022
This is an OverPowered Vc Music Player! Will work for you and play music in Voice Chatz

VcPlayer This is an OverPowered Vc Music Player! Will work for you and play music in Voice Chatz Telegram Voice-Chat Bot [PyTGCalls] ⇝ Requirements ⇜

1 Dec 20, 2021
Python Audio Analysis Library: Feature Extraction, Classification, Segmentation and Applications

A Python library for audio feature extraction, classification, segmentation and applications This doc contains general info. Click here for the comple

Theodoros Giannakopoulos 5.1k Jan 02, 2023
Vixtify - Python Controlled Music Player

Strumm Sound Playlist : Click me to listen Welcome to GitHub Pages You can use the editor on GitHub to maintain and preview the content for your websi

Vicky Kumar 2 Feb 03, 2022
Speech recognition module for Python, supporting several engines and APIs, online and offline.

SpeechRecognition Library for performing speech recognition, with support for several engines and APIs, online and offline. Speech recognition engine/

Anthony Zhang 6.7k Jan 08, 2023
Reading list for research topics in sound event detection

Sound event detection aims at processing the continuous acoustic signal and converting it into symbolic descriptions of the corresponding sound events present at the auditory scene.

Soham 64 Jan 05, 2023
Using python to generate a bat script of repetitive lines of code that differ in some way but can sort out a group of audio files according to their common names

Batch Sorting Using python to generate a bat script of repetitive lines of code that differ in some way but can sort out a group of audio files accord

David Mainoo 1 Oct 29, 2021
A voice assistant which can be used to interact with your computer and controls your pc operations

Introduction 👨‍💻 It is a voice assistant which can be used to interact with your computer and also you have been seeing it in Iron man movies, but t

Sujith 84 Dec 22, 2022
An audio-solving python funcaptcha solving module

funcapsolver funcapsolver is a funcaptcha audio-solving module, which allows captchas to be interacted with and solved with the use of google's speech

Acier 8 Nov 21, 2022
[Singing Log] Let your program learn to sing!

[Singing Log] Let your program learn to sing! You must have thought this was changelog when you saw the English title, but it's not, it's chànggēlog. What it does is allow your program to print logs

黄巍 22 Sep 03, 2022
Omniscient Mozart, being able to transcribe everything in the music, including vocal, drum, chord, beat, instruments, and more.

OMNIZART Omnizart is a Python library that aims for democratizing automatic music transcription. Given polyphonic music, it is able to transcribe pitc

MCTLab 1.3k Jan 08, 2023