Csound Magazine Summer 1999
Columns

Beginners

Synthesis

Processing

Real-Time

Features

AXCsound

Composing

Ecological Modeling

Departments

Links

Editorial

Contribute

Back Issues

Using Midi Sequencers with Csound

Hans Mikelson

hljmm@werewolf.net

fofrt.orc fofrt.sco csm.bat

Problems in real-time

Playing Csound in real-time presents some problems. No matter how much you adjust the buffers, you always seem to get some glitches. It would be nice if you could play your instrument using a midi keyboard and capture the midi data on your sequencer. After editing the midi sequence you could use it to render a high quality audio file with Csound. Unfortunately most device drivers only allow one program to be connected to them at a time. Hubi's loopback device solves this problem by creating virtual midi ports.

Platform Dependence

This article is probably only useful to people using an MS Windows based computer. I am using a 300 MHz Dell Pentium II computer running Windows 95 with a Soundblaster AWE64 basic sound card. The midi keyboard is an Alesis QS+. The version of Csound used is Gabriel Maldonado's excellent DirectCsound version 3.511.

The sequencer used is Powertracks Pro 3.5e. I have heard people mention that some more powerful sequencers use too many system resources to allow adequate capture of a Csound midi performance. It may be possible to use some other freeware or shareware midi sequencer as long as it is capable of saving midi files in type 0 format.

Finally the key to getting real-time Csound working with a midi sequencer is Hubi's loopback device or some similar software.

Step by Step

The first step is to turn off full-duplex mode on the Soundblaster card. If I do not turn off full-duplex mode the sound produced by Csound and most other software synthesizers is extremely choppy. Many games require full-duplex on so it is best to leave it on when not using software synthesizers. To turn off full duplex mode do the following:

Start --> Settings --> control pannel --> System --> Device Manager -->Sound Video and Game Controllers --> Creative AWE64 16-bit Audio --> Properties --> Settings --> Uncheck Allow Full-duplex operation. You may have to restart the computer.

The next step is to get a copy of Hubi's loopback device. Hubi's loopback device is available from the following web site:

http://members.telecom.at/~hubwin/midi.html

This essentially creates four virtual midi ports.

I am using version 2.51. Read the file Midlpbk.txt for installation information. The loopback device must be installed as a device. Here is a quote from the installation notes.

"Windows 95: Start->Settings->ControlPanel->Hardware Continue-> [No] ->Continue -> [ Audio/Video/Game Controller ] ->Continue ->Diskette -> [ enter the unzipped directory (c:\tmp) ] ... Then you will see a list with "Hubi's Loopback v250", select this, some ok and restart Windows when asked about it."

On my sequencer options I choose my sound card's midi in port for input and LB1 for output. When running DirectCsound I choose the LB1 midi port. Choose an orchestra and score pair suitable for real-time performance. Run Csound with the orc/sco pair. Start recording on the midi sequencer. You should now be able to play the keyboard and hear the sound as well as record the midi data on the sequencer. You can then edit your midi sequence and save it as a type 0 midi file. Finally render the sound using Csound with the midi file for input. The -F flag is used to specify midi file input. Since the sequencer is connected in series with Csound you can also play back your sequence from your sequencer using Csound as output.

Wrap up

You should now be set up for using Csound with a midi sequencer. This is nice for playing with sounds that are not available on any commercial synthesizer. It may be a good idea to create both a simple and a complex version of the instrument. Use the simple version when recording in real-time and use the complex instrument for the final render. I would like to thank Michel Jullian for suggesting some corrections on my midi setup.