DirectCsound FAQ

Why a character-terminal oriented interface is implemented in this version of Csound instead of a graphic interface (for example as in Winsound)?

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)?

Will DirectX support be implemented in the future?

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?

Where can I get more information and tips?


Q: Why only a character-terminal oriented interface is implemented in this version of Csound instead of a graphic interface (for example as in Winsound)?
A: There are several reasons. I noticed that Win32 console mode programs are quite faster than those program which implement graphic interface (even if I don't fully understand the reason, until now). Furthermore, it is possible to use another program (there are several Csound launchers and shells available such as Wcshell, VMCI, Visual Orchestra etc.) to make Csound start easier. This allow the user to choose the best interface for his own task.

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). 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. 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.

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 depends 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, causing this a medium latency time greater than half a second.

I highly recommend to use DirectX for best performance (-+X flag).

Be aware that DirectCsound does not operate with DirectX in emulation mode, so you need a soundcard certified by Microsoft 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. A recent Fitch’s direction is adding the programming modules of commercial analog synthesizers (such as ADSR envelope, LFO etc.) to Csound. I don’t fully agree with this direction because older opcodes (linseg, expseg and oscil) are already implemented and they are a more powerful superset of the new JPFF opcodes.

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
  • Real-time audio input and output in parallel
  • Command-line oriented real-time output (partially possible on Win95 because of some limits which are present in the operating system itself)
  • Hard-disk recording of a realtime session of Csound

Some of these features will be implemented also in standard version 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 13 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)

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.).

It is announced the new features of DirectCsound will be implemented in standard Csound too. When the porting process will be ended, I will add to my version also the opcodes names used by John Fitch.

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: Will DirectX support be implemented in the future?
A: I hope so. At present time the DSoundCapture routines are supported only in emulation mode by the most of the sound-cards, so using DirectX routines for input doesn’t reduce the latency.

Q: Why score and orchestra macros don’t operate well with DirectCsound?
A: Because the last synchronization with standard Csound was done at an early time, in wich macros were not debugged by John Fitch. In the next syncronization stage (which will be done in a future version) macros should operate properly.

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. In future this interface will be expanded and it will support complex interactuon of a lot of controls by moving a single slider, which is previously programmed by the user. It will also support MIDI IN, allowing an hardware MIDI device to control very complex MIDI configurations. It will be also more programmable.

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

http://www.agora.stm.it/G.Maldonado/home2.htm

There are the links of two mirrors to download both programs.

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 6.0 version (download the complete version of 6.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 (at least in theory, everything is possible with Bill Gate$, the greatest fan of the Murphy's law!)

Q: Where can I get more information and tips?
A: Read carefully the Readme.htm file placed into the zip archive you had downloaded.