Session: Interactive experiments in sound synthesis with Nsound, numpy and matplotlib

Tags:
, , , ,
Location:
A03/A04
Duration:
July 25, 2014 10:00 - 13:00
Language:
English
Target-audience:
Advanced

This training intends to teach how to experiment with generating sounds and digital signals in an interactive programming and exploration environment provided by IPython, matplotlib and the Nsound package.

Participants will learn how to generate various waveforms, tones and noises and explore these by listening and easy plotting of various diagrams, all using simple Python code.

After a brief introduction to the theoretical foundations, the training is divided in several practice sections, each approx. 15-20 min. long. In these, a short demonstration of the programming tools for the topic is followed by examples and hands-on excercises for the participants to implement.

Overview

This training intends to teach how to experiment with generating sounds and digital signals in an interactive programming and exploration environment provided by IPython, matplotlib and the Nsound package.

Participants will learn how to generate various waveforms, tones and noises and explore these by listening and easy plotting of various diagrams, all using simple Python code.

Topics

  • Sound sampling, digital signals and processing
  • Generating and plotting waveforms
  • Loading WAV files
  • Adding sine waves and combining waveforms
  • Producing audio output and WAV files
  • Frequency spectrum diagrams
  • Analyzing harmonic content
  • Mixing Signals
  • Filters
  • Modulation: envelopes, low frequency oscillators (LFOs), and filter modulation
  • Subtractive synthesis structure

Preparation

Participants should bring a laptop with Linux (preferred), Windows, or OS X and good headphones. An external audio interface may help with audio performance but is not essential.

I have provided a virtual machine for virtualbox with a Manjaro Linux installation, which provides all the necessary software already installed and ready to go in a Python virtual environment. You can download it and find instructions on my blog.

Alternatively, install the following prerequisite software:

  • A C/C++ compiler (under debian-like systems, install the 'build-essential' package)
  • Python* (2.7)
  • setuptools (2.x)
  • virtualenv (>= 1.10)
  • Scons (2.3.0)
  • SWIG
  • portaudio*

Any or all of:

  • pygtk* (2.24)
  • pyqt4*
  • pyqt5*
  • wxpython* (3.0)

* including development headers

Create a virtual environment with Python 2.7 and install the following Python packages and their dependencies:

  • Cython (0.20)
  • IPython (1.1.x)
  • matplotlib (1.3.x)
  • numpy (1.8.x)
  • Nsound (0.9.0)

All these, except Nsound, may be installed from PyPI via pip. For Nsound, download the distribution package from its website and follow the installation instructions in the user's guide.

Schedule

  1. A very short introduction to the basic principles of sound sampling, digital signals and sound synthesis (30 min. lecture)

  2. Exploring the programming environment (20 min., participants follow trainer)

    (Running IPython/pylab, verifying the matplotlib, Nsound and audio setup with provided example scripts, first experiments)

  3. Generating and plotting waveforms (15 min. with excercises)

  4. Combining signals and generating complex sound files (15 min. with excercises)

  5. Plotting frequency spectrum diagrams and analyzing harmonic content (10. min)

  6. Modulating sound with envelopes and LFOs (20 min. with excercises)

  7. Filtering audio by using and combining different filter types (20 min. with excercises)

  8. Putting the pieces together: building a processing chain for subtractive synthesis (20 min., participants follow trainer)

  9. Participants work in groups on one of the following projects (30. min):

    • Generating Sci-Fi sound effects
    • Implementing delays and modulation effects
    • Sequencing sound clips

    For each project a handout with goals, hints and helpful code fragments is provided.

A coffee break is planned for after item 5.