Python bindings to the Csound API, supporting all versions of csound higher or equal to 6.18, including csound 7
Project description
Python bindings for Csound (fork of ctcsound)
These bindings can be used with any version of csound >= 6.18. Csound 7 is explicitely supported.
Installation
Csound needs to be installed in the system.
pip install libcsound
Quick Start
Rendering in real-time using a render thread
import libcsound
csound = libcsound.Csound()
csound.setOption('-odac')
csound.compileOrc(r'''
sr = 44100 ; Modify to fit your system
ksmps = 64
nchnls = 2
0dbfs = 1
instr 1
kchan init -1
kchan = (kchan + metro:k(1)) % nchnls
if changed:k(kchan) == 1 then
println "Channel: %d", kchan + 1
endif
asig = pinker() * 0.2
outch kchan + 1, asig
endin
''')
csound.start()
thread = csound.performanceThread()
thread.play()
# Schedule an instance of instr 1 for 10 seconds
thread.scoreEvent(0, "i", [1, 0, 10])
input("Press any key to stop...\n")
thread.stop()
Render offline
import libcsound
csound = libcsound.Csound()
csound.setOption('-ooutfile.wav')
csound.compileOrc(r'''
sr = 44100
ksmps = 64
nchnls = 2
0dbfs = 1
instr 1
kchan init -1
kchan = (kchan + metro:k(1)) % nchnls
if changed:k(kchan) == 1 then
println "Channel: %d", kchan + 1
endif
asig = pinker() * 0.2
outch kchan + 1, asig
endin
''')
csound.start()
csound.scoreEvent("i", [1, 0, 10])
csound.setEndMarker(10)
# Perform until the end of the score
while not csound.performKsmps():
pass
Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
libcsound-0.13.1.tar.gz
(1.3 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
libcsound-0.13.1-py3-none-any.whl
(180.6 kB
view details)
File details
Details for the file libcsound-0.13.1.tar.gz.
File metadata
- Download URL: libcsound-0.13.1.tar.gz
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0040f890abaa99b1a1ed43cce770ff639c5b42fe1b102be3e17d12f39cef95a0
|
|
| MD5 |
13646160d4b9acf5cb727329e2d23385
|
|
| BLAKE2b-256 |
3eb3c389367ccabb05fbbc445ff776785e572075682a0226b4ff6524fd158328
|
File details
Details for the file libcsound-0.13.1-py3-none-any.whl.
File metadata
- Download URL: libcsound-0.13.1-py3-none-any.whl
- Upload date:
- Size: 180.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbceeca1cec48c550b5ed38613fb09afca773e898baa3424a8e7dfa3f9bbe694
|
|
| MD5 |
88b3dc79de61ffd899da5c0d5687f7ef
|
|
| BLAKE2b-256 |
7c7079a4b5b50f516c88c28fa9c7ffd5be78a8d24d56d79ad8c11f77011c0c65
|