Skip to content

How to use wrapped csd file (draft)

gleb812 edited this page Sep 6, 2022 · 22 revisions

Once you're lucky enough to get the desired .csd file without any visible errors, you have several options to start working with it (assuming that you already have Csound installed):

  1. Run it as it is. You suppose to have some working patch in Nord, your favorite oscillator is connected to the filters, some logic modules control the routing, and your patch can work (at least some time) without any control from your side, so you just wanna hear the sound. In this case everything is already done for you. Just put your MyPatch.csd file in the home directory, open terminal and run
    csound -odac MyPatch.csd
    By the default settings in the current version of wrapper, the wrapped csd will make Csound run for a very long time. Once you decide to stop it, press Ctrl+C on Windows and Linux, Cmd + c on Mac to kill the running process in terminal. For more versatile sound output settings, e.g. you have multiple audio devices, please refer to Csound manual.

  2. Render the sound. By default, the CsScore part of csd orders Csound to run for a very long time. You need to fix it manually. Look for the three lines right after the CsScore tag, e.g.
    i1 0 [60 * 60 * 24 * 7]
    i2 0 [60 * 60 * 24 * 7]
    i3 0 [60 * 60 * 24 * 7]
    You have to write the following instead:
    i1 0 30
    i2 0 30
    i3 0 30
    In this case you'll get 30 secs of sound. To render the sound you have to open terminal and run
    csound -otest.wav MyPatch.csd

  3. Use the Csound score

  4. Use RT MIDI

  5. Use MIDI file
    In this case you'll have to use prepared MIDI file. To read it using Csound you need to run in terminal the following command:
    csound -odac -Fmidi.mid name.csd

  6. Simulate RT MIDI
    There is a special Instrument 4 in the wrapped code to simulate the keyboard input.
    In order to use it, you have to comment the score lines for i1, i2 and i3, and uncomment line i4 0 1 64, where 1 - is a duration of simulated incoming MIDI note, 64 - MIDI pitch. You may also add more lines for Instrument 4. Remember, that after i4 you should write the start time, i.e. time when the note becomes active. You may run your code in RT (see 1), or render it offline (see 2).

Clone this wiki locally