Working with Csound in Python...
Project description
PyCsound
A package to run Csound from python.
pip install pycsound
from pycsound import PyCsound
import random
cs = PyCsound()
cs.option = "-o dac"
cs.header = {"sr": 44100, "kr": 44100, "nchnls": 2, "0dbfs": 1}
cs.orc = """
instr 1
a1 = poscil(p4 * expseg:k(.001, .01, 1, p3 - .01, .001), p5)
outs(a1, a1)
endin
"""
atk, dur = 0, 0
for i in range(10):
atk += random.uniform(0, 3)
dur = random.uniform(0, 5)
score = cs.add_score_statement(statement="i", params=[1, atk, dur, 0.5, 110 * (i + 1)])
cs.add_to_score(statement="f", params=[1, 0, 4096, 10, 1])
cs.add_to_score(statement="t", params=[0, 240])
cs.compile()
cs.run()
It is also possible to run csound file: .orc, .sco
cs.orc = "path_to_file.orc"
cs.sco = "path_to_file.sco"
or
cs.run("path_to_file.orc", "path_to_file.sco")
or
cs.run("path_to_file.csd")
For save generated file:
cs.save_csound_file(mode="csd", name="file_generated.csd", path="path_to_save_the_file_generated")
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
PyCsound-1.1.0.tar.gz
(5.4 kB
view details)
Built Distribution
File details
Details for the file PyCsound-1.1.0.tar.gz
.
File metadata
- Download URL: PyCsound-1.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e53d311992519f54d8b3126b33a1b52e12d07abb75767adb24b46f07524a36e3 |
|
MD5 | 371dcd0a8f4c5e46157d8c545b226283 |
|
BLAKE2b-256 | 61a722a54fc5b9b1268a16b372fadc82ab9d19d0ee79a30a1136c97e61ab2234 |
File details
Details for the file PyCsound-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: PyCsound-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06827edc4d1efdf8f298f8364f14db18e9db9fd5fa157c294d0fb1961a0b3300 |
|
MD5 | 5ee615b31eab656a88a3eefc0392a83d |
|
BLAKE2b-256 | 756f5aa4c5a16dfbf303927bffee8571b102975e4ded8b30fac802a6b5c75aee |