Skip to main content

ctcsound7

Python bindings for Csound

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 ctcsound7

Quick Start

Rendering in real-time using a render thread

import ctcsound7 as ct
csound = ct.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 ctcsound7 as ct
csound = ct.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

Metadata

Release files for ctcsound7 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ctcsound7 0.8.0
File Size Uploaded Provenance Actions
ctcsound7-0.8.0.tar.gz 96.2 kB Without provenance Details for ctcsound7-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ctcsound7 0.8.0
File Interpreter ABI Platform Actions
ctcsound7-0.8.0-py3-none-any.whl Python 3 none any Details for ctcsound7-0.8.0-py3-none-any.whl

Total release size: 171.4 kB

Release files / ctcsound7-0.8.0.tar.gz

Download URL ctcsound7-0.8.0.tar.gz
Size 96.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b04a1f67e05a943084d169ff3a51581458cbf7fdc8445434c2e3992676e1bc04
BLAKE2b-256 checksum
How to use checksums
e2408043a80e40f87ee7a2d65de87c25c67681bfcb9e7a78192a34101a8244a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.7

Release files / ctcsound7-0.8.0-py3-none-any.whl

Download URL ctcsound7-0.8.0-py3-none-any.whl
Size 75.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a1300a8a044986d87232fbe06e3dc861f59b143b465e2a1b7445ec577544ad0
BLAKE2b-256 checksum
How to use checksums
37a985d6e2549de75e2c984f64d50c82eb869a0c708857d22cb3f7bd84fc6867
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.7

Security for ctcsound7 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page