Setting Up Your System

The first thing you’ll need to do, in order to check whether Csound has been correctly installed, is make sure your audio outputs work. The method you’ll use for testing this depends on whether you’re using CsoundQt or running Csound directly from the command line.

System Test in CsoundQt

After installing and launching CsoundQt, click on the Configure icon in the toolbar to open the Configuration box. If the toolbar is not visible, you can reach the Configuration box from the Edit menu in the Windows version, or from Preferences in the CsoundQt menu in the Macintosh version.

In the Run tab of the Configuration box, under Realtime Play, PortAudio should be selected in the drop-down menu as the RT Audio Module. Lower down, you’ll find the Output Device (-o) field. Click on the three-dot button to the right of this field and choose your audio output from the list. If you’re planning to use audio input, choose the input device in the same way. If you’re planning to use real-time MIDI input, choose your MIDI interface in the Input Device (-M) field to the right. When you’re done, click OK.

Back in the main window, go to the Examples menu. In the Getting Started > Toots submenu, select Toot1, as shown in Figure 2.7. Click the Run button in the toolbar. You should hear a four-second sine wave with a frequency of 440 Hz.

Figure 2.7 To test CsoundQt’s audio output, set the output in the Configuration box and then load this file.

image

The Examples > Getting Started > Basics > Hello World file can be used for testing in the same way. It contains, in addition, a few useful tips in the form of comments, which will appear in the editor window as green text.


image

Troubleshooting Audio Issues If you don’t hear any sound when you run a Csound file, the first things to check are the obvious ones: Is your audio hardware installed correctly in your system? Are your amp and speakers turned on? Have you selected the desired audio driver for Csound’s output?

Assuming all of the above are in good order, the next step is to open the CsoundQt Console pane and watch for error messages when you try to run the file. If you’re running Csound from the computer’s command line, any error messages should show up in the terminal window itself. If you’ve made a mistake entering your code, for example, you might see Console messages telling you that Csound is operating normally but producing note events with an amplitude of 0.0. That will give you a good indication of what to fix.


System Test in the Terminal

If you’re planning to run Csound from the terminal, an audio output test is almost as simple. First, open the terminal. At the prompt, type csound. You should see a long text dump that looks more or less like Figure 2.8. If you don’t see this, Csound has not been installed correctly.

Figure 2.8 After entering the csound command in a Windows Command Prompt box, you should see this output.

image

Open a text editor program (not a word processor). Enter the following code and then save the file to some suitable directory. You should save it with the .csd filename extension—for example, my_test.csd.


  <CsoundSynthesizer>
  <CsOptions>
  </CsOptions>
  <CsInstruments>

  sr = 44100
  ksmps = 128
  nchnls = 2
  0dbfs = 1

  instr 1

  a1 oscil 0.2, 440, 1
  outs a1, a1

  endin

  </CsInstruments>
  <CsScore>

  f 1 0 4096 10 1
  i 1 0 4

  </CsScore>
  </CsoundSynthesizer>

This is identical to the Toot1 file loaded from CsoundQt’s Examples menu, but without the embedded comments.

In your computer’s terminal window, navigate to the directory where you’ve saved the file. (This is done using the cd command, which is shorthand for “change directory.” If you’re not familiar with the use of a terminal, you’re probably better off using CsoundQt, at least to start.) Assuming you’ve named the file above my_test.csd, type the following command at the terminal prompt:


  csound my_test.csd

Depending on how your system is set up, you may hear a four-second sine wave at 440 Hz, or you may find that Csound has written a file called my_test.wav to your hard drive. The results will depend on whether the command -odac is present in the file called .csoundrc. This file should be found in your main Csound program directory. See the sidebar for details.


image

The .csoundrc File Part of the Csound installation is a small text file called .csoundrc. This file contains a set of default command-line flags. It will be consulted by Csound each time Csound runs, and the flags in the file will be used unless they’re overridden by flags in your .csd file or in the command line you’re typed at the terminal. In my installation, the .csoundrc file contains the following:


  -d -m135 -H0 -s -W -o dac - rtaudio=pa -b 128 -B 2048

For details on the meanings of these flags, consult the “Csound Command Line” page in The Canonical Csound Reference Manual.


In my Windows system the real-time output from the terminal makes crackling noises, because the default audio driver is not low-latency. My ASIO driver (ASIO4ALL v2) shows up in the PortAudio list in the terminal as device 16. To get rid of the crackles, I use a command-line flag, like this:


  csound -odac16 my_test.csd

The flag -odac16 directs Csound to the ASIO driver (as opposed to the default audio driver for my system), and the output is smooth. In your system, the ASIO driver will probably have a different number. Before starting to run, Csound will list all of the audio input and output devices to the terminal, so you can find the correct number easily.


image

Tip If you’re attempting to run Csound from the command line after writing Csound code in a program that’s not a front end, you need to take care that you’re using a text editor, not a word processor. Word processors insert lots of extra formatting data around the text that you can see on-screen. This extra data will prevent Csound from compiling your code.

Good freeware text editors are available for all of the major computer operating systems. Windows users may want to consider Notepad++ (available from http://notepad-plus-plus.org). On the other hand, why not just do your Csound work in a front end?


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.62.168