DirectCsound FAQ

by Gabriel Maldonado
g.maldonado@agora.stm.it

I've just downloaded DirectCsound. But when trying to run it, it complained with an error message that 'dsound.dll' was missing.

What is the difference beetween DirectCsound 4.XX and previous versions of DirectCsound?

What computer do I need to run DirectCsound in realtime?

What about the buffer size: what is the best value I have to set?

Why some new opcodes implemented in standard version are not present in DirectCsound?

Will a fusion of standard executuable with DirectCsound will be available in the future?

What are the main features of DirectCsound in comparison with standard version of Csound?

What is the difference between DirectCsound and RTsound (also named CsoundRT)?

Is DirectX audio input supported by DirectCsound?

Why don’t score and orchestra macros operate well in DirectCsound?

What is VMCI?

Where can I get DirectCsound and VMCI

What version of DirectX do I need to enable Csound to use the DirectX routines?

Is DirectCsound compatible with Windows98?

Is DirectCsound compatible with Windows NT?

Where can I get more information and tips?


I've just downloaded DirectCsound. But when trying to run it, it complained with an error message that 'dsound.dll' was missing.
It is normal, if you are not using Windows 2000 or you have not already installed DirectX 7 or later. You can get last release of DirectX at the following URL:

http://www.microsoft.com/directx/default.asp

What is the difference beetween DirectCsound 4.XX and previous versions of DirectCsound?
Mainly there are the following differences:

  1. DirectCsound 4.0 is a true Win32 program, while previous versions were console-based programs
  2. It presents an IDE interface
  3. Display and hard-disk recording can be suppressed/activated during the performances;
  4. Command line arguments can be typed directly in the corresponding dialog box when the executable is run without arguments;
  5. Performance sessions can be terminated without exiting from the main program.

There are also other small differences, see the documentation for more information.

Q: What computer do I need to run DirectCsound in realtime?
A: It depends of how much synthesis power do you need. I recommend at least a Pentium 133 MHz (which can handle up to 50 oscillators in real-time at 44100 Hz). A Pentium II 400 can give you more than 200 oscillators at 44100 Hz. However actual polyphony depends by several factors such as sampling rate, computer motherboard, RAM type, cache memory size and the buffer size you set in the command line call (flag -b).

Q: What about the buffer size: what is the best value I have to set?
A: It depends mainly by five factors:

1. Computer speed
2. Sampling Rate of the orchestra
3. If you are using the DirectX drivers or the old MME drivers
4. The type of the soundcard
5. If a very fast response is needed in your realtime performance.

The trivial rule is: the smallest buffer size it is possible. The problem is that polyphony decreases and the risk of processing underrun increases when buffer size decreases.

A fast computer should allow you to reduce the buffer size, but it is not so intuitive, because in some cases this rule is not followed. For example I have two computer, a slow Pentium 133 and a fast Pentium II 400. So, using DirectX (-+X flag), the minimum buffer size (flag -b) I can set with my P-133 is 100 samples, whereas I have to rise this size up to 200 samples when using my faster P-II 400 with DirectX. I don’t know what is the cause, maybe it resides in the mainboard interrupt configuration of that computer or probably in the video card bus (I have a PCI video card, AGP cards should work better). I tried to play DirectCsound with another Pentium II 233 computer and I have been able to reduce the buffer length down to 50 samples. A person told me that with his Pentium II 400 he can reduce the buffer size down to -b = 16 (practically no  delay!!!).

When you are using the old MME (Multi Media Extension) drivers, the buffer should be set at least 4 times bigger than when using DirectX, in the best case. Notice that, differently than when you are using DirectX, you have to set two values: the number of buffers (flag -+p) and the size of buffers (flag -b). These two values depend also by the type of soundcard you use. I noticed that with some rounded sr values such as 40000, the MME buffer can be reduced a lot. When using sr=44100 I have to set the buffer size to about 3000 and the buffer numbers to 8, giving a medium latency time greater than half a second.

I highly recommend to use DirectX for best performance (-+X flag). I haven't implemented DirectX audio input so far, because, unfortunately, my audio card driver doesn't support it at present time. So if you intend to use in realtime audio out and audio in at the same time, you must use old MME drivers for both in and out.

Be aware that DirectCsound does not operate with DirectX in emulation mode, so you need a soundcard certified by Microsoft in order to use DirectX.

Q: Why some new opcodes which are implemented in standard version are not present in DirectCsound?
A: Mainly because synchronizing DirectCsound with standard version requires a lot of time. So, I prefer to wait a major release of standard Csound before doing that job.

Q: Will a fusion of both standard executuable and DirectCsound be available in the future?
A: I hope so. Until now each of these versions has its own features. The problem is that John Fitch, the administrator of standard version, moves Csound towards objectives different from those of mine. My main objective and need is to use Csound with realtime controllers (by means of MIDI or other more advanced devices). So my efforts are mainly directed toward transforming Csound into a fast, powerful, interactive and easily controllable performance tool. Part of my code is device dependent, so porting it in other platforms it is not a trivial job. Actually, the efforts of John Fitch are mainly directed towards compatibility in different platform.

Q: What are the main features of DirectCsound in comparison with standard version of Csound?
A: There are two kind of features, operating-system-related features, or ‘core features’, and new opcodes.

The core features are:

  • Management of MIDI IN and OUT ports
  • DirectX low-latency realtime audio support for input and output.
  • Real-time audio input and output in parallel.
  • Hard-disk recording of a realtime session of Csound
  • Support of more file output in parallel in multichannel format, when using it in deferred time (opcode fout). More instances of fout can be used at the same time, and each instance generates an audio file of any number of channels.

Some of these features may be implemented also in standard version at present time or in the future (or at least I hope so).

The new opcodes can be divided into MIDI related opcodes and generic opcodes.

The MIDI related opcodes can be divided into five groups:

  1. MIDI CONTROLLERS (imidic7, midic7, imidic14, midic14, imidic21, midic21, ictrl7, ctrl7, ictrl14, ctrl14, ictrl21, ctrl21, initc7, initc14, initc21, slider8, slider16, slider32, slider64, slider8f, slider16f, slider32f, slider64f, islider8, islider16, islider32, islider64, s16b14, is16b14, s32b14, is32b14)
  2. MIDI MICRO TUNING (release, xtratim)
  3. MIDI GENERATORS (ion, ioff, iondur, iondur2, moscil, kon, ioutc, koutc, ioutc14, koutc14, ioutpb, koutpb, ioutat, koutat, ioutpc, koutpc, ioutpat, koutpat, mclock, mrtmsg)
  4. MIDI IN/OUT FLOW MANAGERS (midiin, midiout, kon2, nrpn, mdelay)
  5. DURATION EXTENSION OF MIDI NOTES (xtratim, release)

The generic opcodes can be divided into 15 groups

  1. SUBROUTINE CALL RELATED (icall, dicall, micall, dmicall, kargc, kargt, argc, argt, artrnc, artrnt, krtrnc, krtrnt)
  2. WRAPPING SIGNALS AROUND (iwrap, wrap, imirror, mirror)
  3. INTERPOLATORS (intrpol, kntrpol, antrpol)
  4. PHYSICAL MODELING WAVEGUIDE BLOCKS (physic1, physic2, flanger)
  5. AUDIO RATE EXPONENTIAL ENVELOPES GENERATOR (aexpseg)
  6. MEMORY OPTIMIZED 16-BIT SOUND USAGE (loscil2, fof3, lposcint)
  7. PRINT K-RATE VALUES TO SCREEN (printk2)
  8. PRECISE OSCILLATORS (posc, lposc)
  9. FILTERS (lpres, lpresx, tonex, atonex, resonx, vlpres)
  10. FAST POWER OF TWO FUNCTIONS (powoftwo, logbtwo)
  11. INFORMATIONS ABOUT SOUNDIFILE FUNCTION TABLES (iftlen2, insamp, iftsr)
  12. NEW GEN FUNCTIONS (GEN22, GEN23, GEN24)
  13. TRIGGER BOOLEAN GENERATOR (trig)
  14. SCORE OPCODES
  15. SCORE MACRO OPERATORS

Many of these opcodes are already ported to standard Csound by John Fitch. However, maybe some of them don't operate well in Fitch's version, because he never tested the MIDI stuff. Notice that some opcodes are renamed and/or slightly modified in standard version. This had been done mainly to prevent name pollution (for example ‘icall’ family are renamed to ‘schedule’, ‘physic1’ and ‘physic2’ to ‘wguide1’ and ‘wguide2’ etc.).

Q: What is the difference between DirectCsound and RTsound (also named CsoundRT)?
A: DirectCsound is a later version which supports Microsoft DirectX API to reduce latency in realtime performances. In RTsound only the old MME API were implemented whereas in DirectCsound both APIs are implemented. It was called RTsound until the version 1.9; after that version it is called DirectCsound. The user must choose to use DirectX (flag -+X) or MME (flag -+q and -+p) per session, but not both at the same time. The realtime audio input is currently implemented only with the MME API, so it is not possible to use DirectX when input and output are needed.

Q: Is DirectX audio input supported by DirectCsound?
A: Yes it is.  At present time (version 3.0 and later)  the DSoundCapture routines are supported (-+C flag). However, at present time, most audio card drivers don't support DirectSoundCaputure API in native mode, supporting it only in emulation mode, so using DirectX routines for input don’t completely eliminate latency. I was told that Windows 2000 drivers will support DirectSoundCapture in native mode.

Q: Why score and orchestra macros don’t operate well with DirectCsound?
A: Now (DirectCsound 2.5) macros are implemented. The syntax of macros with arguments is a bit different. Use single quote character ( ' ) instead of # to separate arguments. See the manual.

Q: What is VMCI?
A: VMCI is an acronym of Virtual Midi Control Interface. It is a set of virtual sliders, joysticks, and a virtual keyboard. It implements also a launcher for Csound, and it is designed with the idea to be a DirectCsound companion. The most important features is that all positions and configurations can be saved and restored in a later time from the hard-disk. It is very handful to control DirectCsound in realtime, but it can also be used together with other virtual or real midi instruments. Also, VMCI Plus supports a complex interaction of a lot of controls by means of a single mouse movement, accrding to a configuration previously set by the user. It also supports MIDI IN, allowing an hardware MIDI device to control very complex MIDI configurations. It will be also more programmable. There are several versions of VMCI:

VMCI 1.22 Lite (freeware, no HVS)

VMCI 1.22 Pro (donationware, no HVS)

VMCI 2.0 Plus (shareware) implements many advanced features such as HVS (Hyper Vectorial Synthesis).

Q: Where can I get DirectCsound and VMCI
A: Check my site:

http://www.tiscalinet.it/G-Maldonado

Q: What version of DirectX do I need to enable Csound to use the DirectX routines?
A: In theory all versions starting from 3.0. I noticed some computers have some problem with DirectX 5.0 with fast Pentium II computers, so I suggest to use 7.0 version (download the complete version of 7.0 if you have Windows95, you can download the partial version only if you have Windows 98).

Q: Is DirectCsound compatible with Windows98?
A: Yes, it is.

Q: Is DirectCsound compatible with Windows NT, what about Windows 2000?
A: At present time DirectCsound doesn't seem to operate correcty in realtime with Windows NT. However it works OK in deferred time. I can't test it as I haven't Win NT installed on my computer.
Recent tests done by beta testers, confirm that DirectCsound is fully realtime compatible with Windows2000 using DirectX 7.0.

Q: Where can I get more information and tips?
A: Read carefully the DirectCsoundinfo.html file placed into the zip archive you have just downloaded.