ICAD 2013 Python SonificationWorkshop

[under development]

Thought for the day: "Your train of thought is sacred."
(courtesy of A. Raskin, via Carlos Córdoba)

Preliminary remarks

The aim of this introductory workshop is to introduce you to one of the most powerful, open-ended, and extensible set of tools currently available for software sonification: Python.

Python is a popular, easily learnt general-purpose programming language that can serve as a glue language to connect together many separate small and large scale software components (modules) in a simple and flexible manner.

It can also be used as a high-level modular framework for "encapsulating" and controlling low-level operations using subroutine libraries. These libraries are typically implemented in a compiled languages (such as C++).

Python can also be "embedded" as a high-level script control language for low-level, less user-friendly, software and hardware-interface control languages.

Why use Python for Sonification?

Because it is powerful, flexible and open-ended, Python is not the quickest approach to learn for those just wanting to sonify a small amount of data using standard conceptual frameworks. At least, not if you're satisfied with the tools currently available to do this. But if you have more exacting needs, the extra time needed for you to configure a solution in Python will not only pay dividends, but allow you to do things that, realistically, can't be achieved with other approaches.

If you want to explore some of the pragmatic and practical reasons why I've chosen to go down the path of developing my sonification work in Python, there are a couple of a papers I wrote about it in 2007. ICAD2007 and ICoMC 2007.

This Workshop

This Workshop is an introduction to Python and Python-related projects that are useful when you're trying to sonify complex data or data that needs to be manipulated in unusual ways. It may be extremely multivariate, exist or need to be organised in large databases, or consist of real-time data streams for which you need to develop filters.

This workshop is not a 'quick-and-dirty', 'wizz-bang' series demos that impresses you but leaves you with unable to make use of it in your own work. While Python itself is quick-to-learn, and the number of projects using it is very large, the flexibility it affords, means it is better to start with a VERY limited subset of the options.

The aims of this workshop then, are

Getting Started, but not too quickly

(If you want to experience the joys of getting your hands dirty by building it yourself 'doing it yourself', jump to the Downloading Python section, below.)

Other sound-related projects that use Python

Two questions one needs to ask before deciding on which tools to use in any project, are

One comforting thought, is that there are a large number of sound-related projects that use python.

So, if you're concerned about any of the issues raised, above, be assured there are plenty of people working with these tools - and building new ones! So, momentum being what it is obsolescence should not be concern you in the foreseable future. Here a list of well-know sound and music related python projects.

Using Python for Science

Over the last decade or so science communities have taken to python like a duck to water. The most widely used set of generic tools are available from SciPy.org whose Introduction happens to not be on the home page, because most people going there know what the want (to download). Particularly ubiquitous are

There is also an organisation devoted to developing software suitable for psychology research:

More recently the development in science communities has been on providing Interactive Development Environments (see below) suitable for scientific enquiry.

Summary

The are a lot of (freely available) tools for scientific and technical work in Python; Graphics (eg matplotlib) and image (such as the Python Image Library (PIL) are advanced.

Work with Sound Python lags these, and to overgeneralise a bit, remains more low level. There is, though, some sophisticated tools (such as Csound's python wrappers) available. But we are getting there. More later...

Learning Python

Gentle online introductions to python (in no particular order):

Some (free) eBooks

Python Syntax and Semantics

Getting up and running

Basic: Downloading Python

Go to the 'official' home of Python, www.python.org, and download version 2.7.5 that best fits your machine and operating system. Typically they will be:

Interactive Development Environments

Making Sound with Python

PyAudio

From the PyAudio website: "PyAudio provides Python bindings for PortAudio, the cross-platform audio I/O library. With PyAudio, you can easily use Python to play and record audio on a variety of platforms. "

Typically, as for many of the tools available for Python and Audio, there are packaged versions available for installation. See

  1. Create an audio file using pure Python and a data set
  2. Build a basic set of synthesis tools using an external library
The pyo examples