sonify.net.au

 







introduction

installing

importing

help()

csd perform

(under construction)

Introduction to using csnd: the Python wrapper for csound

Playing csd files from Python

If a .csd file contains no csound options, options will be read from the .csoundrc file in the user's home directory. On OSX machines, turning  off the external graphics calls (the csound command-line -d option), or using the ascii graphics (the csound command-line -g option), helps the process run more smoothly.

1. Playing and existing csd file using the Csound class.

This compiles and performs the .csd file in one pass.

import csnd
cs = csnd.Csound()   # create an instance of Csound class
fname = "test1.csd"  # the filename, use full path if necessary
cs.Perform(fname)

2. Play all .csd files in a directory, one at a time.

from glob import glob
import csnd
ipDir="/Users/drw/csoundfiles/"  # use your directory
fileList = glob(ipDir+"*.csd")   # a list of all files in ipDir
                                 # which have a .csd extension.
cs = csnd.Csound()          # create an instance of Csound class
for f in fileList:          # perform each file serially
    cs.Perform(f)

3. Create, compile and play a csd file to a .wav file (in non-real-time)

(to be continued)


- - - F I N - - -

check out SoniPy
our public domain data sonification software framework on Sourceforge

contact: sonify  'at' avatar.com.au                          last updated: 2007.11.03







tested on:

OSX with
Python 2.4