CSOUND TO GO: A Minimal Windows Csound on a Stick (2020) Art Hunkins abhunkin@uncg.edu UPDATE - DECEMBER 2022 The article below references Csound 6.15. More recent releases, Csound 6.16 and 6.18, are somewhat more complete and will respond to the same "minimizing" process. The resulting "packages" are slightly larger: 5.29MB for 6.16, and 5.91MB for 6.18. 6.18(.1) is likely the last Csound6. Csound7 should also allow the "minimizing" described below. Note that all versions of Csound are available at: https://github.com/csound/csound/tags . --------------------------------------------- INTRODUCTION This project is designed for a particular subset of Csounders. It is intended for: 1) Windows users; 2) those doing basic standalone Csound and are mostly happy with the standard opcodes; 3) travelers who can't (or don't want to) carry their computers with them, but do have Windows system access where they are going; 4) students and others who work on multiple Windows computers, especially systems that don't (or can't) have Csound installed; 5) newcomers to Csound who would appreciate its not being so overwhelming; 5) composers interested in live performance (including MIDI performance) who want to be ready on a moment's notice to showcase their work wherever there is a (Windows) computer; 6) and finally, those who are not averse to the command line (i.e., do not feel they want or need a fancy front end). IMPORTANT NOTE: Csound 6.15 for Windows, with which we are working here, is a 64-bit program. It is only compatible with 64-bit versions of Windows. Ever since before Windows XP, both 32- and 64-bit versions of the operating systems have existed. Both 32-bit and 64-bit installations are common today, though 32-bit is becoming obsolete, and more recent computers have 64-bit Windows. You know you are dealing with a 32-bit installation if, when you run Csound, your console returns "Csound is not a valid Win32 application." In this case, you must find a different computer. Actually, there is an easier way of determining - *before* you undertake this project - if you are dealing with a 64-bit operating system or not: just click the Computer or My Computer icon, Local disk (C:), and see if you find a "Program Files (x64)" directory. If you do, you have a 64-bit system and are good to go. PREPARATION The only material required is a blank 16MB or larger USB drive. You must have access to a core version of Csound 6.15 installed on a Windows computer. You'll need to copy files from both the /bin and /plugins64 subfolders. Your sole required task consists of transferring files from these directories onto your USB drive. If you'd like to save yourself all the trouble, you can download and extract one of the two .zip archives that accompany these instructions: Cs2go.zip or Cs2goPlus.zip. The former contains all the Csound files discussed in this project; the latter adds, also in the root directory of the USB drive, the Audacity material detailed in the Addendum below. Both .zip archives include two .csd's that test aspects of the installation, while also being instructive to the Csound newcomer. (These .csd's parallel several of the "Get Started" tutorial examples from the Learn tab at Csound.com .) Both archives also include the Opcode_Libraries.txt referenced below. In any case, once you have prepared your Csound-to-Go USB drive(s), you should be able to work with Csound on the 64-bit Windows computer of your choice - and with *any* level of access, including Guest/Visitor (assuming default permissions). To my knowledge, everything described in this article is possible with even minimal account access. STEPS Copy the following files to the USB's root directory, taking only as many steps as you require depending to what you want to do with Csound (all files are located in one of the two above-mentioned folders): Step 1 - Copy CSOUND.EXE and CSOUND64.DLL This is all you need (plus your .csd) to write an output .wav file to the root directory. You can then play it in Windows Media Player or any other player Windows has available. You will also be able to edit your .csd in Notepad, WordPad or any other text editor. Just be sure to save it as a .csd file in the USB root directory. Step 2 - Copy PORTAUDIO.DLL and RTPA.DLL (optional) This step adds realtime performance of your .csd (in connection with -odac in CsOptions). Headphones/earbuds or audio system of course required. Step 3 - Copy PMIDI.DLL and PORTMIDI.DLL (optional) These files add MIDI performance capability using an external MIDI device (in connection with -Ma in CsOptions). You'll have to bring your own MIDI device! (But see the following step.) Step 4 - Copy VIRTUAL.DLL (optional) This adds the virtual MIDI keyboard option (along with specifying -+rtmidi=virtual in CsOptions). It allows for basic MIDI testing without an external MIDI device. Step 5 - Copy WIDGETS.DLL (optional) This is if you wish to use FLTK widgets in your .csd. All the above files take up only 5MB of storage! Obviously you'll need to copy over any stock Csound samples you are using (e.g., fox.wav or beats.wav, which are located in /doc/manual/examples), and any of your own. OTHER THINGS TO KNOW **How to access the Command line to run your .csd (which also needs to be copied to the USB root directory): For Windows 10, type COMM into the Windows search bar (bottom of screen, left). In the window that appears, click on Command Prompt. For continued use, *right-click* on Command Prompt instead, and select Pin to Taskbar. From then on, you can reach the Command line by simply tapping its taskbar icon. (In earlier Windows, click Start, select Programs, Accessories, right-click Command Prompt, select Send to, and Desktop (create shortcut). You now have a desktop *shortcut* to the Command line.) **How to likewise access Notepad, Wordpad and Windows Media Player from the desktop: Follow a similar procedure to that above: in Windows 10 simply substitute these program names for COMM (NOTE, WORDP, and MEDIA will do). In earlier Windows: look first in the Programs list, then in Accessories, right-clicking on the desired program. **How to run your .csd from the Command line: First change to your specified USB drive, by typing e: or f: or g:. (Clicking the Computer or My Computer icon should allow you to identify the correct alphabetic ID.) Once on the correct drive, type csound [yourfile].csd and your file should run. It you get the Console message "error: syntax error, unexpected T_IDENT", you have one of two problems: 1) you've a typo in the line indicated (Notepad shows line numbers when you click on View and select Status Bar; Wordpad unfortunately lacks this feature); 2) you've called for an opcode that is not installed (you can again check the line number). From the opcode itself, you can probably determine which .DLL you need to add (compare its filename with DLL-names in the /plugins64 directory). You can also look up the opcode name in the accompanying Opcode_Libraries.txt to track down the relevant .DLL. Given this "missing opcode" possibility, you should always preview your .csd from your USB drive in a system without Csound, prior to counting on its running on another system. Adding a few extra .DLL's that you may want to use can stand you in good stead. (Another option is to copy your entire /plugins64 folder to a subfolder on your USB drive, or to a separate drive. Then you can readily copy to your root directory any additional .DLL you might later need. The entire /plugins64 folder is only 5.5MB.) FINAL WORDS I enjoy the simplicity of working from the Command line, and of getting there by simply clicking an icon and choosing a directory ID - all from a single USB directory that I can take with me. No more fooling with Environment Variables. It's become my default way of working, even on my desktop computer. I'm also happy with the basic simplicity of Notepad. With available Wi-Fi, it's easy to access Csound.com for help - via the Learn tab, where the excellent "Get Started" tutorial, the FLOSS and Reference Manuals are there at my fingertips. (The home page even offers a handy Search bar for locating items such as opcodes in the reference manual or elsewhere on-site.) ADDENDUM: A portable audio editor - Audacity Audacity is an excellent .wav editor, and can make a compact standalone supplement to your travelling USB "setup." At 20.5MB in size, you can install its essentials in any one of three locations: 1) on a separate USB drive (root directory); 2) as an Audacity subdirectory on your single USB; or 3) simply added to the Csound files in your root USB directory. I prefer this latter placement as it rarely requires leaving a single directory. (If you choose to install Audacity to the same USB, however, you'll likely need at least a 32MB drive.) Download Audacity's latest *alternative .zip* distribution for Windows from https://www.audacityteam.org/download/windows/ . *Do not actually extract the archive, just click the archive open and copy the necessary files to one of the three above locations. These are the files (note spaces): audacity.exe msvcp140.dll vcruntime140.dll wxbase313u vc custom.dll wxbase313u xml custom.dll wxbase313u core custom.dll wxbase313u html custom.dll wxbase313u qa custom.dll When finished, create the following new folder in the same directory (it will be empty until you run Audacity): Portable Settings (again observe the space) You can now run Audacity by simply clicking its icon. It's important to load your first .wav file *from within Audacity*. (From then on you can select Audacity to edit or perform your file from the file itself - see further below.) When you initially access your file, you'll need to change the Open file (Import) directory to your USB drive (root). Then when you save (Export), change the location likewise to your USB root. You'll only have to do this once, as these will become your new defaults. (Beware: Export, in particular, does *not* originally default to your USB!) Now all your audio files will be in the same folder - and easy to find. If you've opted to assign Audacity its own directory, whether on the same USB drive or another, I'd suggest that prior to running Audacity you first copy your .wav to the Audacity folder, and do further work with your file there. Your Csound efforts will then cleanly reside in one folder, and followup processing (with Audacity) in another. Csound by default writes all output in .wav format (though now optionally in .ogg, with the --ogg CsOption). Audacity imports these formats, as well as .mp3; it exports in nearly any format you'd like, including .flac . Windows Media Player plays all the above formats except for .ogg, and you can set any allowed format to default to Media Player by right-clicking on a file in that format, selecting "Open with", "Choose another app", then Windows Media Player - while checking the "Always use this app" box. If you'd rather have *Audacity* always play your file, you can follow the same procedure as for Windows Media Player, except that you must first have opened a file with the desired format *from within Audacity*. (Audacity will not otherwise appear among the options to "Always use this app".) A Portable Enhanced Text Editor? If you feel the need for an editor with somewhat more capability than Notepad (or WordPad for that matter) - including individual line numbers, you can try Notepad++. Follow a parallel "installation" procedure to that for Audacity. Start by downloading the *64-bit x64 zip package* from https://notepad-plus-plus.org/downloads/v7.8.9/ . Again, do not extract - only copy these two files: notepad++.exe SciLexer.dll Do not create any new folder, but do copy your .csd's, if necessary, to your notepad++ folder. (Again, it would be most convenient for *everything* to be in your single Csound-to-Go directory.) If you want Notepad++ to become your default Csound editor, you can do so by following the steps above for Audacity and Windows Media Player (to make them default audio file players). The same requirement applies to first open a .csd *within Notepad++*, then later choosing for the .csd to "Always use this app." You can even click on Notepad++'s Languages tab, select "C", then Csound - to get your text highlighted for .csd's! This "installation" of Notepad++ occupies 5MB of disk space.