Musicians' Guide
Musicians' Guide
Musicians' Guide
Legal Notice
Copyright 2013 Fedora Project Contributors. The text of and illustrations in this document are licensed by Red Hat under a Creative Commons AttributionShare Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/bysa/3.0/. The original authors of this document, and Red Hat, designate the Fedora Project as the "Attribution Party" for purposes of CC-BY-SA. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version. Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries. For guidelines on the permitted uses of the Fedora trademarks, refer to https://fedoraproject.org/wiki/Legal:Trademark_guidelines. Linux is the registered trademark of Linus Torvalds in the United States and other countries. Java is a registered trademark of Oracle and/or its affiliates. XFS is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries. MySQL is a registered trademark of MySQL AB in the United States, the European Union and other countries. All other trademarks are the property of their respective owners.
Abstract
This document explores some audio creation and music activities possible with Fedora Linux. Computer audio concepts are explained, and a selection of programs are demonstrated with tutorials that show their typical usage.
Preface 1. Document Conventions 1.1. Typographic Conventions 1.2. Pull-quote Conventions 1.3. Notes and Warnings 2. We Need Feedback!
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 1/157
27.2.13.
Musicians' Guide
I. Linux Audio Basics 1. Sound Cards and Digital Audio 1.1. Types of Sound Cards 1.1.1. Audio Interfaces 1.1.2. MIDI Interfaces 1.2. Sound Card Connections 1.2.1. Integrated into the Motherboard 1.2.2. Internal PCI Connection 1.2.3. External FireWire Connection 1.2.4. External USB Connection 1.2.5. Choosing a Connection Type 1.3. Sample, Sample Rate, Sample Format, and Bit Rate 1.3.1. Sample 1.3.2. Sample Format 1.3.3. Sample Rate 1.3.4. Bit Rate 1.3.5. Conclusions 1.4. Other Digital Audio Concepts 1.4.1. MIDI Sequencer 1.4.2. Busses, Master Bus, and Sub-Master Bus 1.4.3. Level (Volume/Loudness) 1.4.4. Panning and Balance 1.4.5. Time, Timeline, and Time-Shifting 1.4.6. Synchronization 1.4.7. Routing and Multiplexing 1.4.8. Multichannel Audio 2. Software for Sound Cards 2.1. How Linux Deals with Audio Hardware 2.2. Sound Servers 2.2.1. PulseAudio 2.2.2. J C Audio Connection Kit AK 2.2.3. Phonon 2.3. Use the J C Audio Connection Kit AK 2.3.1. Install and Configure J C AK 2.3.2. Using QjackCtl 2.3.3. Integrating P l e u i with J C usAdo AK 3. Real-Time and Low Latency 3.1. Why Low Latency Is Desirable 3.2. Processor Scheduling 3.3. The Real-Time Linux Kernel 3.4. Hard and Soft Real-Time 3.5. Getting a Real-Time Kernel in Fedora Linux 4. Planet CCRMA at Home 4.1. About Planet CCRMA at Home 4.2. Deciding Whether to Use Planet CCRMA at Home 4.2.1. Exclusive Software 4.2.2. Security and Stability 4.2.3. A Possible "Best Practices" Solution 4.3. Use Software from Planet CCRMA at Home 4.3.1. Install the "Planet CCRMA at Home" Software Repository 4.3.2. Set Repository Priorities 4.3.3. Prevent a Package from Being Updated II. Audio and Music Software 5. Audacity
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
2/157
27.2.13.
Musicians' Guide
5.1. Learn When to Use Audacity 5.2. View Requirements and Install 5.2.1. Software Requirements 5.2.2. Hardware Requirements 5.2.3. Install 5.2.4. Post-Install Test: Playback 5.2.5. Post-Install Test: Record 5.3. Configuration 5.3.1. Run Audacity for the First Time 5.3.2. Configure Audacity for Your Sound Card 5.3.3. Set the Project's Sample Rate and Format 5.4. Learn the Audacity Interface 5.5. Record 5.5.1. Start to Record 5.5.2. Continue to Record 5.6. Create a New Login Sound (Tutorial) 5.6.1. Files for the Tutorial 5.6.2. Scenario 5.6.3. Align Tracks 5.6.4. Stretch Tracks 5.6.5. Adjust the Volume Level 5.6.6. Remove Noise 5.6.7. Fade In or Out 5.6.8. Remove Some Audio 5.6.9. Repeat a Previously-Recorded Segment 5.6.10. Add a Special Effect (the Phaser) 5.6.11. Conclusion 5.7. Save and Export 5.7.1. Export Part of a File 5.7.2. Export a Whole File 6. Digital Audio Workstations 6.1. Knowing Which DAW to Use 6.2. Stages of Recording 6.2.1. Recording 6.2.2. Mixing 6.2.3. Mastering 6.2.4. More Information 6.3. Interface Vocabulary 6.3.1. Session 6.3.2. Track and Multitrack 6.3.3. Region, Clip, or Segment 6.3.4. Transport and Playhead 6.3.5. Automation 6.4. User Interface 6.4.1. Messages Pane 6.4.2. Clock 6.4.3. Track Info Pane 6.4.4. Track Pane 6.4.5. Transport Controls 7. Ardour 7.1. Requirements and Installation 7.1.1. Knowledge Requirements 7.1.2. Software Requirements 7.1.3. Hardware Requirements 7.1.4. Installation 7.2. Recording a Session 7.2.1. Running Ardour
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 3/157
27.2.13.
Musicians' Guide
7.2.2. The Interface 7.2.3. Setting up the Timeline 7.2.4. Connecting Audio Sources to Ardour 7.2.5. Setting up the Busses and Tracks 7.2.6. Adjusting Recording Level (Volume) 7.2.7. Recording a Region 7.2.8. Recording More 7.2.9. Routing Audio and Managing J C Connections AK 7.2.10. Importing Existing Audio 7.3. Files for the Tutorial 7.4. Editing a Song (Tutorial) 7.4.1. Add Tracks and Busses 7.4.2. Connect the Tracks and Busses 7.4.3. Add Regions to Tracks 7.4.4. Cut the Regions Down to Size 7.4.5. Compare Multiple Recordings of the Same Thing 7.4.6. Arrange Regions into the Right Places 7.4.7. Listen 7.5. Mixing a Song (Tutorial) 7.5.1. Setting the Session for Stereo Output and Disabling Edit Groups 7.5.2. Set Initial Levels 7.5.3. Set Initial Panning 7.5.4. Make Further Adjustments with an Automation Track 7.5.5. Other Things You Might Want to Do 7.5.6. Listen 7.6. Mastering a Session 7.6.1. Ways to Export Audio 7.6.2. Using the Export Window 8. Qtractor 8.1. View Requirements and Install 8.1.1. Knowledge Requirements 8.1.2. Software Requirements 8.1.3. Hardware Requirements 8.1.4. Other Requirements 8.1.5. Install 8.2. Configure Qtractor 8.2.1. Use Qtractor with J C (QjackCtl) AK 8.2.2. Change Audio Options 8.2.3. Change MIDI Options 8.2.4. Configure MIDI Channel Names 8.3. Use Qtractor 8.3.1. Use the Blue Place-Markers 8.3.2. Use the MIDI Matrix Editor's Tools 8.3.3. Export a Whole File (Audio and MIDI Together) 8.3.4. Miscellaneous Tips 8.4. Create a MIDI Composition (Tutorial) 8.4.1. Inspiration 8.4.2. Get Files for the Tutorial 8.4.3. Prepare Qtractor 8.4.4. Import the Audio File 8.4.5. Mark the First Formal Area 8.4.6. Create a Theme 8.4.7. Repeat the Theme 8.4.8. Compose the Next Part 8.4.9. Qtractor's Measures 52 to 75 8.4.10. Qtractor's Measures 75 to 97 8.4.11. Qtractor's Measure 97 8.4.12. Qtractor's Measures 98 to 119 8.4.13. Qtractor's Measures 119 to 139 8.4.14. Qtractor's Measures 139 to 158 8.4.15. Qtractor's Measures 158 to 176
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 4/157
27.2.13.
Musicians' Guide
8.4.16. Qtractor's Measures 177 to the End 9. Rosegarden 9.1. Requirements and Installation 9.1.1. Knowledge Requirements 9.1.2. Software Requirements 9.1.3. Hardware Requirements 9.1.4. Other Requirements 9.1.5. Installation 9.2. Configuration 9.2.1. Setup JACK and FluidSynth (Qsynth) 9.2.2. Setup Rosegarden 9.3. Rosegarden and LilyPond 9.4. Write a Song in Rosegarden (Tutorial) 9.4.1. Start the Score with a Bass Line 9.4.2. Add a Percussion Track 9.4.3. Spice up the Percussion 9.4.4. Add a Melody 9.4.5. Possible Ways to Continue 10. FluidSynth 10.1. SoundFont Technology and MIDI 10.1.1. How to Get a SoundFont 10.1.2. MIDI Instruments, Banks, Programs, and Patches 10.1.3. MIDI Channels 10.2. Requirements and Installation 10.2.1. Software Requirements 10.2.2. Install FluidSynth 10.2.3. Install with Qsynth 10.2.4. Install without Qsynth 10.2.5. Install SoundFont Files 10.3. Use FluidSynth in a Terminal Emulator 10.4. Configure Qsynth 10.4.1. Start FluidSynth 10.4.2. Configure the SoundFont 10.4.3. Configure JACK Output 10.4.4. Configure MIDI Input 10.4.5. View all FluidSynth Settings 10.5. Assign Programs to Channels with Qsynth 10.5.1. Change the Number of MIDI Input Channels 10.5.2. Save and Reuse Channel Assignments 10.6. Use Reverb and Chorus with Qsynth 10.7. Multiple FluidSynth Instances with Qsynth 11. SuperCollider 11.1. Requirements and Installation 11.1.1. Knowledge Requirements 11.1.2. Software Requirements 11.1.3. Hardware Requirements 11.1.4. Available SuperCollider Packages 11.1.5. Recommended Installation 11.2. Using GEdit to Write and Run SuperCollider Programs 11.2.1. Enable and Configure SCEd in GEdit 11.2.2. Enable SuperCollider Mode and Start a Server 11.2.3. Executing Code in GEdit 11.2.4. Other Tips for Using GEdit with SuperCollider 11.3. Basic Programming in SuperCollider
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
5/157
27.2.13.
Musicians' Guide
11.3.1. First Steps 11.3.2. Variables and Functions 11.3.3. Object-Oriented SuperCollider 11.3.4. Sound-Making Functions 11.3.5. Multichannel Audio 11.3.6. Collections 11.3.7. Repeated Execution 11.3.8. Conditional Execution 11.3.9. Combining Audio; the Mix Class 11.3.10. SynthDef and Synth 11.3.11. Busses 11.3.12. Ordering and Other Synth Features 11.3.13. Scheduling 11.3.14. How to Get Help 11.3.15. Legal Attribution 11.4. Composing with SuperCollider 11.4.1. Files for the Tutorial 11.4.2. Inspiration 11.4.3. Designing the First Part 11.4.4. Designing the Second Part 11.4.5. Creating Ten Pseudo-Random Tones 11.4.6. Scheduling the Tones 11.4.7. Optimizing the Code 11.4.8. Making a Useful Section out of the Second Part 11.4.9. Joining the Two Parts 11.5. Exporting Sound Files 11.5.1. Non-Real-Time Synthesis 11.5.2. Recording SuperCollider's Output (Tutorial) 12. LilyPond 12.1. How LilyPond Works 12.2. The LilyPond Approach 12.3. Requirements and Installation 12.3.1. Learn about Frescobaldi 12.3.2. Requirements and Installation (for Frescobaldi) 12.4. Configure Frescobaldi 12.5. LilyPond Basics 12.5.1. Letters Are Pitches 12.5.2. Numbers Are Durations 12.5.3. Articulations 12.5.4. Simultaneity 12.5.5. Chords 12.5.6. Commands 12.5.7. Source Files 12.5.8. How to Avoid Errors 12.6. Work on a Counterpoint Exercise (Tutorial) 12.6.1. Files for the Tutorial 12.6.2. Start the Score 12.6.3. Adjust Frescobaldi's Output 12.6.4. Input Notes 12.6.5. Format the Score 12.7. Work on an Orchestral Score (Tutorial) 12.7.1. Files for the Tutorial 12.7.2. Start the Score 12.7.3. Adjust Frescobaldi's Output 12.7.4. Input Notes 12.8. Work on a Piano Score (Tutorial) 12.8.1. Files for the Tutorial 12.8.2. Start the Score 12.8.3. Adjust Frescobaldi's Output 12.8.4. Input Notes 12.8.5. Troubleshoot Errors
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 6/157
27.2.13.
Musicians' Guide
12.8.6. Format the Score (Piano Dynamics) 13. GNU Solfege 13.1. Requirements and Installation 13.1.1. Hardware and Software Requirements 13.1.2. Other Requirements 13.1.3. Required Installation 13.1.4. Optional Installation: Csound 13.1.5. Optional Installation: MMA 13.2. Configuration 13.2.1. When You Run Solfege for the First Time 13.2.2. Instruments 13.2.3. External Programs 13.2.4. Interface 13.2.5. Practise 13.2.6. Sound Setup 13.3. Training Yourself 13.3.1. Aural Skills and Musical Sensibility 13.3.2. Exercise Types 13.3.3. Making an Aural Skills Program 13.3.4. Supplementary References 13.4. Using the Exercises 13.4.1. Listening 13.4.2. Singing 13.4.3. Configure Yourself 13.4.4. Rhythm 13.4.5. Dictation 13.4.6. Harmonic Progressions 13.4.7. Intonation A. Contributors B. Revision History
Preface
1. Document Conventions
This manual uses several conventions to highlight certain words and phrases and draw attention to specific pieces of information. In PDF and paper editions, this manual uses typefaces drawn from the Liberation Fonts set. The Liberation Fonts set is also used in HTML editions if the set is installed on your system. If not, alternative but equivalent typefaces are displayed. Note: Red Hat Enterprise Linux 5 and later includes the Liberation Fonts set by default.
27.2.13.
Musicians' Guide
Press C r +A t 2to switch to the first virtual terminal. Press C r +A t 1to return to your X-Windows t l l +F t l l +F session. The first paragraph highlights the particular keycap to press. The second highlights two key combinations (each a set of three keycaps with each set pressed simultaneously). If source code is discussed, class names, methods, functions, variable names and returned values mentioned within a paragraph will be presented as above, in m n - p c d b l . For example: oosae od File-related classes include f l s s e for file systems, f l for files, and d rfor directories. Each ieytm ie i class has its own associated set of permissions. Proportional Bold This denotes words or phrases encountered on a system, including application names; dialog box text; labeled buttons; check-box and radio button labels; menu titles and sub-menu titles. For example: Choose System Preferences Mouse from the main menu bar to launch Mouse Preferences. In the B t o stab, click the L f - a d d m u echeck box and click C o eto switch the primary mouse utn ethne os ls button from the left to the right (making the mouse suitable for use in the left hand). To insert a special character into a gedit file, choose Applications Accessories Character Map from the main menu bar. Next, choose Search Find from the Character Map menu bar, type the name of the character in the S a c field and click N x . The character you sought will be highlighted in the erh et C a a t r T b e Double-click this highlighted character to place it in the T x t c p field and then hrce al. et o oy click the C p button. Now switch back to your document and choose Edit Paste from the gedit menu oy bar. The above text includes application names; system-wide menu names and items; application-specific menu names; and buttons and text found within a GUI interface, all presented in proportional bold and all distinguishable by context. M n - p c d B l I a i or P o o t o a B l I a i oosae od tlc rprinl od tlc Whether mono-spaced bold or proportional bold, the addition of italics indicates replaceable or variable text. Italics denotes text you do not input literally or displayed text that changes depending on circumstance. For example: To connect to a remote machine using ssh, type s h u e n m @ o a n n m at a shell prompt. If the s sraedmi.ae remote machine is e a p e c mand your username on that machine is john, type s h xml.o s [email protected]. oneapecm The m u t - r m u t f l - y t mcommand remounts the named file system. For example, to on o eon iesse remount the / o efile system, the command is m u t - r m u t / o e hm on o eon hm. To see the version of a currently installed package, use the r m - p c a ecommand. It will return a p q akg result as follows: p c a e v r i n r l a e akg-eso-ees. Note the words in bold italics above username, domain.name, file-system, package, version and release. Each word is a placeholder, either for text you enter when issuing a command or for text displayed by the system. Aside from standard usage for presenting the title of a work, italics denotes the first use of a new and important term. For example: Publican is a DocBook publishing system.
Source-code listings are also set in m n - p c d r m nbut add syntax highlighting as follows: oosae oa
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
8/157
27.2.13.
pcaeogjosbo.c.x; akg r.bs.okjae1 ipr jvxnmn.ntaCnet mot aa.aigIiilotx;
Musicians' Guide
pbi casECin ulc ls xlet { pbi sai vi mi(tigag[) ulc ttc od anSrn rs] trw Ecpin hos xeto { Iiilotx iit =nwIiilotx(; ntaCnet nCx e ntaCnet) Ojc bet rf e =iit.okp"coen) nCxlou(EhBa"; EhHm cooe hm oe =(cooe rf EhHm) e; Eh co eh co =hm.rae) oecet(; Sse.u.rnl(CetdEh"; ytmotpitn"rae co) Sse.u.rnl(Eh.co'el' ="+eh.co"el") ytmotpitn"coeh(Hlo) coeh(Hlo); } }
Note
Notes are tips, shortcuts or alternative approaches to the task at hand. Ignoring a note should have no negative consequences, but you might miss out on a trick that makes your life easier.
Important
Important boxes detail things that are easily missed: configuration changes that only apply to the current session, or services that need restarting before an update will apply. Ignoring a box labeled 'Important' will not cause data loss but may cause irritation and frustration.
Warning
Warnings should not be ignored. Ignoring warnings will most likely cause data loss.
2. We Need Feedback!
If you find a typographical error in this manual, or if you have thought of a way to make this manual better, we would love to hear from you! Please submit a report in Bugzilla: http://bugzilla.redhat.com/bugzilla/ against the product Fedora Documentation. When submitting a bug report, be sure to mention the manual's identifier: musicians-guide If you have a suggestion for improving the documentation, try to be as specific as possible when describing it. If you have found an error, please include the section number and some of the surrounding text so we can find it easily.
27.2.13.
Musicians' Guide
1.3.1. Sample 1.3.2. Sample Format 1.3.3. Sample Rate 1.3.4. Bit Rate 1.3.5. Conclusions 1.4. Other Digital Audio Concepts 1.4.1. MIDI Sequencer 1.4.2. Busses, Master Bus, and Sub-Master Bus 1.4.3. Level (Volume/Loudness) 1.4.4. Panning and Balance 1.4.5. Time, Timeline, and Time-Shifting 1.4.6. Synchronization 1.4.7. Routing and Multiplexing 1.4.8. Multichannel Audio 2. Software for Sound Cards 2.1. How Linux Deals with Audio Hardware 2.2. Sound Servers 2.2.1. PulseAudio 2.2.2. J C Audio Connection Kit AK 2.2.3. Phonon 2.3. Use the J C Audio Connection Kit AK 2.3.1. Install and Configure J C AK 2.3.2. Using QjackCtl 2.3.3. Integrating P l e u i with J C usAdo AK 3. Real-Time and Low Latency 3.1. Why Low Latency Is Desirable 3.2. Processor Scheduling 3.3. The Real-Time Linux Kernel 3.4. Hard and Soft Real-Time 3.5. Getting a Real-Time Kernel in Fedora Linux 4. Planet CCRMA at Home 4.1. About Planet CCRMA at Home 4.2. Deciding Whether to Use Planet CCRMA at Home 4.2.1. Exclusive Software 4.2.2. Security and Stability 4.2.3. A Possible "Best Practices" Solution 4.3. Use Software from Planet CCRMA at Home 4.3.1. Install the "Planet CCRMA at Home" Software Repository 4.3.2. Set Repository Priorities 4.3.3. Prevent a Package from Being Updated
27.2.13.
Musicians' Guide
1.3.4. Bit Rate 1.3.5. Conclusions 1.4. Other Digital Audio Concepts 1.4.1. MIDI Sequencer 1.4.2. Busses, Master Bus, and Sub-Master Bus 1.4.3. Level (Volume/Loudness) 1.4.4. Panning and Balance 1.4.5. Time, Timeline, and Time-Shifting 1.4.6. Synchronization 1.4.7. Routing and Multiplexing 1.4.8. Multichannel Audio This chapter introduces the technical vocabulary used for computer audio hardware.
27.2.13.
Musicians' Guide
source: p m s g available from http://commons.wikimedia.org/wiki/File:Pcm.svg c.v, Figure 1.1. A waveform approximated by computer The diagram in Figure 1.1, A waveform approximated by computer illustrates the situation. The red wave shape represents a sound wave that could be produced by a singer or an acoustic instrument. The gradual change of the red wave cannot be processed by a computer, which must use an approximation, represented by the gray, shaded area of the diagram. This diagram is an exaggerated example, and it does not represent a real recording. The conversion between analog and digital signals distinguishes low-quality and high-quality audio interfaces. The sample rate and sample format control the amount of audio information that is stored by the computer. The greater the amount of information stored, the better the audio interface can approximate the original signal from the microphone. The possible sample rates and sample formats only partially determine the quality of the sound captured or produced by an audio interface. For example, an audio interface integrated into a motherboard may be capable of a 24-bit sample format and 192 kHz sample rate, but a professional-level, FireWire-connected audio interface capable of a 16-bit sample format and 44.1 kHz sample rate may sound better.
1.3.1. Sample
A sample is a unit of audio data. Computers store video data as a series of still images (each called a "frame"), and displays them one after the other, changing at a pre-determined rate (called the "frame rate"). Computers store audio
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
12/157
27.2.13.
Musicians' Guide
data as a series of still sound images (each called a "sample"), and plays them one after the other, changing at a predetermined rated (called the "sample rate"). The frame format and frame rate used to store video data do not vary much. The sample format and sample rate used to store audio data vary widely.
1.3.5. Conclusions
Both sample rate and sample format have an impact on potential sound quality. The capabilities of your audio equipment and your intended use of the audio signal will determine the settings you should use. Here are some widely-used sample rates and sample formats. You can use these to help you decide which sample rate and sample format to use. 16-bit samples, 44.1 kHz sample rate. Used for audio CDs. Widely compatible. Bit rate of 705.6 kbps. 24-bit samples, and 96 kHz sample rate. Audio CDs are recorded with these settings and "down-mixed" later. Bit rate of 2304 kbps. 24-bit samples, and 192 kHz sample rate. Maximum settings for DVD Audio, but not widely compatible. Bit rate of 4608 kbps. 1-bit samples, and 2822.4 kHz sample rate. Used for SuperAudio CDs. Very rare elsewhere. Bit rate of 2822.4 kbps. Sample rate and sample format are only part of what determines overall sound quality. Sound quality is subjective, so you must experiment to find the audio interface and settings that work best for what you do.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
13/157
27.2.13.
Musicians' Guide
Figure 1.2. How audio busses work All audio routed out of a program passes through the master bus. The master b us combines all audio tracks, allowing for final level adjustments and simpler mastering. The primary purpose of the master bus is to mix all of the tracks into two channels. A sub -master b us combines audio signals before they reach the master bus. Using a sub-master bus is optional. They allow you to adjust more than one track in the same way, without affecting all the tracks.
Figure 1.3. The relationship between the master bus and sub-master busses Audio busses are also used to send audio into effects processors.
27.2.13.
Musicians' Guide
DAW, and the default setup sends all of the "left" recorded channel to the "left" output channel, and all of the "right" recorded channel to the "right" output channel. Panning sends some of the left recorded channel's level to the right output channel, or some of the right recorded channel's level to the left output channel. Each recorded channel has a constant total output level, which is divided between the two output channels.
Figure 1.4. Panning The default setup for a left recorded channel is for "full left" panning, meaning that 100% of the output level is output to the left output channel. An audio engineer might adjust this so that 80% of the recorded channel's level is output to the left output channel, and 20% of the level is output to the right output channel. An audio engineer might make the left recorded channel sound like it is in front of the listener by setting the panner to "center," meaning that 50% of the output level is output to both the left and right output channels. Balance is sometimes confused with panning, even on commercially-available audio equipment. Adjusting the b alance changes the volume level of the output channels, without redirecting the recorded signal. The default setting for balance is "center," meaning 0% change to the volume level. As you adjust the dial from "center" toward the "full left" setting, the volume level of the right output channel is decreased, and the volume level of the left output channel remains constant. As you adjust the dial from "center" toward the "full right" setting, the volume level of the left output channel is decreased, and the volume level of the right output channel remains constant. If you set the dial to "20% left," the audio equipment would reduce the volume level of the right output channel by 20%, increasing the perceived loudness of the left output channel by approximately 20%.
Figure 1.5. Balance You should adjust the balance so that you perceive both speakers as equally loud. Balance compensates for poorly set up listening environments where the speakers are not equal distances from the listener. If the left speaker is closer to you than the right speaker, you can adjust the balance to the right, which decreases the volume level of the left speaker. This is not an ideal solution, but sometimes it is impossible or impractical to set up your speakers correctly. You should adjust the balance only at final playback.
1.4.6. Synchronization
Synchronization coordinates the operation of multiple tools, most often the movement of the transport. Synchronization also controls automation across applications and devices. MIDI signals are usually used for synchronization.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 15/157
27.2.13.
Musicians' Guide
Master bus inputs accept multiplexed audio from many sources. Master bus outputs routed to system playback inputs. Figure 1.6. Routing and multiplexing Multiplexing allows you to connect multiple devices and applications to a single input or output. QjackCtl allows you to easily perform multiplexing. This may not seem important, but remember that only one connection is possible with a physical device like an audio interface. Before computers were used for music production, multiplexing required physical devices to split or combine the signals.
27.2.13.
Musicians' Guide
2.2.2. J C Audio Connection Kit AK 2.2.3. Phonon 2.3. Use the J C Audio Connection Kit AK 2.3.1. Install and Configure J C AK 2.3.2. Using QjackCtl 2.3.3. Integrating P l e u i with J C usAdo AK One of the techniques consistently used in computer science is abstraction. Abstraction is the process of creating a generic model for something (or some things) that are actually unique. The "driver" for a hardware device in a computer is one form of dealing with abstraction: the computer's software interacts with all sound cards in a similar way, and it is the driver which translates the universal instructions given by the software into specific instructions for operating that hardware device. Consider this real-world comparison: you know how to operate doors because of abstracted instructions. You don't know how to open and close every door that exists, but from the ones that you do know how to operate, your brain automatically creates abstracted instructions, like "turn the handle," and "push the door," which apply with all or most doors. When you see a new door, you have certain expectations about how it works, based on the abstract behaviour of doors, and you quickly figure out how to operate that specific door with a simple visual inspection. The principle is the same with computer hardware drivers: since the computer already knows how to operate "sound cards," it just needs a few simple instructions (the driver) in order to know how to operate any particular sound card.
2.2.1. PulseAudio
P l e u i is an advanced sound server, intended to make audio programming in Linux operating systems as easy as usAdo possible. The idea behind its design is that an audio application needs only to output audio to P l e u i . P l e u i usAdo usAdo will take care of the rest: choosing and controlling a particular device, adjusting the volume, working with other applications, and so on. P l e u i even has the ability to use "networked sound," which allows two computers using usAdo P l e u i to communicate as though they were one computer - either computer can input from or output to either usAdo computer's audio hardware just as easily as its own audio hardware. This is all controlled within P l e u i , so no usAdo further complication is added to the software. The Fedora Project's integration of P l e u i as a vital part of the operating system has helped to ensure that audio usAdo applications can "just work" for most people under most circumstances. This has made it much easier for users to carry out basic audio tasks.
2.2.3. Phonon
Phonon is a sound server built into the KDE Software Compilation and is one of the core components of KDE. By default on Fedora Linux, Phonon feeds output to P l e u i , but on other platforms (like Mac OS X, Windows, other versions of usAdo Linux, FreeBSD, and any other system that supports KDE), Phonon can be configured to feed its output anywhere. This is its greatest strength - that KDE applications like Amarok and Dragon Player need only be programmed to use Phonon, and they can rely on Phonon to take care of everything else. As KDE applications increasingly find their place in Windows and especially Mac OS X, this cross-platform capability is turning out to be very useful.
27.2.13.
Musicians' Guide
Important
J C operates with special real-time privileges. You must add all JACK users to the j c u e group. Learn how AK aksr to add users to groups in Chapter 22, Users and Groups of the Fedora Deployment Guide, available at http://docs.fedoraproject.org. Do not add a user to the j c u e group if they will not use J C . aksr AK By default, QjackCtl configures J C to use the 'default' sound card. The 'default' sound card uses all features of the A S AK LA driver even though J C provides the same features. To save memory and processor time, you should configure AK QjackCtl with a specific sound card. 1. Open a terminal. In GNOME, choose Applications System Terminal. In KDE, click on the application launcher, then choose System Konsole. 2. Execute this command: c t / r c a o n / a d a po/sudcrs 3. The cat program outputs a list of sound cards in your computer that looks similarly to this:
0[B S 1[oier MblPe ] HAItl-HAAIS : D-ne D T B HAAIS a 0ff40 iq1 D T B t x7f00 r 6 ] UBAdo-MblPe : S-ui oier MAdoMblPea ub00:01.ui oier t s-000:302
In this example output, the square brackets surround the name of the sound card. The names of the sound cards in this example output are S and M b l P e B oier. 4. Identify the name of the sound card that you want to use. If you do not see your sound card in the list outputted by cat, then your computer does not detect it. 5. Start QjackCtl. 6. Click S t pto open the "Setup" window. eu 7. In the 'Interface' text box, type the name of your preferred sound card with "hw:" in front. With the sound cards listed above, you might write h : o i e r . wMblPe 8. Save your settings by exiting QjackCtl. If you want to use J C , restart QjackCtl. AK
4. Restart P l e u i by running the following command in a terminal: k l a l p l e u i P l e u i usAdo ill usado usAdo restarts automatically.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 18/157
27.2.13.
Musicians' Guide
5. Confirm that this has worked by opening QjackCtl. The display should confirm that J C is "Active". AK 6. In the "Connect" window, on the "Audio" tab, there should be P l e u i devices on each side, and they should usAdo be connected to "system" devices on the opposite sides. 7. Open QjackCtl's "Setup" window, then click on the "Options" tab. Uncheck "Execute script after Shutdown: killall jackd". If you did not make this change, then QjackCtl would stop the J C server from running every time the AK program quits. Since P l e u i is still expecting to use J C after that, you shouldn't do this any more. usAdo AK 8. When P l e u i starts J C , it uses the command found in the ~ . a k r file. QjackCtl automatically usAdo AK /jcdc updates this file when you change settings, but you may have to restart both P l e u i and J C in order to get usAdo AK the new changes to take effect. If they refuse to take effect, you can edit that file yourself. 9. Be careful about using a very high sample rate with P l e u i , since it will tend to use a lot of CPU power. usAdo
27.2.13.
Musicians' Guide
Remember that realtime scheduling does not prevent applications and processes from starting. Realtime scheduling means that, if a low-priority process and a high-priority process both want to use your computer's hardware, the highpriority process will use the hardware first. Also note that applications may appear to stop responding (to "freeze"), if you encounter a situation where a high-priority process uses your computer's hardware and causes the graphics process to wait.
27.2.13.
Musicians' Guide
As stated on the project's home page, it is the goal of Planet CCRMA at Home to provide packages which will transform a Fedora Linux-based computer into an audio workstation. What this means is that, while the Fedora Project does an excellent job of providing a general-purpose operating system, a general purpose operating system is insufficient for audio work of the highest quality. The contributors to Planet CCRMA at Home provide software packages which can tune your system specifically for audio work. Users of GNU Solfege and LilyPond should not concern themselves with Planet CCRMA at Home, unless they also user other audio software. Neither Solfege nor LilyPond would benefit from a computer optimzed for audio production. CCRMA stands for "Center for Computer Research in Music and Acoustics," which is the name of an academic research initiative and music computing facility at Stanford University, located in Stanford, California. Its initiatives help scholars to understand the effects and possibilities of computers and technology in various musical contexts. They offer academic courses, hold workshops and concerts, and try to incorporate the work of many highly-specialized fields. The Planet CCRMA at Home website suggests that they provide most of the software used on the computers in CCRMA's computing facilities. Much of this software is highly advanced and complex, and not intended for everyday use. More adventurous users are encouraged to explore Planet CCRMA's website, and investigate the software for themselves.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
21/157
27.2.13.
Musicians' Guide
Alternatively, there is the possibility of going half-way: installing only some Planet CCRMA applications, but not the fullyoptimized kernel and system components. This would be more suitable for a computer used most often for typical day-today operations (email, word processing, web browsing, etc.) If you wanted to use SuperCollider, but did not require other audio software, for example, then this might be the best solution for you. Ultimately, it is your responsibility to ensure that your computer and its data is kept safely and securely. You will need to find the best solution for your own work patterns and desires.
Note
You can use this procedure for any version of Fedora on both x86 (32-bit) and x86-64 (64-bit) installations. Y m u automatically installs the correct packages. 1. Update your computer with PackageKit, Apper, or y m u. 2. Run the following command in a terminal window:
s - 'u lclntl ht:/cm.tnodeupaecramro/eoalnx\ u c ym oaisal tp/crasafr.d/lntcm/irrfdr/iu/ paecra1/36paecrarp-.-.c6cranac.p lntcm/6i8/lntcm-eo113f1.cm.orhrm
3. Update your computer again. 4. Some packages are available from Fedora and Planet CCRMA. Your computer automatically installs the package with the highest version number.
Warning
Think about your repository priorities carefully. You may accidentally cause y mto not install security updates and u accidentally leave your computer vulnerable to attack. If you want to prevent one or a few packages from being updated, see Section 4.3.3, Prevent a Package from Being Updated for more appropriate instructions. 1. Install the yum-plugin-priorities package. 2. Use a text editor or the cat or less command to verify that / t / u / l g n o f d p i r t e . o fexists, ecympuicn./roiiscn and contains the following text: e a l d = 1 If you want to stop using the plugin, you can edit this file so it nbe . contains e a l d = 0 This does not affect the priorities set in the repository configuration files. nbe . 3. You can set priorities for some or all repositories. To add a priority to a repository, edit its respective file in the / t / u . e o . / directory, adding a line like: p i r t = Nwhere Nis a number between 1and 9 , ecymrpsd* roiy 9 inclusive. A priority of 1is the highest setting, and 9 is the lowest. You will need to set priorities of at least two 9 repositories before this becomes useful.
Warning
Avoid using this plugin unless absolutely necessary. You may cause y mto not install an important security u update, and leave your computer vulnerable to attack. If you want y mto install packages from a specific repository, even when they are available from another repository, see u Section 4.3.2, Set Repository Priorities for more appropriate instructions.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 22/157
27.2.13.
Musicians' Guide
1. Install the yum-plugin-versionlock package. 2. Use a text editor or the c tor l s command to verify that / t / u / l g n o f d v r i n o k c n a es ecympuicn./esolc.of exists, and contains the following text: e a l d = 1If you want to stop using the plugin, you can edit this file so it nbe contains e a l d = 0 nbe . 3. Add the list of packages which you do not want to update to / t / u / l g n o f d v r i n o k l s . ecympuicn./esolc.it Each package should go on its own line. For example:
jc-ui-onc-i-.. akadocnetkt194 qakt-.. jccl036
27.2.13.
Musicians' Guide
6.4. User Interface 6.4.1. Messages Pane 6.4.2. Clock 6.4.3. Track Info Pane 6.4.4. Track Pane 6.4.5. Transport Controls 7. Ardour 7.1. Requirements and Installation 7.1.1. Knowledge Requirements 7.1.2. Software Requirements 7.1.3. Hardware Requirements 7.1.4. Installation 7.2. Recording a Session 7.2.1. Running Ardour 7.2.2. The Interface 7.2.3. Setting up the Timeline 7.2.4. Connecting Audio Sources to Ardour 7.2.5. Setting up the Busses and Tracks 7.2.6. Adjusting Recording Level (Volume) 7.2.7. Recording a Region 7.2.8. Recording More 7.2.9. Routing Audio and Managing J C Connections AK 7.2.10. Importing Existing Audio 7.3. Files for the Tutorial 7.4. Editing a Song (Tutorial) 7.4.1. Add Tracks and Busses 7.4.2. Connect the Tracks and Busses 7.4.3. Add Regions to Tracks 7.4.4. Cut the Regions Down to Size 7.4.5. Compare Multiple Recordings of the Same Thing 7.4.6. Arrange Regions into the Right Places 7.4.7. Listen 7.5. Mixing a Song (Tutorial) 7.5.1. Setting the Session for Stereo Output and Disabling Edit Groups 7.5.2. Set Initial Levels 7.5.3. Set Initial Panning 7.5.4. Make Further Adjustments with an Automation Track 7.5.5. Other Things You Might Want to Do 7.5.6. Listen 7.6. Mastering a Session 7.6.1. Ways to Export Audio 7.6.2. Using the Export Window 8. Qtractor 8.1. View Requirements and Install 8.1.1. Knowledge Requirements 8.1.2. Software Requirements 8.1.3. Hardware Requirements 8.1.4. Other Requirements 8.1.5. Install 8.2. Configure Qtractor 8.2.1. Use Qtractor with J C (QjackCtl) AK 8.2.2. Change Audio Options 8.2.3. Change MIDI Options 8.2.4. Configure MIDI Channel Names 8.3. Use Qtractor 8.3.1. Use the Blue Place-Markers 8.3.2. Use the MIDI Matrix Editor's Tools 8.3.3. Export a Whole File (Audio and MIDI Together)
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 24/157
27.2.13.
Musicians' Guide
8.3.4. Miscellaneous Tips 8.4. Create a MIDI Composition (Tutorial) 8.4.1. Inspiration 8.4.2. Get Files for the Tutorial 8.4.3. Prepare Qtractor 8.4.4. Import the Audio File 8.4.5. Mark the First Formal Area 8.4.6. Create a Theme 8.4.7. Repeat the Theme 8.4.8. Compose the Next Part 8.4.9. Qtractor's Measures 52 to 75 8.4.10. Qtractor's Measures 75 to 97 8.4.11. Qtractor's Measure 97 8.4.12. Qtractor's Measures 98 to 119 8.4.13. Qtractor's Measures 119 to 139 8.4.14. Qtractor's Measures 139 to 158 8.4.15. Qtractor's Measures 158 to 176 8.4.16. Qtractor's Measures 177 to the End 9. Rosegarden 9.1. Requirements and Installation 9.1.1. Knowledge Requirements 9.1.2. Software Requirements 9.1.3. Hardware Requirements 9.1.4. Other Requirements 9.1.5. Installation 9.2. Configuration 9.2.1. Setup JACK and FluidSynth (Qsynth) 9.2.2. Setup Rosegarden 9.3. Rosegarden and LilyPond 9.4. Write a Song in Rosegarden (Tutorial) 9.4.1. Start the Score with a Bass Line 9.4.2. Add a Percussion Track 9.4.3. Spice up the Percussion 9.4.4. Add a Melody 9.4.5. Possible Ways to Continue 10. FluidSynth 10.1. SoundFont Technology and MIDI 10.1.1. How to Get a SoundFont 10.1.2. MIDI Instruments, Banks, Programs, and Patches 10.1.3. MIDI Channels 10.2. Requirements and Installation 10.2.1. Software Requirements 10.2.2. Install FluidSynth 10.2.3. Install with Qsynth 10.2.4. Install without Qsynth 10.2.5. Install SoundFont Files 10.3. Use FluidSynth in a Terminal Emulator 10.4. Configure Qsynth 10.4.1. Start FluidSynth 10.4.2. Configure the SoundFont 10.4.3. Configure JACK Output 10.4.4. Configure MIDI Input 10.4.5. View all FluidSynth Settings 10.5. Assign Programs to Channels with Qsynth 10.5.1. Change the Number of MIDI Input Channels 10.5.2. Save and Reuse Channel Assignments 10.6. Use Reverb and Chorus with Qsynth 10.7. Multiple FluidSynth Instances with Qsynth
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 25/157
27.2.13.
Musicians' Guide
11. SuperCollider 11.1. Requirements and Installation 11.1.1. Knowledge Requirements 11.1.2. Software Requirements 11.1.3. Hardware Requirements 11.1.4. Available SuperCollider Packages 11.1.5. Recommended Installation 11.2. Using GEdit to Write and Run SuperCollider Programs 11.2.1. Enable and Configure SCEd in GEdit 11.2.2. Enable SuperCollider Mode and Start a Server 11.2.3. Executing Code in GEdit 11.2.4. Other Tips for Using GEdit with SuperCollider 11.3. Basic Programming in SuperCollider 11.3.1. First Steps 11.3.2. Variables and Functions 11.3.3. Object-Oriented SuperCollider 11.3.4. Sound-Making Functions 11.3.5. Multichannel Audio 11.3.6. Collections 11.3.7. Repeated Execution 11.3.8. Conditional Execution 11.3.9. Combining Audio; the Mix Class 11.3.10. SynthDef and Synth 11.3.11. Busses 11.3.12. Ordering and Other Synth Features 11.3.13. Scheduling 11.3.14. How to Get Help 11.3.15. Legal Attribution 11.4. Composing with SuperCollider 11.4.1. Files for the Tutorial 11.4.2. Inspiration 11.4.3. Designing the First Part 11.4.4. Designing the Second Part 11.4.5. Creating Ten Pseudo-Random Tones 11.4.6. Scheduling the Tones 11.4.7. Optimizing the Code 11.4.8. Making a Useful Section out of the Second Part 11.4.9. Joining the Two Parts 11.5. Exporting Sound Files 11.5.1. Non-Real-Time Synthesis 11.5.2. Recording SuperCollider's Output (Tutorial) 12. LilyPond 12.1. How LilyPond Works 12.2. The LilyPond Approach 12.3. Requirements and Installation 12.3.1. Learn about Frescobaldi 12.3.2. Requirements and Installation (for Frescobaldi) 12.4. Configure Frescobaldi 12.5. LilyPond Basics 12.5.1. Letters Are Pitches 12.5.2. Numbers Are Durations 12.5.3. Articulations 12.5.4. Simultaneity 12.5.5. Chords 12.5.6. Commands 12.5.7. Source Files 12.5.8. How to Avoid Errors 12.6. Work on a Counterpoint Exercise (Tutorial) 12.6.1. Files for the Tutorial 12.6.2. Start the Score
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 26/157
27.2.13.
Musicians' Guide
12.6.3. Adjust Frescobaldi's Output 12.6.4. Input Notes 12.6.5. Format the Score 12.7. Work on an Orchestral Score (Tutorial) 12.7.1. Files for the Tutorial 12.7.2. Start the Score 12.7.3. Adjust Frescobaldi's Output 12.7.4. Input Notes 12.8. Work on a Piano Score (Tutorial) 12.8.1. Files for the Tutorial 12.8.2. Start the Score 12.8.3. Adjust Frescobaldi's Output 12.8.4. Input Notes 12.8.5. Troubleshoot Errors 12.8.6. Format the Score (Piano Dynamics) 13. GNU Solfege 13.1. Requirements and Installation 13.1.1. Hardware and Software Requirements 13.1.2. Other Requirements 13.1.3. Required Installation 13.1.4. Optional Installation: Csound 13.1.5. Optional Installation: MMA 13.2. Configuration 13.2.1. When You Run Solfege for the First Time 13.2.2. Instruments 13.2.3. External Programs 13.2.4. Interface 13.2.5. Practise 13.2.6. Sound Setup 13.3. Training Yourself 13.3.1. Aural Skills and Musical Sensibility 13.3.2. Exercise Types 13.3.3. Making an Aural Skills Program 13.3.4. Supplementary References 13.4. Using the Exercises 13.4.1. Listening 13.4.2. Singing 13.4.3. Configure Yourself 13.4.4. Rhythm 13.4.5. Dictation 13.4.6. Harmonic Progressions 13.4.7. Intonation
Chapter 5. Audacity
5.1. Learn When to Use Audacity 5.2. View Requirements and Install 5.2.1. Software Requirements 5.2.2. Hardware Requirements 5.2.3. Install 5.2.4. Post-Install Test: Playback 5.2.5. Post-Install Test: Record 5.3. Configuration 5.3.1. Run Audacity for the First Time 5.3.2. Configure Audacity for Your Sound Card 5.3.3. Set the Project's Sample Rate and Format 5.4. Learn the Audacity Interface
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 27/157
27.2.13.
Musicians' Guide
5.5. Record 5.5.1. Start to Record 5.5.2. Continue to Record 5.6. Create a New Login Sound (Tutorial) 5.6.1. Files for the Tutorial 5.6.2. Scenario 5.6.3. Align Tracks 5.6.4. Stretch Tracks 5.6.5. Adjust the Volume Level 5.6.6. Remove Noise 5.6.7. Fade In or Out 5.6.8. Remove Some Audio 5.6.9. Repeat a Previously-Recorded Segment 5.6.10. Add a Special Effect (the Phaser) 5.6.11. Conclusion 5.7. Save and Export 5.7.1. Export Part of a File 5.7.2. Export a Whole File Audacity is a high-quality sound recording application, designed to be easy to use. We recommend Audacity to most computer users, because it is simple but it has many features and capabilities. You do not need to understand advanced computer audio concepts before using Audacity. If you can connect your microphone to your computer, you know enough to use Audacity.
5.2.3. Install
Follow these instructions to install Audacity from the Fedora repository. This version of Audacity does not use an MP3 library, and cannot process MP3 files. Third-party software repositories offer Audacity with MP3 support. 1. Use PackageKit or Apper to install the audacity package. 2. The proposed installation includes Audacity and all of the libraries that Audacity uses. Review the packages you must install, then continue to install Audacity. 3. Audacity configures itself automatically, but it may not use the configuration you want. We recommend you test Audacity before you record, so you know whether Audacity works. Follow the instructions in Section 5.2.4, PostInstall Test: Playback and Section 5.2.5, Post-Install Test: Record to test Audacity.
27.2.13.
Musicians' Guide
1. Start Audacity. 2. Set the volume of your audio interface and speakers to a safe level. 3. Choose File Open to open the Open File window. 4. Open the / s / h r / o n s a s / o s . a file. This file is designed for testing audio equipment. ursaesud/laNiewv 5. Play the file as many times as you need. Adjust the volume of your audio interface and speakers while the file is playing. 6. If you cannot hear sound when the file is played, check that your audio interface and speakers are correctly connected and powered on. 7. If you still cannot hear sound when the file is played, see Section 5.3.2, Configure Audacity for Your Sound Card.
5.3. Configuration
5.3.1. Run Audacity for the First Time
When you run Audacity for the first time, you will be asked to select a language to use for the interface. Before you use Audacity, we encourage you to follow the post-installation test instructions above.
In this example output, the square brackets surround the name of the sound card. The names of the sound cards in this example output are S and M b l P e B oier. d. Identify the name of the sound card that you want to use. If you do not see your sound card in the list outputted by c t then your operating system does not detect it. You should also remember the number of a, the sound card, which is printed to the left of the name. You can use two different sound cards for recording and playback. 2. Start Audacity. 3. Open the "Preferences" window. Choose File > Preferences. 4. Set the "Host" to A S . LA
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 29/157
27.2.13.
Musicians' Guide
5. Set the recording and playback devices to the name of the sound card that you want to use. If there are many choices for your sound card, choose the one that ends with ( w 0 , where 0is replaced by the number of the h:) sound card that you want to use. 6. Follow the post-installation test procedures to confirm that the configuration is correct. You will see many choices in the list of playback and recording devices. When configured with the d f u tdevice, eal Audacity lets ALSA determine which sound card to use. When configured with the p l edevice, Audacity lets PulseAudio us determine which sound card to use. Audacity works most efficiently when configured with a specific sound card, so you should not use the d f u tor p l edevices unless the other choices do not work. eal us
1. The transport controls play, stop, or pause playback of audio. The buttons to record and move quickly through a file are also located here. 2. The tool-selection b ox changes the cursor's function. 3. The two volume level meters display the volume level of stereo audio. The left meter displays the volume level of the output signal. The right meter displays the volume level of the input signal. 4. The ruler displays the time since the start of the file, in minutes and seconds. 5. Each track contains two channels of audio signal data. Audacity stacks tracks vertically in the main window. Audacity plays back all tracks simultaneously. Figure 5.1. The Audacity interface
1. Each track has a track info area, which holds settings like the fader, panner, and m t and s l buttons. ue oo 2. The timeline is the main area of the main window of Audacity. The leftmost point is the beginning of the audio file. Figure 5.2. A track in Audacity
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 30/157
27.2.13.
Musicians' Guide
Refer to the image above as you read about the user interface of Audacity. The "transport controls" play, stop, or pause playback of audio. The buttons to record and move quickly through a file are also located here. The "tool-selection box" changes the cursor's function. The two "volume level meters" display the volume level of stereo audio. The left meter displays the volume level of the output signal. The right meter displays the volume level of the input signal. The "ruler" displays the time since the start of the file, in minutes and seconds. The "timeline" is the main area of the main window of Audacity. The leftmost point is the beginning of the audio file. Each "track" contains two channels of audio signal data. Audacity stacks tracks vertically in the main window. Audacity plays back all tracks simultaneously. Each track has a "track info area," which holds settings like the fader, panner, and m t and s l buttons. ue oo Chapter 6, Digital Audio Workstations contains more information about the Audacity user interface. That chapter defines the purpose and use of many user interface components.
5.5. Record
This section explains possible ways to use Audacity to record.
27.2.13.
Musicians' Guide
5.6.2. Scenario
You tell a friend about some open-source audio applications in Fedora Linux. Your friend wants you to help them make a new sound that will play when they log in to their computer. You search your music CD collection, and find a favourite recording. You and your friend decide to use a few clips from the CD to start your new log-in sound.
27.2.13.
Musicians' Guide
4. Open the "Noise Removal" window. Click O . The Noise Removal tool processes the audio. The Noise Removal K tool is not effective in this example because most of the signal is noise.
5.6.11. Conclusion
Your startup file sounds different than the one that we completed. The tutorial instructions are intentionally vague. You used your own creativity to complete the tutorial. You also learned how to use these tools for many different purposes.
27.2.13.
Musicians' Guide
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
34/157
27.2.13.
Musicians' Guide
If you are looking for a high-quality recording application, or a tool for manipulating one audio file at a time, then you would probably be better off with Audacity. This will be the choice of most computer users, especially those new to computer audio, or looking for a quick solution requiring little specialized knowledge. Audacity is also a good way to get your first computer audio experiences, specifically because it is easier to use than most other audio software. To take full advantage of the features offered by Ardour, Qtractor, and Rosegarden, your computer should be equipped with professional-quality audio equipment, including an after-market audio interface and input devices like microphones. If you do not have access to such equipment, then Audacity may be a better choice for you. If you are simply hoping to create a "MIDI recording" of some sheet music, you are probably better off using LilyPond. This program is designed primarily to create printable sheet music, but it will produce a MIDI-format version of a score if you include the following command in the s o esection of your LilyPond source file: \ i i { } There are a cr md . selection of options that can be put in the m d section; refer to the LilyPond help files for a listing. ii
6.2.1. Recording
Recording is the process of capturing audio regions (also called "clips" or "segments") into the DAW software, for later processing. Recording is a complex process, involving a microphone that captures sound energy, translates it into electrical energy, and transmits it to an audio interface. The audio interface converts the electrical energy into digital signals, and sends it through the operating system to the DAW software. The DAW stores regions in memory and on the hard drive as required. Every time the musicians perform some (or all) of the performance to be recorded, while the DAW is recording, it is considered to be a take. A successful recording usually requires several takes, due to the inconsistencies of musical performance and of the related technological aspects.
6.2.2. Mixing
Mixing is the process through which recorded audio regions (also called "clips") are coordinated to produce an aesthetically-appealing musical output. This usually takes place after recording, but sometimes additional takes will be needed. Mixing often involves reducing audio from multiple tracks into two channels, for stereo audio - a process known as "down-mixing," because it decreases the amount of audio data. Mixing includes the following procedures, among others: automating effects, adjusting levels, time-shifting, filtering, panning, adding special effects. When the person performing the mixing decides that they have finished, their finalized production is called the final mix.
6.2.3. Mastering
Mastering is the process through which a version of the final mix is prepared for distribution and listening. Mastering can be performed for many target formats, including CD, tape, SuperAudio CD, or hard drive. Mastering often involves a reduction in the information available in an audio file: audio CDs are commonly recorded with 20- or 24-bit samples, for example, and reduced to 16-bit samples during mastering. While most physical formats (like CDs) also specify the audio signal's format, audio recordings mastered to hard drive can take on many formats, including OGG, FLAC, AIFF, MP3, and many others. This allows the person doing the mastering some flexibility in choosing the quality and file size of the resulting audio. Even though they are both distinct activities, mixing and mastering sometimes use the same techniques. For example, a mastering technician might apply a specific equalization filter to optimize the audio for a particular physical medium.
6.3.1. Session
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 35/157
27.2.13.
Musicians' Guide
A session is all of the tracks, regions, automation settings, and everything else that goes along with one "file" saved by the DAW software. Some software DAWs manage to hide the entire session within one file, but others instead create a new directory to hold the regions and other data. Typically, one session is used to hold an entire recording session; it is broken up into individual songs or movements after recording. Sometimes, as in the tutorial examples with the Musicians' Guide, one session holds only one song or movement. There is no strict rule as to how much music should be held within one session, so your personal preference can determine what you do here.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
36/157
27.2.13.
Musicians' Guide
6.3.5. Automation
Automation of the DAW sounds like it might be an advanced topic, or something used to replace decisions made by a human. This is absolutely not the case - automation allows the user to automatically make the same adjustments every time a session is played. This is superior to manual-only control because it allows very precise, gradual, and consistent adjustments, because it relieves you of having to remember the adjustments, and because it allows many more adjustments to be made simultaneously than you could make manually. The reality is that automation allows superhuman control of a session. Most settings can be adjusted by means of automation; the most common are the fader and the panner. The most common method of automating a setting is with a two-dimensional graph called an envelope, which is drawn on top of an audio track, or underneath it in an automation track. The user adds adjustment points by adding and moving points on the graph. This method allows for complex, gradual changes of the setting, as well as simple, one-time changes. Automation is often controlled by means of MIDI signals, for both audio and MIDI tracks. This allows for external devices to adjust settings in the DAW, and vice-versa - you can actually automate your own hardware from within a software-based DAW! Of course, not all hardware supports this, so refer to your device's user manual.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
37/157
27.2.13.
Musicians' Guide
Figure 6.4. The Qtractor messages pane The m s a e pane, shown in Figure 6.4, The Qtractor messages pane, contains messages produced by the DAW, esgs and sometimes messages produced by software used by the DAW, such as J C . If an error occurs, or if the DAW does AK not perform as expected, you should check the m s a e pane for information that may help you to get the desired esgs results. The m s a e pane can also be used to determine whether J C and the DAW were started successfully, with esgs AK the options you prefer.
6.4.2. Clock
Figure 6.5. The Qtractor clock The clock shows the current place in the file, as indicated by the transport. In Figure 6.5, The Qtractor clock, you can see that the transport is at the beginning of the session, so the clock indicates 0 This clock is configured to show time in . minutes and seconds, so it is a time clock. Other possible settings for clocks are to show BBT (bars, beats, and ticks a MIDI clock), samples (a sample clock), or an SMPTE timecode (used for high-precision synchronization, usually with video a timecode clock). Some DAWs allow the use of multiple clocks simultaneously. Note that this particular time clock in Qtractor also offers information about the MIDI tempo and metre (120.0 beats per minute, and 4/4 metre), along with a quantization setting for MIDI recording.
The track info pane: note a separate track info space for each of the two tracks that appear in the pane to the right. Figure 6.6. The Qtractor track info pane The track info pane contains information and settings for each track and bus in the session. Here, you can usually adjust settings like the routing of a track's or bus' input and output routing, the instrument, bank, program, and channel of MIDI tracks, and the three buttons shown in Figure 6.6, The Qtractor track info pane: Rfor "arm to record," Mfor "mute/silence track's output," and Sfor "solo mode," where only the selected tracks and busses are heard.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
38/157
27.2.13.
Musicians' Guide
The information provided, and the layout of buttons, can change dramatically between DAWs, but they all offer the same basic functionality. Often, right-clicking on a track info box will give access to extended configuration options. Left-clicking on a portion of the track info box that is not a button allows you to select a track without selecting a particular moment in track pane. The track info pane does not scroll out of view as the track pane is adjusted, but is independent.
1. The ruler, set here to BBT (bars, beats, ticks). 2. Two tracks, presented as graphical representations. The horizontal axis repesents time. 3. A MIDI clip (known as a region in other applications) 4. An audio clip (known as a region in other applications) 5. Scrollbar for the track pane; note that this pane scrolls independently. Figure 6.7. The Qtractor track pane The track pane is the main workspace in a DAW. It shows regions (also called clips) with a rough overview of the audio wave-form or MIDI notes, allows you to adjust the starting-time and length of regions, and also allows you to assign or reassign a region to a track. The track pane shows the transport as a vertical line; in Figure 6.7, The Qtractor track pane it is the left-most red line in the track pane. Scrolling the track pane horizontally allows you to view the regions throughout the session. The left-most point is the start of the session; the right-most point is after the end of the session. Most DAWs allow you to scroll well beyond the end of the session. Scrolling vertically in the track pane allows you to view the regions and tracks in a particular time range.
27.2.13.
Musicians' Guide
4. Transport skip to end 5. Transport forward at real time 6. Arm for recording Figure 6.8. The Qtractor transport controls The transport controls allow you to manipulate the transport in various ways. The shape of the buttons is somewhat standardized; a similar-looking button will usually perform the same function in all DAWs, as well as in consumer electronic devices like CD players and DVD players. The single, left-pointing arrow with a vertical line will move the transport to the start of the session, without playing or recording any material. In Qtractor, if there is a blue place-marker between the transport and the start of the session, the transport will skip to the blue place-marker. Press the button again to the next blue place-marker or the beginning of the session. The double left-pointing arrows move the transport in fast motion, towards the start of the session. The double rightpointing arrows move the transport in fast motion, towards the end of the session. The single, right-pointing arrow with a vertical line will move the transport to the end of the last region currently in a session. In Qtractor, if there is a blue place-marker between the transport and the end of the last region in the session, the transport will skip to the blue place-marker. Press the button again to skip to the next blue place-marker or the end of the last region in the session. The single, right-pointing arrow is commonly called "play," but it actually moves the transport forward in real-time. When it does this, if the transport is armed for recording, any armed tracks will record. Whether or not the transport is armed, pressing the "play" button causes all un-armed tracks to play all existing regions. The circular button arms the transport for recording. It is conventionally red in colour. In Qtractor, the transport can only be armed after at least one track has been armed; to show this, the transport's arm button only turns red if a track is armed.
Chapter 7. Ardour
7.1. Requirements and Installation 7.1.1. Knowledge Requirements 7.1.2. Software Requirements 7.1.3. Hardware Requirements 7.1.4. Installation 7.2. Recording a Session 7.2.1. Running Ardour 7.2.2. The Interface 7.2.3. Setting up the Timeline 7.2.4. Connecting Audio Sources to Ardour 7.2.5. Setting up the Busses and Tracks 7.2.6. Adjusting Recording Level (Volume) 7.2.7. Recording a Region 7.2.8. Recording More 7.2.9. Routing Audio and Managing J C Connections AK 7.2.10. Importing Existing Audio 7.3. Files for the Tutorial 7.4. Editing a Song (Tutorial) 7.4.1. Add Tracks and Busses 7.4.2. Connect the Tracks and Busses 7.4.3. Add Regions to Tracks 7.4.4. Cut the Regions Down to Size 7.4.5. Compare Multiple Recordings of the Same Thing 7.4.6. Arrange Regions into the Right Places 7.4.7. Listen 7.5. Mixing a Song (Tutorial) 7.5.1. Setting the Session for Stereo Output and Disabling Edit Groups 7.5.2. Set Initial Levels 7.5.3. Set Initial Panning 7.5.4. Make Further Adjustments with an Automation Track 7.5.5. Other Things You Might Want to Do 7.5.6. Listen 7.6. Mastering a Session
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
40/157
27.2.13.
Musicians' Guide
7.6.1. Ways to Export Audio 7.6.2. Using the Export Window Ardour is a feature-rich application designed for multi-track recording situations.
7.1.4. Installation
Use PackageKit or Apper to install the ardour package. Other required software is installed automatically.
1. The editor mixer 2. The session sideb ar 3. The main toolbar Figure 7.1. The Ardour interface Figure 7.1, The Ardour interface illustrates three graphical interface components specific to the Ardour interface: the editor mixer, the session sideb ar, and the main toolbar.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
41/157
27.2.13.
Musicians' Guide
1. The fader 2. The fader control 3. The fader level meter 4. The panner 5. The output connection button Figure 7.2. The Ardour editor mixer Figure 7.2, The Ardour editor mixer shows the editor mixer, located at the left of the main Ardour window. The editor mixer shows only one mixer strip at a time. It shows the fader and its controls, in the middle of the mixer strip, the panner and its controls, at the bottom of the mixer strip, and the C m e t and outgoing connections buttons. omns
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
42/157
27.2.13.
Musicians' Guide
1. The tab strip 2. The region list Figure 7.3. The Ardour session sidebar Figure 7.3, The Ardour session sidebar shows the session sidebar, located at the right the main Ardour window. In this image, the R g o stab is selected, so the sidebar shows a list of regions currently in the session. You can see blue ein ones which were directly imported, white ones which were created from blue regions, and the arrows to the left of some blue regions, indicating that there are white-coloured sub-regions associated with those blue regions.
1. Tool selection buttons 2. The s l c / d t o j c button eetei bet 3. The s l c / d t r n ebutton eetei ag 4. The snap mode 5. The grid mode 6. The edit point Figure 7.4. The main Ardour toolbar Figure 7.4, The main Ardour toolbar shows the main toolbar, located underneath the transport controls, and above the timeline and its rulers. In the middle of the toolbar are three unlabeled, but highly useful multiple-choice menus: the snap mode menu (currently set to N G i ); the grid mode menu (currently set to B r ); and then edit point menu (currently o rd as set to M u e To the left of these menus are the tool-selection buttons, the most important of which are the two left-most o s ). buttons: s l c / d t o j c , and s l c / d t r n e eetei bet eetei ag.
27.2.13.
Musicians' Guide
Minutes:Seconds displays the time since beginning of track Timecode displays frames-per-second timecode (usually for work with films) Samples displays the samples since start Refer to Section 1.4.5, Time, Timeline, and Time-Shifting for more information about time measurement. The snap mode menu is located between the timeline and the clocks. This menu controls where regions may move. You need to change these as you work with a session, depending on the current activity. The left menu contains: No Grid: regions can move freely Grid: regions must start on the nearest grid point Magnetic regions can move freely, but when they are near a grid point, they automatically snap to it The middle menu controls where to place the grid lines: by SMPTE timecode, by clock time, by beats and bars, or by regions.
Figure 7.5. The Ardour nudge pane Figure 7.5, The Ardour nudge pane shows the nudge pane, part of the transport. The nudge tool moves a selected region or regions forward or back in the session by a specific amount. The <button moves regions back in the session. The >button moves regions forward in the session. If no regions are selected, the nudge tool moves the transport head. The display to the right of the >button tells you how far a selected region would move. In this case, the nudge tool moves regions by 5 seconds. The timeline contains many rulers that show different time-marking scales. The timeline is located at the top of the canvas area, below the toolbars. Use the context menu (right-click) to select which rulers you want to display. The rulers you should choose depends on the clock settings and the snap mode.
27.2.13.
Musicians' Guide
When Ardour records silence, it behaves no differently from when there is no input at all. When Ardour calculates that a portion of audio is too loud and therefore distorted, it outlines the wave-form representation in red, as shown in Figure 7.6, Audio that is too loud.
Figure 7.6. Audio that is too loud There are three simple strategies that can be used to change the input level of an audio signal: 1. Move the microphone closer or farther from the source 2. Route the microphone through a mixer before it reaches the audio interface 3. Route the audio through a bus in Ardour before it gets recorded Here are the advantages and disadvantages of each approach: There are some circumstances where it is either impractical, impossible, or not advisable to move the microphone or route it through a hardware mixer. In these cases, you can use a bus in Ardour to modify the volume of the input signal before it is recorded. 1. Choose Track Add Track/Bus. 2. Select "busses" in the window that pops up. 3. Choose the number of busses that you wish to add. You need one for every track that you are recording, and of which you want to adjust the volume. It is also possible to record at several different volumes. 4. Set the number of channels that youw ant int he bus. 5. Once you have the new bus, change its name by doing whatever. I suggest naming it something that makes it obvious you are using the bus for recording, rather than exporting, like "REC-Bus." 6. Ardour automatically sets up busses to be used with audio being outputted. Furthermore, the volume/level control only works on audio beign outputted from a track or bus. This is why you cannot use the track's volume/level control to adjust the input volume for that track. 7. Use QjackCtl to reconnect like this (for help, refer to Section 7.2.9, Routing Audio and Managing J C AK Connections): a. Disconnect all of the connections to/from the bus you want to use for recording ("recording bus"). b. Ensure that nothing is connected to the input of the track onto which you want to record ("recording track"). c. Connect the microphone (the input source) to the recording bus' input d. Connect the input bus' output to the recording track's input. e. Ensure that the recording track's output is connected to the "master" input (this is the master output bus, which should be present in all projects, and through which all output audio should be routed). Remember: only one track-to-be-recorded can be routed through a bus for this purpose, because a bus can only output one stream of audio. Here is an algorithm to test whether your tracks are set at a good recording volume. This should be done before arming any tracks for recording. Unfortunately, you can never know that you have chosen the best input level until after a region is recorded. It takes both instinct and experience to be able to choose good input levels reliably. 1. Set up all microphones as required. 2. Set up connections in J C as required. AK 3. Set up any recording busses as required (see above). 4. On the audio tracks being recorded, set the "metering point" to "input" (here's how to do that). 5. Ask the performers to demonstrate the loudest passages they will be doing in the session. Adjust the input level so that the maximum level falls between -3 dB and -6 dB (by looking here). You can reset the maximum-level-seer by clicking on it. 6. Ask the performers to demonstrate the quietest passages they will be performing in the session. Adjust the input level so that this does not fall below -40 dB; it should probably be between -30 dB and -20 dB. 7. Ask the performers to demonstrate an average passage from what they will be performing in the session. This is usually less important than the previous two checks, but if most of the performance will be quieter, it may be worth risking a higher input level in order to capture more detail. Nevertheless, a "moderate" volume level should result in and input level reading of -20 dB to -10 dB. 8. When you are more experience both with the kind of group you are recording, and the software and equipment being used to do it, you may not need to do these level-checks every time. It's better to be safe than sorry, however, because once a musical moment has passed, it is impossible to re-create.
27.2.13.
Musicians' Guide
3. Select the track you're recording onto 4. set the metering point to "input" and verify that it's working correctly and connected to the right thing (say what this does, and why you want to do it now) 5. See "Adjusting Recording Volume" below, and do it now 6. Arm the track for recording: either press "Record" in the track's mixer in the left, or press the small red record button on the track itself 7. the buttons will remain lighted to show that the tracks are armed 8. arm Ardour for recording by select the big red record button on the transport 9. start the transport in in the normal way (big play button) 10. when you're done recording, stop the transport with the big stop button 11. each time you start and stop the transport, a new "region" is produced 12. each time you stop the transport, Ardour "un-arms" itself, but any tracks that you selected are still armed 13. When you've finished recording a region, use the "Regions" box-thing on the right of the interface to rename the region: a. Find the region that you just recorded (by default they are named like "Audio 1-1" which is the name of the recording track followed by a hyphen, then a number in ascending sequeuence representing the "take"). Select it. b. Click on the title, and a box should surround it. c. Change the name to what you want. d. Press enter to finish editing the name.
27.2.13.
Musicians' Guide
7. Arm the tracks that you want to record. Make sure that already-recorded tracks are no longer armed, especially if they are in "tape mode." 8. Arm the transport. 9. When you are ready to record, start the transport rolling.
27.2.13.
Musicians' Guide
2. Right-click anywhere in the box 3. Select "Import to Region List" 4. The "Add existing audio" window will be opeend 5. You can use three different tabs to select an audio file to add: "Browse Files" (does this) (covered here) "Search Tags" (does this) "Search Freesound" (does this) 6. Using "Browse Files," navigate to a sound that you want to add. Although certain other file formats are supported (like FLAC), it is probably best to add WAV or AIFF files. 7. Certain information about the audio file will be displayed on the right-hand side of the window. This portion of the window also allows you to "audition" the file before importing it (that is, you can hear it by using the "Play" and "Stop" buttons in the window, without affecting your current project. 8. If the file that you selected has a sample-rate that is not the same as that of the current project, then the samplerate will be highlighted in red. You can choose to import it anyway, in which case Ardour warns you again. If you import a file in a different sample rate than that of the current project, it will be played back in the project's sample rate. This will result in incorrect speed and pitch. 9. There are a number of other options, displayed along the bottom of the window. 10. You can choose to add files: "as new tracks," which puts each file in its own track, set to normal mode, then adds it to the region list "as new tape tracks," which puts each file in its own track, set to tape mode, then adds it to the region list "to region list," which puts each file in the region list, but does not automatically put it in any tracks. Note that when you choose to automatically create new tracks, Ardour adds the region to the new track, with the region starting at the current location of the transport. 11. The other options in this list are self-explanatory. It is usually best to convert using the best quality, since quality can always be reduced later (which saves space). 12. If you chose not to automatically create tracks, then you will need to add the imported regions into a track before they will be played in your session. You can do this easily by selecting the region from the "Regions" box on the right, and dragging it to a track.
27.2.13.
Musicians' Guide
d. Five busses should appear in the canvas area, named "Bus 1" through "Bus 5", underneath the master bus. 3. Change the busses' names: a. At the left-most side of the canvas area, each bus has a space with controls, including a box with the bus' name. b. To rename a bus, use the mouse to left-click inside the box with the bus' name. c. The box will turn into a text-editing box. Erase the contents, and write the new name. d. When you have entered the new name, press "Enter" on the keyboard to set it in Ardour. e. The box will no longer be a text-editing box. f. Bus-marimba1 Bus-marimba2 Bus-voice Bus-strings Bus-clarinet 4. Create ten new tracks: a. From the menu, select 'Track > Add Track/Bus' b. Adjust the options to add 10 normal mode mono tracks. c. Click 'Add' d. Ten tracks should appear in the canvas area, named "Audio 1" through "Audio 10", underneath the busses. 5. Change the tracks' names in the same way as you changed the busses' names. Remembering that each track here will hold only the left or right audio channel, each one should be pre- or post-fixed with a "0" or "L" for the left channel, or a "1" or "R" for the right channel. They should be called something like: marimba1-L marimba1-R marimba2-L marimba2-R voice-L voice-R strings-L strings-R clarinet-L clarinet-R 6. Finally, we'll re-arrange the order of the tracks and busses. This isn't strictly necessary, and you can user whichever order you think makes the most sense. You might choose, for example, to put the marimba at the bottom, since it will be playing through most of the song. a. Find the session sidebar, to the right of the canvas area. b. There are five tabs to choose: Regions, Tracks/Busses, Snapshots, Edit Groups, and Chunks. Select 'Tracks/Busses' c. All of the tracks and busses are shown in a list, along with a check-box that will show or hide that track or bus in the canvas area. Now you can see why it's a good idea to keep the word "bus" in the names of the busses. d. To change the ordering of tracks and busses, use the mouse to click and drag the name of the track or bus that you want to move. e. When you start dragging a track or bus, a line will appear in the list, marking where the track or bus would go. It can be helpful to move the track or bus that you are dragging to the side a bit, so that you can see the list itself. f. The interface makes it seem like you can move a track or bus on top of another track or bus. This is not the case. If it looks like a track or bus is going to be put on top of another track or bus, it will actually be placed into the list just above that track or bus. g. For editing, it is helpful to have each bus next to the tracks it will control. This can always be changed later.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
49/157
27.2.13.
Musicians' Guide
d. After confirming that the editor mixer is showing the control for the "marimba1-L" track, look at the button on the bottom of the editor mixer, above 'Comments'. It should say "master", which means its output is connected to the master bus. This is not what we want, so click the "master" button. e. When you click the 'master' button, a menu pops up, allowing you to choose a different output. We want to connect the track to the "Bus-marimba1" bus, which isn't in the list, so choose 'Edit' from the menu. f. The connection window that appears looks confusing, but it isn't. Here's how it works: The left side, labeled "Outputs," contains two output channels, "out 1" and "out 2," along with a list of everything to which those outputs are connected. The 'Add' button adds an output channel. We're outputting the signal to a stereo bus, so two is enough. The 'Remove' button removes an output channel. The 'Disconnect All' button removes all of the track's output connections. Clicking a connection in this list will remove it. The right side, labeled "Available connections," contains a list of all of the inputs offered by J C . AK Each J C -aware application has a tab with its connections listed underneath. AK Clicking a connection in this list will add it to the last-selected output channel. g. Click the 'Disconnect All' button. h. Click in the empty "out 1" list. i. From the "Available connections" list, click on the "Bus-marimba1/in 1" connection. It will be added to the "out 1" list. j. Then click on the "Bus-marimba1/in 2" connection. It will be added to the "out 2" list. k. The appearance of the connection lists will change to indicate that you've added a pair of connections. l. Click 'Close' to enable the connection change. m. Note that the "master" button now says something like "Bus-ma," because the track's output connection has changed. 2. The other way to change connections is much faster for large-scale changes like the ones required here. a. Choose Window Track/Bus Inspector. The "Track/Bus Inspector" window will appear. It has a list of the tracks and busses on the left side, and four tabs of information on the right side. The "Inputs" and "Outputs" tabs allow you to view and configure the input and output connections of the selected track or bus. The two "Redirects" tabs allow you to configure plug-in settings, which are not discussed in this tutorial. b. Select the "Bus-marimba1" bus from the list. You should recognize the "Input" and "Output" tabs. Verify that the "marimba1-L" track is connected to this bus' input, and that the bus' output is connected to the "master" bus' inputs. c. Add both outputs of the "marimba1-R" track to the bus' input list. d. Check the outputs of the "marimba1-R" track. This isn't quite what we wanted, so remove the master bus connection. e. Adjust the remaining tracks so that they are connected as described in the table below. f. Verify the connections by viewing the busses' "Input" tabs. g. Verify that only the five busses are connected to the master bus' inputs.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
50/157
27.2.13.
Musicians' Guide
27.2.13.
Musicians' Guide
remove some of the useful clarinet sound, you'll notice that it's still there. In fact, the beauty of trimming regions in this way is that it's "non-destructive," meaning that the entire original region is still there! 10. Notice that when you made the first adjustment, Ardour put an arrow beside the region name in the region list of the session sidebar. If you click on the arrow, you will see that there is another copy of the same region underneath, but it's white. Ardour wants you to know that the white-coloured region is a modification of the bluecoloured region. If you drag the white-coloured region into the canvas area, you'll notice that it starts at the same time as the region you just modified. It can also be dragged out to the full size of the original region, which would create another modified version of the original. While it seems like Ardour stores multiple copies of the region, it actually just stores one copy, and the information required to make it seem like there are many. 11. Adjust the end of the region so that there isn't too much silence after the clarinet. Be extra careful with this, so that you don't cut out any of the clarinet, which gets very quiet at the end of the region. There isn't much to cut off! Note that you cannot click in the coloured bar when adjusting the end of a region, so you'll have to click-and-drag. Here are the instructions to edit the rest of the regions. As you trim the regions, you may find it helpful to move them all towards the start of the session. Remember to change the bus that's in "solo mode" when you move to different tracks, or else you won't be able to hear the tracks you're trying to edit You may also notice that some of these regions contain identical or nearly-identical music, which we'll deal with later. Clarinet Clarinet_2: Starts with sound, but it's not useful, so cut it out, along with the silence after it. End has a good chunk of silence to cut out. Clarinet_3, Clarinet_4: the silence at the beginning and end can be removed, but leave the silence in the middle. Strings: Strings_1: Starts with grumbling noise, which was not intended to be captured. You can keep it or discard as you please - Esther decided to keep it in, and so will I. Strings_2, 3, 4: Silence at the beginning, but only a little at the end. You can cut out the talking, or deal with it later. Voice: Voice_1, 2, 3, 4: Simply remove the silence from beginning and end, leaving the mistakes, which we'll take care of later. ens-Here_Is_How-1, 2, 3: It's too difficult for now to trim all of the extra noise, so just get most of it. The breating and shuffling can be removed later. ens-Create_the_Inconceivable: For now, keep both of the attempts. Later, we'll choose which one we prefer. Marimba: Marimba_1: Don't trim the beginning of this region; we'll use it to time the start of the session. You can trim the silence at the end, but be sure that you don't clip it while the sound of the marimba is still ringing. Marimba_2, 3, 4, 5, 6, 7: Trim the silence around these as desired, still being careful not to clip the marimba while it's still ringing. This may require cautious listening at high volume settings. Now that we have roughly trimmed the silence surrounding the portions of audio that we really want, we'll have an easier time putting them in the right order.
27.2.13.
Musicians' Guide
27.2.13.
Musicians' Guide
2. One way to deal with the Voice_2 region is simply to cut off the first part of the region, which contains the words "I have your flax-" and some near-silence. 3. The second time the singer sings, "I have your flax-," it sounds a bit rushed, so I'm going to combine the first "I have your flax-" with the following "golden tails to ... " a. Use the "Select/Move Ranges" tool to select the first time the singer says "I have your flax-," being careful to capture all of the word "flax," but none of the near-silence that follows. b. Use the loop function of the transport to ensure you've got the right range selected: a. Select a range, then right-click on the range and select 'loop range'. b. If you want to make an adjustment, stop the transport, and adjust the range as desired. c. To listen again, right-click on the range and select 'loop range'. d. You may need to zoom in so that you can adjust the range with sufficient detail. Hold the 'Ctrl' key on the keyboard, and use the scrollwheel to zoom in. e. When you're done with the looping function, remove the looping markers from the timeline. They look like green triangles with the word "Loop" written beside. Move the cursor over a triangle, so that it changes colour. Then press the 'Delete' button on the keyboard. c. When you are happy with the range that you've selected, right-click on the range and choose 'Consolidate range' from the menu. d. Ardour will create a region from the range that you selected, leaving it in-place. It will also divide the space in the region before and after the new region, leaving you with many smaller regions, all conveniently collected in the session toolbar's Regions list, under the blue-coloured "Voice_2--L" and "Voice_2--R" regions. e. Trim the rest of the original Voice_2 region, so that it starts with "golden," and does not contain any of the previous word ("flax-"). You don't need to use the range tool, but you can if you wish. f. Then, push the two regions together, so that it sounds like "I have your flax-golden tails to... " g. This isn't going to sound perfect, but you might prefer it to simply trimming the beginning off the Voice_2 region. h. It's important to remember to move both regions together. If they are accidentally separated, then you can easily enough move them back into place. Voice_3 contains two chunks of audio. We'll leave it alone for now. Voice_4 contains the same two chunks of audio as Voice_3, but goes on to include more. We can't yet determine whether to use Voice_3 or Voice_4 for those two chunks, so we're going to leave them in both regions.
27.2.13.
Musicians' Guide
a. Right-click on the regions, and navigate to the 'Selected regions' menu, then click 'Lock' from that menu. b. Notice that Ardour puts > and < around the name of the region, in the canvas area. c. Also notice that you can no longer move the region with the "Select/Move Objects" tool. 2. Now place a marker to show the exact moment when it starts: six seconds into the session. a. Zoom in appropriately so that you can see where the six-second mark on the ruler should go (but you needn't see it yet). Hold the 'Ctrl' button on the keyboard, and use the mouse's scrollwheel to zoom in, or press the '=' button on the keyboard to zoom in and the '-' button to zoom out. b. Move the cursor to near the six-second mark (again, not important to be precise yet), and right-click in the "Location Markers" row. Select 'New location marker' from the menu. c. Click-and-drag the yellow-green arrow that appears, so that the yellow clock shows 00:00:06.000, indicating six seconds precisely. Release the mouse. d. Move the cursor over the marker, so it changes colours from yellow-green to red-tan (coral). Right-click and select 'Lock' from the menu, so that the marker will not be accidentally moved. e. Again, right-click while the cursor is over the marker. Select 'Rename' from the menu. f. A small window will appear. Write the name of the maker, "marimba-start," and click 'Rename' to set the new name. 3. Since we will be adjusting the placement of regions in the timeline very precisely, we will need to use different "Snap/Grid Mode." Each setting is useful for a different kind of task. We can change the mode using the toolbar just above the canvas area. The pop-down menu probably says "Magnetic," indicating that it's in "Magnetic Snapping Mode," but it might also say "No Grid" or "Grid." No Grid: This mode gives the user full control over where they will place a region. It is useful for doing highlyprecise alignment, as we're about to do. Grid: This mode only allows the user to place regions where they will start on a grid-line. Unless you changed it, your grid is set to two seconds, so you can only start regions in two-second intervals - Ardour will not allow you to place a region so that it starts on an odd-numbered second, or anywhere in between. Magnetic: This mode allows the user to place a region wherever they like, but when the start of the region is near a grid-line (an even-numbered second, in this session), the start of the region will automatically "snap" to that point. It behaves as if the start of regions were magnetically attracted to the grid lines. 4. Adjust the snap/grid mode to "No Grid." 5. Move the "Marimba_2" regions so that they are in the "marimba2" tracks, so that the sound in "Marimba_2" starts at about 15 seconds (00:00:15.000) on the timeline. You'll have to move the grinding of the chairs out of the way, if you decided to keep it. Move it to the "strings" tracks, before the "Strings" regions. 6. Ensure that both the "marimba1" and "marimba2" busses are on solo mode, so you will be able to hear them both. 7. Now here's the difficult part: you'll have to align the two tracks, so that they start together. The sound in the "Marimba_2" regions should start at the same time as the second pattern in the "Marimba_1" tracks, which is at about 15 seconds on the timeline. You'll need to zoom in - it helps to be able to see the wave-form shapes of the regions. More importantly, zooming in allows you to adjust the placement of the regions with greater precision. You may want to select a range, and use the loop mode of the transport. This will allow you to hear the start of the regions again and again, ensuring that they are aligned. If you feel like you've got it close, but not quite together, then try moving it far away, listening, then adjusting it closer again. 8. Once you have aligned the first few seconds of this pattern, it will eventually become unsynchronized, which is okay. The beginning will be the most noticable part; when the listeners become accustomed to the sound of the two marimba tracks together, they will stop paying close attention. Furthermore, they are likely to be focussing on the words by the time the marimba tracks become unsynchronized. 9. Remember to lock the "Marimba_2" region! 10. Listen to the rest of the regions together. The end of the regions, at about 00:02:20.000, should be aligned, if you aligned the start correctly. The higher and lower marimbas will alternate. 11. Move the "Marimba_3" regions so they start at approximately 00:03:20.000, with "Marmiba_3" in the "marimba1" tracks. We will find a final alignment later. 12. Move the "Marimba_4" regions so they start at approximately the same time as the "Marimba_3" regions, but in the "marimba2" tracks. We will find a final alignment later.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
55/157
27.2.13.
Musicians' Guide
5. Slide the "ens-Here_Is_How-2" (and the adjoined "ens-Here_Is_How-3") regions so that they start singing at about 0 : 2 1 . 0 00:150 6. After playing closer attention to "Voice_3" and "Voice_4," you realize that the singer misses a word ("plan in you spider's ear") in "Voice_4." Because "Voice_3" doesn't contain the second part of "Voice_4," we'll need to trim the "Voice_4" region, and use both. a. The singer should start singing in "Voice_3" at about 0 : 2 2 . 0 00:450 b. The signer should start singing "and here is how" in "Voice_4" at about 0 : 2 4 . 0 00:300 7. Slide the "ens-Create_the_Inconceivable" regions so that they start singing at about 0 : 2 5 . 0 00:900
7.4.7. Listen
Before moving on to the mixing stage, listen to the whole song, to make sure that the ordering makes sense. When you're listening, remember that the volume levels and balances will sound off, and that the whole session will sound very "centred" in the stereo image.
7.5.1. Setting the Session for Stereo Output and Disabling Edit Groups
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 56/157
27.2.13.
Musicians' Guide
Part of the reason that the session sounds so bad is that all of the audio has been routed through both the left and right channels equally, making it a "mono" recording, even though we have the material of a "stereo" recording. This could easily have been done sooner, but it wouldn't have made much of a difference until now. Whereas mixing was focussed on getting the regions assembled so that they are like the song, mixing is about fine-tuning the regions and tracks so that they make the song sound great. Disabling the edit groups is also a good idea, because leaving them enabled actually reduces functionality in this stage of production. With edit groups enabled, any change that we make to one of the tracks will automatically be made to the other track, too. We want to be able to adjust the tracks independently; for cases where both tracks need the same adjustment, we will use the sub-master bus to which they're attached. These steps will disable the edit groups, and re-configure this session's tracks for stereo output. 1. We need to adjust tracks independently, so the edit groups must temporarily be disabled. 2. Flip to the "Edit Groups" tab of the session sidebar. 3. Uncheck the "Active" button for all the groups. If you want to re-enable an edit group later, simply re-check the "Active" button. 4. Open the mixer window by selecting from the menu 'Window > Show Mixer'. If you have a multiple-monitor setup, it can be very useful to keep the mixer window on a separate monitor from the main editor window. If you don't have a multiple-monitor setup, you can keep the mixer window on a separate virtual desktop. Of course, these are both optional steps. 5. Near the bottom of each track's mixer, above the buttons, is a small black rectangle with three grey triangles and a green vertical line. Each of the busses have two of these rectangles. This controls the panner, which adjusts a track's left/right position in the stereo image. 6. You can adjust the panner by click-and-dragging in the panner display. You don't need to click on the green line, but the line will show you the approximate placement of the track in the stereo image. 7. Each "left" track, ending with a capital "L," should have the green line set all the way to the left. 8. Each "right" track, ending with a capital "R," should have the green line set all the way to the right. 9. Each bus is probably already set correctly. The bus' upper window represents the left channel, and the green line should be all the way left. The bus' lower window represents the right channel, and the green line should be all the way right. The mixer control located above the panner is called the "fader," and it allows you to adjust a track's level.
27.2.13.
Musicians' Guide
are not actually there. Even so, it can be difficult, tiring, and unpleasant to listen to music where the imagined position of a performer or sound is constantly changing - just as it's difficult and tiring to listen to music which is has poorly balanced levels. As if it weren't already difficult enough, the stereo image is created in our minds as a complex combination of many factors: quieter sounds and later sounds seem to be farther away than louder and earlier sounds. Although the DAW's panner can only put the signal somewhere in a straight line between "all the way left" and "all the way right," our brains process sound as existing in a three-dimensional world. A master audio engineer will be able to control these factors with relative ease, but for us it's going to involve much more trial and error. A particular obstacle with this session is that the regions with the soloist put her in a different imagined position than the regions where the soloist is singing with other singers. Because these happen in the same tracks, we'll use automated panner and fader tracks to help solve this problem. Listen for yourself: start at about 00:02:40.000, and pay attention to where the soloist seems to be standing in the "Voice_4" regions and the "ens-Create_the_Inconceivable" regions. It seems to me like she moves from nearby on the right to a farther distance just to the left; somehow without bumping into the other people in the vocal ensemble, or the strings, which also seem to be in the way! You might argue that most listeners would not pick this up, and that's probably the case. Even so, I would counter that the drastic change of level and panning would be passively detected by those same people, even if they only consciously perceive it as being "not quite right." Here's one way to start: 1. Listen to the session as needed, and see if you can place the location of the instruments/singers throughout most of the session. You'll need to remember this, so consider writing it down, or drawing a map. 2. Now, draw a map of where you think everything should be. Especially in non-standard ensembles like this, there is no pre-defined seating or standing arrangement. Some tracks will need very little adjustment, but others may need extensive adjustment. In general, the less tweaking required, the better the session will sound - so if something seems like a track already has a consistent location, and it doesn't conflict with other tracks, then it's probably better to leave it alone. 3. Here's what I hear. It may be different from what you hear, especially if you happened to do your initial level-setting differently: Both of the marimba tracks are consistent throughout. The "marimba1" tracks seem to be about 5 metres in front of me, of to the left a bit. The "marimba2" tracks seem to be about the same distance away, but almost directly to my right. All of the strings regions seem to be consistent, with the violin placed just left-of-centre, and the 'cello just right-of-centre. They seem to be a bit closer than the marimbas. The clarinet seems to be on the opposite side of the higher marimba; about 5 metres away, half-way between in front and to the left. The vocal ensemble seems to be standing in the same place as the strings, but extending a bit more to the right. The solo vocalist seems to be standing in the same place as the male singers in the vocal ensemble. 4. Here's how I plan to fix it; directions are given assuming the listener is looking north: Establish two rows of performers, surrounding the listener in a semi-circle. The strings will be in the closer row, to the north-west. This requires moving them to the left a bit. The vocal soloist will be in the closer row, just east of north (the middle). This requires moving her to the left just a little bit. The vocal ensemble will be in the closer row, spread from north to north-east, allowing the soloist to remain in the same place. This will mostly require fader adjustment, to make the ensemble seem closer. The lower marimba will be in the outer row, to the north-west. This may not require any adjustment, but perhaps a slight move to the left. The higher marimba will be in the outer row, to the north-east. This requires a slight move to the left. The clarinet will be in the outer row, to the north. This will require significant adjustment to the right. I chose that particular layout because it requires relatively minimal adjustment, and it makes a certain amount of sense in terms of traditional instrumental ensemble seating patterns. Also, the notes played by the clarinet in this song seem suitable to appear as if from far away, and the passages are played with good expression, so I think it will be relatively easy for me to acheive that effect. The most important consideration was the placement of the vocal ensemble and the solo vocalist within it. Although the solo vocalist sings the highest part in the ensemble ("soprano"), the stereo recording seems to indicate that she was not standing at the left-most position in the ensemble (I also know this because I was present during the recording). This adds an extra difficulty, in that the fader and panner settings for the whole voice track must be based on the moment in the "ens-Create_the_Inconceivable" region where the second-highest singer ("alto") sings just after the highest singer, who is the soloist. Make rought adjustments to most of the tracks, to place them in approximately the right space in the stereo image. You may wish to adjust an individual track's panner setting, in addition to the busses' panner settings; they will have a slightly different effect. For the marimba tracks, you may wish to fine-tune things now, adjusting the fader settings. Because these tracks are so consistent, they will require relatively little automation, and therefore will benefit more from a more thorough initial set-up procedure. Remember that it's better to be turning down the fader than turning it up! It's probably easier to avoid working with the voice tracks for now.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
58/157
27.2.13.
Musicians' Guide
So far, we've been crudely adjusting the fader and panner settings manually. This won't work if you want to change the settings while a session is playing; you would have to change all of the settings by yourself, every time you play the session. This quickly becomes complicated - not to mention difficult to remember. "Automation" allows effects (like the panner and fader) to be moved automatically during session playback. An automation track is simply a track that contains no audio, but rather instructions to adjust a particular effect. Automation tracks usually resemble audio tracks, but they hold lines and points, to show the settings changes. Automation tracks can, in effect, be "recorded," but we're going to use a more basic editing method. Automation tracks can be assigned to busses and tracks. Here's how to create an automation track, and fill it in. We're going to adjust the fader on the lower marimba, so that it is louder in the introduction, and becomes quieter as the higher marimba and solo vocalist join in. 1. In the canvas area, click the 'a' button on the "Bus-marimba1" bus' control box, to open the "automation" menu. 2. Click 'Fader' in the automation menu. 3. An automation track, which controls the fader, will appear underneath the bus. 4. If you click in the automation track, a point will appear. Each point represents an absolute setting for the control. After the point appears, if you click-and-drag it, the yellow numbers by the cursor will tell you the fader's setting at that point. 5. If there are two or more points in the automation track, lines will appear to connect them. The fader will be moved gradually between absolute settings, as shown by the line connecting the points. 6. If you make a mistake and want to start over, you can press the 'clear' button on the automation track's control box. Unfortunately, you can't remove a single point. This isn't really necessary anyway; if you accidentally add too many points, simply use the extra one to keep a setting constant. 7. Add one point to the beginning of the automation track, with a setting of 0.0 dB 8. Add one point at about 00:00:15.000, with a setting of 0.0 dB 9. Add one point at about 00:00:16.500 (where the singer starts), with a setting of -10.0 dB, or whatever you set earlier. 10. Now you've set up an automation plan, but the fader is still in "Manual" mode, so the automation track will have no effect. Change the automation track's setting by clicking on the mode button in the track's control box. The button currently says "Manual." 11. From the menu, select "Play," which will cause the automation settings to be played. In "Manual" mode, you have to adjust all settings manually. In "Write" mode, changes that you make as the session plays will be recorded into the automation track, over-writing previous settings. In "Touch" mode, changes that you make as the session plays will be incorporated into the pre-existing automation settings. 12. Finally, listen to confirm that you like the automated panner change. If you don't, you can always adjust it now or later. Now - here's the difficult part! Use automation to change the fader and panner settings throughout the session. In particular, ensure that the voice tracks are consistent.
7.5.6. Listen
When you have finished mixing the song, you must listen to it. You should listen to it with as many different devices as possible: headphones, speakers, home theater systems, and so on. You should also ask your friends and colleagues to listen to your work. Other people hear things differently from you, and will give you different feedback.
27.2.13.
Musicians' Guide
2. by range, or 3. by session. To export a region: 1. Ensure the region is placed in the canvas area. 2. Right-click on the region. 3. Select the region-name's menu, then 'Export'. 4. Continue with the Export window. To export all audio in a range on the timeline: 1. Select the range with the "Select/Move Ranges" tool. Regardless of which track you select, all tracks can be exported. 2. Right-click on the range. 3. Select 'Export' from the menu. 4. Continue with the Export window. To export all audio in a session: 1. From the menu, select 'Session > Export > Export > Export session to audiofile', or on the keyboard, press 'Ctrl + Alt + e' 2. Continue with the Export window.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
60/157
27.2.13.
Musicians' Guide
A higher sample rate (explained in Section 1.3.3, Sample Rate allows a greater amount of audio information to be stored, but increases the size of audio files. "Convesion quality" and "dither type" are not available options for the file formats offered in Fedora Linux. The "CD Marker File Type" allows you to export a CUE- or TOC-format list of CD tracks in the exported file. This is most useful when exporting a whole session, which contains a whole CD, that would be subsequently burned to disc.
Chapter 8. Qtractor
8.1. View Requirements and Install 8.1.1. Knowledge Requirements 8.1.2. Software Requirements 8.1.3. Hardware Requirements 8.1.4. Other Requirements 8.1.5. Install 8.2. Configure Qtractor 8.2.1. Use Qtractor with J C (QjackCtl) AK 8.2.2. Change Audio Options 8.2.3. Change MIDI Options 8.2.4. Configure MIDI Channel Names 8.3. Use Qtractor 8.3.1. Use the Blue Place-Markers 8.3.2. Use the MIDI Matrix Editor's Tools 8.3.3. Export a Whole File (Audio and MIDI Together) 8.3.4. Miscellaneous Tips 8.4. Create a MIDI Composition (Tutorial) 8.4.1. Inspiration 8.4.2. Get Files for the Tutorial 8.4.3. Prepare Qtractor 8.4.4. Import the Audio File 8.4.5. Mark the First Formal Area 8.4.6. Create a Theme 8.4.7. Repeat the Theme 8.4.8. Compose the Next Part 8.4.9. Qtractor's Measures 52 to 75 8.4.10. Qtractor's Measures 75 to 97 8.4.11. Qtractor's Measure 97 8.4.12. Qtractor's Measures 98 to 119 8.4.13. Qtractor's Measures 119 to 139 8.4.14. Qtractor's Measures 139 to 158 8.4.15. Qtractor's Measures 158 to 176 8.4.16. Qtractor's Measures 177 to the End Qtractor is a relatively new application, created and maintained by the same developers who are responsible for QjackCtl and Qsynth (both covered in other chapters of this Guide). It offers much more flexibility than Audacity, but is still easier to use than Ardour or Rosegarden. We therefore recommend Qtractor for users who are new to software-based DAWs. Qtractor is easy to use, but also very powerful. Simplicity is what makes Qtractor useful. After the initial learning curve, you will be able to complete almost every audio or MIDI project with Qtractor. The Qtractor interface offers simple, intuitive, point-and-click interaction with clips, integrated control of JACK connections, MIDI control integration with external devices and other MIDI-aware software, and support for LADSPA, DSSI, native VSTi, and LV2 plug-ins. Beginners and advanced users alike will enjoy Qtractor.
27.2.13.
Musicians' Guide
8.1.5. Install
Follow these instructions to install Qtractor from the Fedora repository. This version of Qtractor does not use an MP3 library, and cannot process MP3 files. Third-party software repositories offer Qtractor with MP3 support. 1. Use PackageKit or Apper to install the qtractor package. 2. The proposed installation includes Qtractor and all of the libraries that Qtractor uses. Review the packages you must install, then continue to install Qtractor. 3. Qtractor configures itself automatically, but it may not use the configuration you want. We recommend you test Qtractor before you record, so you know whether Qtractor works.
Important
The Qtractor "Connections" window looks like the QjackCtl "Connections" window, but they are not the same. Connections on the "MIDI" tab in Qtractor appear on the "ALSA" tab in QjackCtl. Connections on the "MIDI" tab in QjackCtl are not available in Qtractor. Qtractor does not automatically control Qsynth or FluidSynth.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
62/157
27.2.13.
Musicians' Guide
outputs" option outputs the audio metronome's signal through separate outputs in JACK. This is Ardour's default behaviour.
27.2.13.
Musicians' Guide
4. The blue place-marker should follow the mouse. If it doesn't, then try again. It is sometimes difficult to select the place-marker.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
64/157
27.2.13.
Musicians' Guide
3. Use Qtractor's "Connections" window (press F8 on the keyboard) to ensure that the output from your MIDI synthesizer is routed to the input for the newly-created audio track. 4. Move Qtractor's transport to the start of the session. 5. Ensure that only the newly-created audio track is armed for recording. 6. Arm Qtractor's transport for recording. 7. Press "Play" on the transport, and wait as the session plays through. 8. When you have reached the end of the session, stop the transport. Qtractor will not automatically stop the transport. 9. Export the file as you normally would by clicking 'Track > Export Tracks > Audio'. After the audio version of the MIDI signal is recorded, and you have exported the session, you may wish to delete the new audio track.
8.3.4.1. Transport
You can move Qtractor's transport to a particular point in a session by holding Shift as you use the mouse to click on that point. You can choose whether or not you want the track pane to automatically scroll as the transport moves by clicking 'Transport > Follow Playhead'.
8.3.4.2. MIDI
When creating a MIDI track, you can use the "omni" check-box to allow the track to respond to input from any MIDI channel. If the check-box is unselected, the track will respond only to signals on its assigned MIDI channel. In the matrix editor window, you can adjust the "velocity" (loudness) of a note by using the "Resize" MIDI Tool (see Section 8.3.2, Use the MIDI Matrix Editor's Tools above) If you find it difficult to work with Qtractor's matrix editor, but you find it easy to work with LilyPond, you can use this to your advantage. LilyPond will output a MIDI-format representation of your score if you include a "midi" section in the "score" section. It should look something like this:
\cr soe { .. . \ii{} md }
You can import LilyPond MIDI output in Qtractor. Choose Track Import Tracks MIDI.
8.4.1. Inspiration
This tutorial demonstrates a particular strength of Qtractor: combine audio and MIDI tracks in one project. We started this tutorial with a part of one of our favourite musical works. Then we created a MIDI-based "alter-ego" to accompany the favourite work. The audio recording contains a "theme and variations" movement, so the recording begins with a theme, then continues with modified versions of the theme. The theme has two parts, both repeated once. The original composer used several standard compositional techniques of their time period, so the music sounds similarly throughout, but constantly changes in subtle ways. We are not required to follow the aesthetic rules that Beethoven followed. Some people think we cannot possibly follows the aesthetic rules that Beethoven followed. If we create new music for solo piano, we are already aware of 150 years' worth of music that stretched Beethoven's aesthetic rules. In this tutorial, we use the matrix editor in Qtractor, which does not resemble conventional Western musical notationwe cannot hope to achieve a similar result. This tutorial explores the artistic possibilities of a combination of early 19th century chamber music and early 21st century electronic music. Finally, we encountered problems when we prepared this tutorial because we cannot distribute the audio recording that we used to create the MIDI component. Therefore, you will probably use a different audio recording than we used. Even when you follow our directions precisely, your result will be quite different from our result.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
65/157
27.2.13.
Musicians' Guide
27.2.13.
Musicians' Guide
e. To scroll sideways, you can hold down either Shift or Ctrl and use your mouse's scroll wheel. 3. Move to transport just before the end of the segment you added: use Shift-click. 4. Listen to the end to ensure that your segment ends with or before the end of the first formal area. 5. Close the matrix editor window. 6. Use the main window to view the MIDI segment which you just inputted. The vertical lines represent barlines, and the darker rectangles represent notes. 7. If the MIDI segment extends beyond the last note that you inputted, click-and-drag the end so that there isn't much over-hang. If you accidentally adjust it too far and remove notes, then simply drag the segment back out - the notes should still be there. 8. Return to the matrix editor by double-clicking on the MIDI segment. 9. Select all of the notes that you have inputted so far: Press Control-a Click-and-drag to select, or Click on 'Edit > Select > Select All' 10. Randomize the pitches: a. Click on 'Tools > Randomize' b. Ensure that "Randomize" is checked c. Ensure that "Note" is checked (this means "pitch") d. Choose a percentage. e. Click "OK" to apply. f. You may need to experiment with the percent of randomization that you allow. Greater randomization means a lower chance of repetition, but it also means that the pitches will be spread within a smaller range. g. If you want to re-try the randomization, click on 'Edit > Undo Randomization', then use the "Randomize" tool again. h. If you like what happens to most of the pitches, you can select and move a few of them either individually or together. To adjust pitches as a group, select the ones that you want to move (either by click-and-drag select or by Control-click select), and Control-drag them to the desired new location. 11. Now you need to adjust the volume of the pitches. There are two ways to do this: You can select all of the pitches, then use the "Resize MIDI" tool, adjusting the "Value" property. You can select all of the pitches, then use the value editor portion of the matrix editor window. This is at the bottom of the matrix editor window, and the height of each pitch shown here tells you the volume at which it will play. To adjust all of the pitches at once, Control-drag to adjust the height as desired. Be careful when doing this that you don't change the horizontal position, which will change the time that the notes sound. I would suggest at volume of approximately "32," but this depends on your taste. Also, I adjust the volume of some pitches to be louder when the audio file is louder. 12. When you are satisfied with your pitches and volumes, start the transport from the beginning, and listen to the entire segment that you just created. You can change the section again or move on to the next step.
27.2.13.
Musicians' Guide
end of the segment, I included a brief gathering of "randomized" pitches, with longer durations than before. There is no particular reason that I included this chord-like incident, but it felt like the right thing to do. 1. Listen to the next portion of the audio file, and mark off the next formal section that you want to use (mine is from Qtractor's measure 25 to beat to of measure 38). The portion that I chose is also repeated, like the first part. 2. Place the blue markers at the beginning and end of the segment that you chose. 3. Create a new MIDI clip. 4. Create the notes separated by three beats, as in the last segment. This time, be sure to add two notes at the same time, by ensure that they are aligned vertically. Again, it doesn't matter which pitches you choose, because they will be randomized. 5. Select all of the pitches, and randomize them by using the "Randomize MIDI" tool. 6. Depending on how the pitches are randomized, each pair of notes will probably end up in one of the following situations: They are too close or share a particular intervallic relationship that makes them sound like one note. They are too far or share a particular intervallic relationship that makes them sound like two notes. They share a particular intervallic relationship that makes them sound like one chord built of two equal chords. Depending on your aesthetic preferences, you may wish to change some of the notes so that one or some of these situations are avoided. 7. I created the tone cluster at the end by clicking arbitrarily across bar 37. It happened to create six notes with the pitches G, E, C-sharp, F-sharp, G-sharp, and B. I could have used the "Randomize MIDI" tool, but chose not to. 8. Then I carefully click-and-dragged the right-most end-point of each pitch, so that they all ended at the same time: the first beat of measure 38. 9. When you're done, you may need to copy-and-paste the segment.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
68/157
27.2.13.
Musicians' Guide
In this passage, I kept the "a note followed by three beats of rest" idea, then added onto the melody by taking two cues from the audio file. The first was the increasing surface rhythm of the upper part, which gave rise to the "threedescending-notes" figures. The second was the fact that the chords are still going on underneath that melody, so I added a second randomized set of notes underneath my upper part. At the end of the passage I continued the trend that I started with a finishing flourish that picks up sustained notes.
Chapter 9. Rosegarden
9.1. Requirements and Installation 9.1.1. Knowledge Requirements 9.1.2. Software Requirements 9.1.3. Hardware Requirements
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 69/157
27.2.13.
Musicians' Guide
9.1.4. Other Requirements 9.1.5. Installation 9.2. Configuration 9.2.1. Setup JACK and FluidSynth (Qsynth) 9.2.2. Setup Rosegarden 9.3. Rosegarden and LilyPond 9.4. Write a Song in Rosegarden (Tutorial) 9.4.1. Start the Score with a Bass Line 9.4.2. Add a Percussion Track 9.4.3. Spice up the Percussion 9.4.4. Add a Melody 9.4.5. Possible Ways to Continue
9.1.5. Installation
Use PackageKit or Apper to install the rosegarden4 packge. PackageKit automatically installs other required software.
9.2. Configuration
9.2.1. Setup JACK and FluidSynth (Qsynth)
Follow these instructions to setup JACK and Qsynth. Then follow the instructions in Section 9.2.2, Setup Rosegarden to connect Rosegarden with JACK and Qsynth. 1. Start QjackCtl to control JACK. 2. Start Qsynth to control FluidSynth. FluidSynth starts automatically. 3. Start Rosegarden. 4. Configure Qsynth to use the "alsa_seq" MIDI driver. Refer to Section 10.4.4, Configure MIDI Input. 5. You may want to disconnect all JACK connections except the connections you will use with Rosegarden. Use the QjackCtl "Connect" window to make these connections: On the "Audio" tab: The Qsynth output ports connect to the "system" input ports. If you only use MIDI in Rossegarden, and you do not use audio in Rosegarden, you do not need further connections on the "Audio" tab. If you use audio in Rosegarden, ensure the "master out" ports connect to the "system" input ports. If you use audio in Rosegarden, ensure the "record monitor" ports connect to the "system" input ports. If you use audio in Rosegarden, ensure the input ports connect to the "system" outputput ports. Note that Rosegarden can record from two independent sources ("1" and "2"), with two channels ("L" for left and "R" for right) from each, to produce a stereo recording. On the "MIDI" tab: Nothing. On the "ALSA" tab: a. Connect the Rosegarden output ports to the "FLUID synth" input ports:
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 70/157
27.2.13.
Musicians' Guide
1:sync out (sends MIDI control messages) 2:external controller (for the first set of MIDI instruments in the session) 3:out 2 - General MIDI Device (for the second set of MIDI instruments in the session) b. If you want Rosegarden to accept commands from other MIDI devices, connect these Rosegarden input ports to the other devices' output ports: 0:record in 2:external controller We recommend that you disconnect all ports unless you need to connect them. If you have an extra connection, you may accidentally send a signal, and produce undesirable results.
This MIDI file can then be imported into Rosegarden by selecting from the menu 'File > Import > Import MIDI File'. Unfortunately, this will erase the current session, so it can be done only once. It is also possible to export MIDI tracks to LilyPond format, which can then be edited further or simply turned into a score. To do this, from the menu select 'File > Export > Export LilyPond File'. After you select a location to save the file, Rosegarden allows you to control some score settings while exporting. After exporting a LilyPond file, you should inspect it with Frescobaldi before relying on it to be correct - computers sometimes make mistakes!
27.2.13.
Musicians' Guide
a. Change the clef. Click on the bass clef on the toolbar at the left side of the editor window. Then click on the existing clef to replace it. b. Switch to the note-inputting tools as required. They're located next to the clef tools, in the toolbar at the left of the notation editor window. c. Input three quarter-notes on c, two eighth notes on c and g, two quarter-notes on e-flat, and four eighth notes on d, f, d, and g. 7. You'll probably make a few mistakes. The easiest way to fix a mistake is to erase the note/s and re-input the correct note/s. You can use the eraser tool for this. It's located on the top toolbar of the score editing window, to the left of the capital "T," and to the right of the red pencil. It looks like a red and white rectangle, which represents a standard white eraser. 8. Listen to your creation by clicking on the 'play' button in the transport window. The playhead won't stop until you stop it, even though the visible playhead (the vertical line) will stop. 9. Close the notation editor - you don't need to click the 'save' button, because Rosegarden will automatically keep your changes. 10. You should save the file, though. 11. Click the "Select and Edit" tool, which looks like a mouse cursor on the toolbar. You can also select that tool by pressing 'F2' on the keyboard. 12. Select the segment you just created by clicking on it. 13. Create a copy of it by holding the 'Ctrl' key on the keyboard, as you click-and-drag the segment. 14. Place the copy in the same track, immediately after the first segment. 15. Create a few more copies like this. 16. Use the transport to move the playhead to the start (click the button that looks like a vertical bar with a singledirection arrowhead pointing towards it). 17. Name the newly-created track by double-clicking on its name. A window will pop up, allowing you to rename the track. If you don't know what to call it, try "Bass line."
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
72/157
27.2.13.
Musicians' Guide
11. Now the segment repeats forever. This can be useful, but eventually you'll want to stop the song. When you want to change the repeats into copies, from the menu select 'Segment > Turn Repeats Into Copies'. 12. Adjust the first track so that it's repeated, too.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
73/157
27.2.13.
Musicians' Guide
10.5. Assign Programs to Channels with Qsynth 10.5.1. Change the Number of MIDI Input Channels 10.5.2. Save and Reuse Channel Assignments 10.6. Use Reverb and Chorus with Qsynth 10.7. Multiple FluidSynth Instances with Qsynth FluidSynth is a software-based MIDI synthesizer. FluidSynth accepts MIDI input from programs like Qtractor and Rosegarden, and uses SoundFont technology to create audio signals. This makes FluidSynth a very flexible tool; it can be used even on low-power computers, doesn't require specialized hardware, and can take advantage of a wide selection of high-quality MIDI instruments. When used with the Qsynth graphical interface, FluidSynth becomes even more powerful: users can easily control basic effects like chorus and reverb, and they can start multiple FluidSynth synthesizers, each with their own settings and MIDI instrument assignments. Finally, because Qsynth was created and is maintained by the same developers as Qtractor and QjackCtl, it provides a familiar interface, and integrates well with these other applications.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
74/157
27.2.13.
Musicians' Guide
27.2.13.
Musicians' Guide
6. Highly-observant users may notice that the SELinux context of the new file is different from that of any Fedorainstalled SoundFont file. As long as the type is u r t which it should be by default, then there is no practical s_, difference (no difference in enforcement) between this and a Fedora-installed SoundFont file. If you don't know what this means, or if you hadn't noticed it, then it means that this additional SoundFont file should not create a new potential security problem.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
76/157
27.2.13.
Musicians' Guide
3. To assign a program to a channel, click on the row of the channel that you want to assign. 4. Select the bank and program number that you want, using the name, SFID, and Soundfont columns to guide you. 5. Repeat this process for all of the channels that you wish to assign. 6. If you are not going to use a channel, there is no harm in assigning it a program anyway. However, assigning a program to a channel that you will not use can lead to confusion, especially if you later forget that you intended to not use that channel. 7. Remember that channel 10 is reserved for percussion instruments, and should not be changed from a General MIDI percussion program.
27.2.13.
Musicians' Guide
2. Search through the "Preset Name" drop-down box to find the name of the preset that you wish to restore. 3. Select it, and verify that the correct channel assignments were restored.
27.2.13.
Musicians' Guide
11.1. Requirements and Installation 11.1.1. Knowledge Requirements 11.1.2. Software Requirements 11.1.3. Hardware Requirements 11.1.4. Available SuperCollider Packages 11.1.5. Recommended Installation 11.2. Using GEdit to Write and Run SuperCollider Programs 11.2.1. Enable and Configure SCEd in GEdit 11.2.2. Enable SuperCollider Mode and Start a Server 11.2.3. Executing Code in GEdit 11.2.4. Other Tips for Using GEdit with SuperCollider 11.3. Basic Programming in SuperCollider 11.3.1. First Steps 11.3.2. Variables and Functions 11.3.3. Object-Oriented SuperCollider 11.3.4. Sound-Making Functions 11.3.5. Multichannel Audio 11.3.6. Collections 11.3.7. Repeated Execution 11.3.8. Conditional Execution 11.3.9. Combining Audio; the Mix Class 11.3.10. SynthDef and Synth 11.3.11. Busses 11.3.12. Ordering and Other Synth Features 11.3.13. Scheduling 11.3.14. How to Get Help 11.3.15. Legal Attribution 11.4. Composing with SuperCollider 11.4.1. Files for the Tutorial 11.4.2. Inspiration 11.4.3. Designing the First Part 11.4.4. Designing the Second Part 11.4.5. Creating Ten Pseudo-Random Tones 11.4.6. Scheduling the Tones 11.4.7. Optimizing the Code 11.4.8. Making a Useful Section out of the Second Part 11.4.9. Joining the Two Parts 11.5. Exporting Sound Files 11.5.1. Non-Real-Time Synthesis 11.5.2. Recording SuperCollider's Output (Tutorial) SuperCollider is many things, but above all: An audio synthesis engine, A flexible programming language, and An interpreter to transform the programming language into synthesis instructions.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
79/157
27.2.13.
Musicians' Guide
Interpreter at http://en.wikipedia.org/wiki/Interpreter_%28computing%29: This reads your code, and sends commands to the server, which causes it to produce sound. Server at http://en.wikipedia.org/wiki/Server_%28computing%29: SuperCollider has a 'server' component, which is operated by the interpreter. Functional Programming at http://en.wikipedia.org/wiki/Functional_programming: SuperCollider can be treated as a "functional" language. Imperative Programming at http://en.wikipedia.org/wiki/Imperative_programming: SuperCollider can be treated as an "imperative" language. Ob ject-Oriented Programming at http://en.wikipedia.org/wiki/Object-oriented_programming: SuperCollider can be treated as an "object-oriented" language.
27.2.13.
Musicians' Guide
If this window gives a non-zero value for "RESULT," then an error has probably occurred, and you should scroll up to see what it is, and try to fix it. If you receive the following warning: "The GUI scheme 'swing' is not installed" then you will not be able to run any SuperCollider prorams that use a GUI (graphical user interface). The GUI components are not used anywhere in this Guide, and they are highly optional. 5. You will probably also want to start a server at this point, so from the menu select 'SuperCollider > Start Server'. 6. After the server starts, you should see messages from "JackDriver". If a JACK server is not already started, then SuperCollider will start one automatically. 7. If the SuperCollider server started successfully, you should see a message similar to this:
Sproldr3sre ray. ueClie evr ed. JcDie:mxotu ltny4. m akrvr a upt aec 64 s ntfcto i o oiiain s n
27.2.13.
Musicians' Guide
5. If the server successfully executes the code, then it will output something to the "SuperCollider output" pane. The output will be different, depending on what SuperCollider asked the server to do, but will usually either look like this:
Snh"ep0:10) yt(tm_" 00
or this:
RSL =0 EUT
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
82/157
27.2.13.
Musicians' Guide
As with all examples in this section, you should paste these programs into GEdit, and execute them with SuperCollider. Look at the output produced by the programs, but don't worry about it for now. These programs are very small, but it highlights some key concepts of the SuperCollider language, described below.
11.3.1.4. Statements
A "statement" is a single instruction, which always ends with a semicolon. Exactly what constitutes a statement will become clear as you gain experience, and you will eventually automatically remember the semicolon. In the Hello World Programs above, all of the statements contain the single instruction to post a line to the output screen. What happens when you remove the first semicolon, which marks the end of the first statement? The SuperCollider interpreter produces an unhelpful error message, and tells you that an error occurred after the forgotten semicolon. This is why it is important to always remember statement-concluding semicolons.
27.2.13.
Musicians' Guide
Is the last example a number or a string? You and I recognize that it is a number inside a string, but SuperCollider treats it as a string. You can do string things with it, but you cannot do number things with it. You cannot add " "to something, 6 for example. Try executing the following single-line programs. Think about why the SuperCollider interpreter produces the output that it does. 6+3 ; ""+3 6 ; "i"+3 sx ;
It doesn't make sense to say "hello" and "goodbye" at the same time, so separating these sections with parentheses will serve as a reminder. In case we try to execute all of the code at once, the SuperCollider interpreter will give us an error.
11.3.2.1. Variables
A variable is a symbol that can be assigned an arbitrary value. A "symbol" is a series of alphabetic and numeric characters, separated by whitespace (a space, a line-break, or the end of the file). When a variable is "assigned" a value, the variable name (the symbol) is understood to be a substitute for the assigned value. Consider a traffic light, which has three possible symbols: green, yellow, and red. When you are driving, and you encounter a traffic light, you might see that its red symbol is activated (the red light is illuminated). What you see is a red light, but you understand that it means you should stop your car. Red lights in general do not make you stop - it is specifically red traffic lights, because we know that it is a symbol meaning to stop. SuperCollider's variables work in the same way: you tell the interpreter that you want to use a symbol, like c e s . Then hee you assign c e s a value, like 5 After that point, whenever you use c e s , the interpreter will automatically know that hee . hee what you really mean is 5 . Run the following two programs. They should result in the same output.
( 5+5 ; ) ( vrx a ; x=5 ; x+x ; )
In the first example, the program calculates the value of 5 + 5 which is 1 , and returns that to the interpreter, which , 0 prints it out. In the second example, the program tells the interpreter that it wants to use a variable called xthen it assigns cheese the value 5 Finally, the program calculates c e s + c e s , which it understands as meaning 5 + 5 and . hee hee , returns 1 to the interpreter, which prints it out. 0 This trivial use of a variable does nothing but complicate the process of adding 5 to itself. Soon you will see that variables can greatly simplify your programs.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
84/157
27.2.13.
vrvralNm; a aibeae
Musicians' Guide
Variables can be assigned a value at any time after they have been declared. Any single object can be assigned to a variable. If a variable is already assigned a value, any subsequent assignment will erase the previous assignment; the previously-assigned value will is not retrievable. The first assignment to a variable is said to "initialize" the variable. Initialization is a special kind of assignment, because a variable cannot be used before it is initialized. If a program attempts to use an un-initialized variable, the SuperCollider interpreter will cause an error. For this reason, you should always initialize a variable when you declare it. There is a special way to do this:
vrvralNm =nl a aibeae i;
Since you can't always assign a useful value, you can pick an arbitrary one. Assigning "nil" is common practice, because it means "nothing," but without actually being nothing (this avoids some errors). Assigning zero is another possibility; it is standard practice in many programming languages, and will avoid most errors, even if the variable is eventually supposed to hold another kind of object. Intialization and declaration of multiple variables can also be done as a list:
vrvralNm =0 vralOhrae=0 a aibeae , aibeteNm ;
Single-letter variable names have a special purpose in SuperCollider. They are already declared, so you don't have to declare them. They are also already initialized to "nil", so you don't have to do that either. These variable names are intended to be used as a quick fix, while you're experimenting with how to make a program work. You should not use them in good-quality programs. The single-letter variable "s" is automatically assigned to the server on the computer running the interpreter. You should avoid re-assigning that variable. Variable names must always begin with a lower-case letter. Use variables to write programs that do the following tasks: 1. Perform arithmetic with an uninitialized variable. An error should appear when the program is executed. 2. Calculate the value of y if all other values are known, for the quadratic equation: y = a * x * x + b * x + c , 3. Re-write the Hello World Program so that it will say "Hello" to a name stored in a variable. Remember that you can use the interpreter to automatically output the last line of a function.
11.3.2.3. Functions
A Function is a statement, or a series of statements, that we want to use many times. When a Function is assigned to a variable, you can execute the Function as many times as you wish. Any statements that happen between braces { like this; } are treated as a Function. Functions are executed by passing them the "value" message, as in the following example. Here is a Function that is not assigned to a variable, and is executed once.
{"el,Wrd"psl;}vle Hlo ol!.otn .au;
Notice that there are two semicolons: one after the statement within the Function, and one after the "value" message that tells the Function to execute. Here is a Function with identical function, assigned to a variable, and executed twice.
vrmFnto ={"el,Wrd"psl;} / nt tosmcln a yucin Hlo ol!.otn ; / oe w eioos mFnto.au; yucinvle mFnto.au; yucinvle
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
85/157
27.2.13.
( vrgetr= a ree { agnm; r ae ("el"+nm )psl; Hlo ae .otn } ; getrvle "aata ) ree.au( Smnh" ; getrvle "emi") ree.au( Jran ; nl i; )
Musicians' Guide
Here is how the program works: 1. A variable named g e t ris declared, and assigned a Function. ree 2. The Function contains an argument called n m , and outputs "Hello" plus the name given to it. ae 3. The parentheses here ( " e l " + n m )ensure that the two strings are added together b efore the p s l Hlo ae otn message prints them out. 4. The g e t rvariable is used to call the Function with two different names. ree 5. The n l statement is optional, and does not affect the operation of the program. What it does is return a i; "nothing" value to the interpreter after program execution completes, so that the last message is not repeated. Since every argument has a name, SuperCollider allows you to use that name when executing the function. This example executes the g e t rfunction from the last example: ree
getrvle nm:MugWu") ree.au( ae"yn-hn ;
This is more useful if there are many arguments, and you do not remember the order that they appear in the Function's definition. SuperCollider also allows you to specify default values for arguments, so that they do not need to be specified. This allows optional customization of a Function's behaviour, and is therefore very powerful. This example modifies the one above by adding default-value arguments, and by calling arguments with their name. As you can see, I've been tricking you a bit: p s l is actually a Function, but a special kind, explained later. otn
( vrgetr= a ree { agnm,getn ="el" r ae reig Hlo; psl(getn +nm ) otn reig ae ; } ; getrvle "aata ) ree.au( Smnh" ; getrvle "emi" "ody") ree.au( Jran, Gobe ; getrvle nm:MugWu") ree.au( ae"yn-hn ; getrvle getn:Bevne,nm:Mre") ree.au( reig"ineu" ae"acl ; nl i; )
Any value can be used as a parameter, as long as the Function expects it. In fact, even Functions can be used as parameters for Functions!
Here is how the program works: 1. A Function and variable are created, and assigned values. 2. This line s m N m e = m s i a M t . a u ( s m N m e ) executes the m s i a M t function, which oeubr ytclahvle oeubr ; ytclah multiplies its argument by 2 and returns the value. Then, it assigns the return value of the Function to 3 s m N m e . In any statement that contains an assignment, the assignment is always done last. In other words, oeubr
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
86/157
27.2.13.
Musicians' Guide
the Function in this example will always be given an argument of 9 and only after the Function completes , execution and returns a value will that value be assigned to s m N m e . oeubr 3. The new value of s m N m e is displayed. oeubr The program could have been shortened like this:
( vrmsiaMt = a ytclah { agipt=0 r nu ; ipt*2; nu 3 } ; vrsmNme =msiaMt.au(9) a oeubr ytclahvle ; smNme.otn oeubrpsl; nl i; )
Experiment with the shortened versions of the program, ensuring that you know why they work.
Because f n t o declares its own copy of z r , it is modified independently of the variable z r declared before the ucin eo eo Function. Every time f n t o is executed, it re-declares its own z r , and the interpreter keeps it separate from any ucin eo other variables with the same name. When f n t o has finished executing, the interpreter destroys its variables. ucin Variables declared inside any Function are only ever accessible from within that Function. This is why, when we try to execute s x e n p s l ; the interpreter encounters an error: s x e nexists only within f n t o , and is not ite.otn, ite ucin accessible outside the function. By the way, in order to excute this example, you will need to remove the error-causing reference to s x e n ite. Now consider the scope of the variables in this example:
( vrzr =0 a eo ; vrfnto = a ucin { vrsxen=1; a ite 6 zr =8 eo ; zr.otn / awy pit 8 eopsl; / las rns sxenpsl; ite.otn } ; fnto.au; ucinvle zr.otn / awy pit 8 eopsl; / las rns )
Why does the last line always print 8 It's because z r was set to 8within f n t o . More importantly, f n t o did ? eo ucin ucin not declare its own copy of z r , so it simply accesses the one declared in the next "highest" block of code, which exists eo between (and )in this example.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 87/157
27.2.13.
Musicians' Guide
This is why it is important to pay attention to a variable's scope, and to make sure that you declare your variables in the right place. Unexpected and difficult-to-find programming mistakes can occur when you forget to declare a variable, but it is declared elsewhere in your program: you will be allowed to use the variable, but it will be modified unexpectedly. On the other hand, it can be greatly advantageous to be able to access variables declared "outside the local scope" (meaning variables that are not declared in the same code block in which they are used), but careful thought and planning is required. Astute readers will notice that it is possible to re-declare the single-letter variable names, allowing you to control their scope. Consider the following program:
( vra=0 a ; b= { vrc=1; a 6 a=8 ; apsl; .otn cpsl; .otn } ; bvle .au; apsl; .otn )
This example requires careful examination. What is the scope of a b and c The answers may be surprising. , , ? ais declared just after the (character, so the interpreter destroys it upon reaching the )character. cis declared just after the {character, so the interpreter destroys it upon reaching the }character. bis not declared in this program, so it refers to the automatically-declared variable with that name. The interpreter does not destroy it until it is restarted or stopped. This means that the Function assigned to bis still available after the program finishes execution. Try it! Execute the program above, and then execute this single-line program alone: bvle .au;
Declare the variables, set the variables, do a calculation, and print the result of the calculation. This is a simple example, and a simple model, but it is very difficult to escape completely. After all, humans think of large problems in terms of algorithms (the instructions needed to do something). Computers solve large problems, so being able to program them with a series of instructions makes sense.
SuperCollider will always execute the inner-most Functions first. This is how the interpreter executes the single-line program above: 1. Execute the left call of g t n u eipt
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 88/157
27.2.13.
Musicians' Guide
2. Execute the right call of g t n u eipt 3. Execute a dwith the two numbers returned by g t n u d eipt 4. Execute p s l with the number returned by a d otn d Both imperative and functional programming have advantages and disadvantages. SuperCollider will allow you to use either approach, or a mix of both, when solving problems.
27.2.13.
Musicians' Guide
If it looks too complicated, then it probably is. The more difficult it is to understand something, the greater the chance of making a mistake. Don't forget the semicolons at the end of every statement.
11.3.4.1. UGens
"UGen" stands for "unit generator." UGens are special Objects that generate either an audio or a control signal. The UGen that will be used for most of the experimentation in this Guide, and which was primarily used to generate the "Method One" program that goes with this Guide, is called S n s , which generates a sine wave. The class' name, iOc S n s means "sine oscillator." iOc The example at the beginning of this chapter, S n s . r 4 0 0 0 2 ) produces an "instance" of the S n s iOca( 4, , . ; iOc class, which continuously outputs a signal, based on the parameters given in parentheses. This instance produces an "audio rate" signal, which means that it is of sufficient quality to eventually become sound. A slightly modified version of that code will give us a "control rate" signal: S n s . r 4 0 0 0 2 ) There is only iOck( 4, , . ; one small difference between the two examples - for us - but for SuperCollider, the difference is huge. A control rate signal will not be of sufficient quality to become sound; it is used to control other UGens that do become sound. Unlike other Classes, UGen Classes should not be instantiated with the n wmessage. They should always be e instantiated as either audio-rate (by passing the a message), or control-rate (by passing the k message). Control-rate r r signals are calculated much less often than audio-rate signals, which allows the SuperCollider interpreter and server to save processing power where it wouldn't be noticed.
The first example is written from an object-oriented perspective. Functions know how to play their return value, when passed the p a message. This is true of all Functions whose return value is an audio-rate UGen. The second example ly is written from a functional perspective. The Function called p a will play its input, which must be a Function whose ly return value is an audio-rate UGen. Whether you should write p a in the functional or object-oriented way depends on ly which makes more sense to you. Try to re-write the above example so that the p a function operates on a variable-defined Function. ly The arguments to S n s , whether the audio- or control-rate generator, are these: iOc The first is called f e ; it sets the frequency. rq The second is called a d it is added to all values produced by the UGen. d; The third is called m l all values produced by the UGen are multiplied by this. u; You now know enough to spend hours with the sine oscillator UGen. Try combining audio- and control-rate UGens, and try to figure out what happens when each of the arguments is adjusted. Be careful that your audio interface's volume isn't set too high! Experiment with this one:
( vrmFeuny= Sns.r fe:,ml20 ad40) a yrqec iOck( rq1 u:0, d:0 ; vrsud={Sns.r mFeuny 0 02) } a on iOca( yrqec, , . ; ; pa(sud) ly on ; )
27.2.13.
Musicians' Guide
The easiest way to output multichannel audio in SuperCollider is to use a kind of "Collection" (defined later) called an "Array." SuperCollider will theoretically handle any number of audio output channels, but by default is usually only configured for two-channel stereo audio. Since humans have only two ears, this is sufficient for most tasks! A multichannel array is notated like this: [ L f C a n l a ( x ) R g t h n e . r y ) ] ethne.r , ihCanla( Here is our simple sine oscillator expanded to produce stereo audio:
{[Sns.r 40 0 02) Sns.r 40 0 02)] }pa; iOca( 4, , . , iOca( 4, , . ; .ly
Not much has changed, except that the audio we hear is now being emitted from both the left and right channels. Change the frequency of one of the sine oscillators to 4 0and the difference will become much more apparent. 5 Multichannel arrays can also be combined with each other, like this:
{ vroe=[x y z] a n , , ; vrto=[a b c] a w , , ; [oe to] n, w ; }
If a b c x y and zwere all audio-rate UGens, this function could be p a 'ed. It would produce stereo audio, and each , , , , , ly channel would have three independent UGens.
The second example can be easier to read, because it is obvious that only the frequency is changing - or in this case, that nothing is changing. This technique is more useful in a situation like the following:
{Sns.r [40 45 40 45 40 45, iOca( [4, 4, 5, 5, 6, 6] [4,45 40 45 40 45] 40 4, 5, 5, 6, 6], 0 , 02) }pa; . ; .ly
That's not exactly easy to read, but it's easier to figure out than the most obvious alternative:
{ [ Sns.r 40 0 02) Sns.r 45 0 02) Sns.r 40 0 02) [ iOca( 4, , . , iOca( 4, , . , iOca( 5, , . , Sns.r 45 0 02) Sns.r 40 0 02) Sns.r 45 0 02)] iOca( 5, , . , iOca( 6, , . , iOca( 6, , . , [Sns.r 40 0 02) Sns.r 45 0 02) Sns.r 40 0 02) iOca( 4, , . , iOca( 4, , . , iOca( 5, , . , Sns.r 45 0 02) Sns.r 40 0 02) Sns.r 45 0 02)]; iOca( 5, , . , iOca( 6, , . , iOca( 6, , . ] }pa; .ly
More importantly, multichannel expansion gives us another tool to avoid repetition. Repetition is the enemy of correctness - it's so much more difficult to find a mistake in the second example than in the first!
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
91/157
27.2.13.
{
Musicians' Guide
/ st u tefeuniso bt canl / es p h rqece f oh hnes vrfeuny =Sns.r fe:0 ml20 ad40) / oclaig a rqecL iOck( rq1, u:0, d:0 ; / siltn vrfeuny =Sns.r fe:,ml5,ad10) / oclaig a rqecR iOck( rq1 u:0 d:5 ; / siltn vrfeuny_rn =Sns.r fe:.3 ml2,ad10) / doe a rqecLdoe iOck( rq00, u:0 d:0 ; / rn vrfeuny_rn =Sns.r fe:.1 ml2,ad20) / doe a rqecRdoe iOck( rq00, u:0 d:1 ; / rn / cagstevlm o teoclaigpr i telf canl / hne h oue f h siltn at n h et hne vrvlmL=Sns.r fe:.,ml00,ad00 ) a oue iOck( rq05 u:.2 d:.3 ; / lf canl / et hne vrlf =[Sns.r fe:rqecL mlvlmL) / ti i teoclaigpr a et iOca( rqfeuny, u:oue , / hs s h siltn at Sns.r fe:feuny_rn,*rqecLdoe,ml00 ) / te iOca( rq[rqecLdoe2feuny_rn] u:.2 , / h rs mk u tedoe et ae p h rn Sns.r fe:5feuny_rn,*rqecLdoe,ml005) iOca( rq[*rqecLdoe7feuny_rn] u:.0 , Sns.r fe:1*rqecLdoe2*rqecLdoe,ml001)] iOca( rq[3feuny_rn,8feuny_rn] u:.0 ; / rgtcanl / ih hne vrrgt=[Sns.r fe:rqecR ml01) / ti i teoclaigpr a ih iOca( rqfeuny, u:. , / hs s h siltn at Sns.r fe:feuny_rn,*rqecRdoe,ml00 ) / te iOca( rq[rqecRdoe2feuny_rn] u:.2 , / h rs mk u tedoe et ae p h rn Sns.r fe:*rqecRdoe ml005) iOca( rq4feuny_rn, u:.0 , Sns.r fe:6*rqecRdoe18feuny_rn] ml00 )] iOca( rq[4feuny_rn,2*rqecRdoe, u:.1 ; / hg feunis / ih rqece! [lf,rgt] et ih ; }
11.3.6. Collections
A "collection" is just that - a collection of Objects. Collections are simply a means of organizing a large amount of data, without having to assign a variable name for each portion of data. Compared to other programming languages, SuperCollider provides a relatively large number of Collections in the standard library. We have already seen an example of a Collection as multichannel audio arrays. An Array is a kind of Collection - in object-oriented terminology, the Array Class is a sub -class of the Collection Class, and inherits its behaviours. Conversely, the Collection Class is the super-class of the Array Class. The Collection Class itself is not to be used; it is designed to provide common features so that it is easier to write Classes for collections. As with all the chapters from this point on, it is not necessary to read this in sequence. If you prefer, you can skip it and return later when you need to manage a large set of data.
11.3.6.1. Array
Arrays have been traditionally been very popular with programmers. In SuperCollider, they are capable of storing a large number of Objects, and they provide advanced behaviours that are normally not associated with Arrays. They are not as indespensible as they used to be. Most programming languages now provide (or can easily be extended to add) Lists, Trees, and other kinds of data storage structures, which offer more capabilities, and are easier to use and to think about. Users new to programming might find the various kinds of Lists to be more helpful. 11.3.6.1.1. Building an Array An Array is a Collection with a finite maximum size, determined at declaration time. It is the programmer's responsibility to maintain a meaningful order, and to remember the meaning of the data. Data in an Array is called "elements," each of which is assigned a specific "index number." Index numbers begin at 0. Any mix of Objects can be stored in an Array, including an Array. This example declares an Array, adds some elements, then prints them out.
( vrt =Arynw 2) / "A sad fr"etra" a A ra.e( ; / t" tns o tsAry t =t.d(5) A Aad ; t =t.d(3) A Aad ; t =t.d(1 ) A Aad 7 ; t.otn Apsl; nl i; )
Notice that Array is a Class, and it must be instantiated before use. Here, the variable t is assigned an Array with A enough space for two objects. Notice that the elements are printed out in the order that you add them to the Array. They are not sorted or shuffled (unless you send a message like s r m l ). But why did I write t = t . d ( 1 ) cabe A Aad 7 ; instead of t . d ( 1 ) ? Shouldn't the second method be sufficient for adding an Object to an Array, thereby making Aad 7 ; the re-assignment unnecessary? It does, but let's see what happens when we take it away:
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
92/157
27.2.13.
(
Musicians' Guide
vrt =Arynw 2) / "A sad fr"etra" a A ra.e( ; / t" tns o tsAry t.d(5) Aad ; t.d(3) Aad ; t.d(1 ) Aad 7 ; t.otn Apsl; nl i; )
The 1 is missing - it doesn't get added into the Array! This is because the Array was only declared with two slots, and 7 you can't add three Objects into two slots. So why did this work the first time? SuperCollider was programmed to help us fit additional items into an Array. If an Array has reached its capacity, SuperCollider will automatically make a new, larger Array for us, and returns that from the a dmethod. Therefore, any time you add an element to an Array, you should always d re-assign the result, so that you don't have to worry about whether you exceeded the Array's capacity. 11.3.6.1.2. Accessing an Array's Elements There are two ways to access individual elements within an Array. One way is object-oriented, and one way is more traditional, inspired by programming languages such as the wildly popular "C" language. The object-oriented style uses the a and p tmethods. The traditional style uses square brackets with an index number. t u The following examples produce equivalent output. The first uses the object-oriented style, and the second uses the traditional style.
( vrt =Arynw 3) a A ra.e( ; t =t.d(5) A Aad ; t =t.d(3) A Aad ; t =t.d(1 ) A Aad 7 ; t.t 0)psl;/ otus5 Aa( .otn / upt t.t 1)psl;/ otus3 Aa( .otn / upt t.t 2)psl;/ otus1 Aa( .otn / upt 7 t.u(0 2 ) / asgs2 t eeet0 Apt , 4 ; / sin 4 o lmn t.t 0)psl;/ otus2 Aa( .otn / upt 4 nl i; ) ( vrt =Arynw 3) a A ra.e( ; t =t.d(5) A Aad ; t =t.d(3) A Aad ; t =t.d(1 ) A Aad 7 ; t[]psl;/ otus5 A0.otn / upt t[]psl;/ otus3 A1.otn / upt t[]psl;/ otus1 A2.otn / upt 7 t[]=2 ;/ asgs2 t eeet0 A0 4 / sin 4 o lmn t[]psl;/ otus2 A0.otn / upt 4 nl i; )
11.3.6.2. List
An List is a Collection with an infinite maximum size. It is the programmer's responsibility to maintain a meaningful order, and to remember the meaning of the data. Data in a List is called "elements," each of which is assigned a specific "index number." Index numbers begin at 0. Any mix of Objects can be stored in a List, including a List. Lists and Arrays are very similar, but SuperCollider manages some of the dirty work for you, when you use the List Class. 11.3.6.2.1. Building a List There are four methods which instantiate a List. These are all "Class methods," meaning they do not operate on a specific List, but can be used to make any List. L s . e creates a List. You can also specify the initial number of elements as an argument, if you choose. itnw L s . e C e r x )creates a List with xnumber of slots, filled with n l itnwla( i. L s . o y n t n e a i t )creates a List which is a copy of a i t itcpIsac( Ls Ls. L s . e U i g a A r y )creates a List with the same elements as a A r y itnwsn( nra nra.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
93/157
27.2.13.
Musicians' Guide
11.3.6.2.2. Adding to an Existing List These are "instance methods," meaning that they operate on a specific list. p t i d x , i e )adds i e into the List at index number i d x u( ne, tm tm ne. a d i e )adds i e to the end of a List. d( tm tm a d i s ( i e )adds i e to the beginning of a List. dFrt tm tm 11.3.6.2.3. Accessing a List These are "instance methods," meaning that they operate on a specific list. a ( i d x )returns the Object assigned to the i d xindex number. If i d xis greater than the last element in the t ne ne ne List, returns n l i. c i A ( i d x )returns the Object assigned to the i d xindex number. If i d xis greater than the last element lpt ne ne ne in the List, returns the last element in the List. w a A ( i d x )returns the Object assigned to the i d xindex number. If i d xis greater than the last element rpt ne ne ne in the List, returns an element based on a "wrap-around" index number. For a three-element List, 0will return element 0 1returns 1 2returns 2 3returns 0 4returns 1 5returns 2 6returns 0 and so on. , , , , , , , f l A ( i d x )returns the Object assigned to the i d xindex number. If i d xis greater than the last element odt ne ne ne in the List, returns an element based on a "fold-back" index number. Whereas w a A ( always continues from the rpt) lowest to the highest index number, f l A ( changes every time: low to high, high to low, low to high, and so on. odt) 11.3.6.2.4. Removing from a List One way to remove an element from a List is to re-assign that element's index number the value n l These two i. Functions also remove elements from a List. They are "instance methods," meaning that they operate on a specific list. p preturns the last element in a List, and removes it from the List. o r m v A ( i d x )removes the element assigned to i d xindex number, removing it from the List and shrinking eoet ne ne the List. r m v A ( does not leave a n lelement in the List. eoet) i 11.3.6.2.5. Examples The following examples show different ways to use List's.
( vrt =Ls.e; a L itnw t.d(4 ) Lad 2 ; t.d(80) Lad 2 ; psl(t.o ) / otus80 otn Lpp ; / upt 2 t.d(7) Lad ; t.d(1 ) Lad 9 ; t.d(2 ) Lad 3 ; psl(t.o ) / otus2 otn Lpp ; / upt 3 psl(t.o ) / otus1 otn Lpp ; / upt 9 psl(t.o ) / otus7 otn Lpp ; / upt psl(t.o ) / otus4 otn Lpp ; / upt 2 psl(t.o ) / Ls i epy s w gt"i" otn Lpp ; / it s mt, o e e nl nl i; )
This code adds numbers to the end of a List, then removes them from the end of the List.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
94/157
27.2.13.
( vrt =Ls.e; a L itnw t.dFrt 4 ) Ladis( 2 ; t.dFrt 80) Ladis( 2 ; psl(t.o ) / otus4 otn Lpp ; / upt 2 t.dFrt 7) Ladis( ; t.dFrt(1 ) Ladis 9 ; t.dFrt(2 ) Ladis 3 ; psl(t.o ) / otus80 otn Lpp ; / upt 2 psl(t.o ) / otus7 otn Lpp ; / upt psl(t.o ) / otus1 otn Lpp ; / upt 9 psl(t.o ) / otus2 otn Lpp ; / upt 3
Musicians' Guide
This modification of the first example adds numbers to the beginning of a List, then removes them from the end of the List. This is one way to ensure that the List elements are removed in the same order that they are added.
( vrt =Ls.e; a L itnw t.d(4 ) Lad 2 ; t.d(80) Lad 2 ; psl(t.eoet 0)) / otus4 otn LrmvA( ; / upt 2 t.d(7) Lad ; t.d(1 ) Lad 9 ; t.d(2 ) Lad 3 ; psl(t.eoet 0)) / otus80 otn LrmvA( ; / upt 2 psl(t.eoet 0)) / otus7 otn LrmvA( ; / upt psl(t.eoet 0)) / otus1 otn LrmvA( ; / upt 9 psl(t.eoet 0)) / otus2 otn LrmvA( ; / upt 3 / / ) psl(t.eoet 0)) / cue a err otn LrmvA( ; / ass n ro! nl i;
This modification of the first example adds numbers to the end of a List, then removes from the beginning of the List. This is another way to ensure that the List elements are removed in the same order that they're added. Note that, when the List is empty, using the "removeAt()" Function causes an error, because you try to access a List index which doesn't exist.
( vrt =Ls.e; a L itnw t =[28071,3; L 4,2,,92] t.t 0)psl;/ otus4 La( .otn / upt 2 t.t 1)psl;/ otus80 La( .otn / upt 2 t.t 2)psl;/ otus7 La( .otn / upt t.t 3)psl;/ otus1 La( .otn / upt 9 t.t 4)psl;/ otus2 La( .otn / upt 3 t.t 5)psl;/ otusnl La( .otn / upt i t.t 6)psl;/ otusnl La( .otn / upt i nl i; )
This example shows another way to add elements to an empty List, which also works for Arrays. Then it shows what happens when you try to access elements beyond the end of a List with the "at()"Function.
( vrt =Ls.e; a L itnw t =[28071,3; L 4,2,,92] t.lpt 0)psl;/ otus4 LciA( .otn / upt 2 t.lpt 1)psl;/ otus80 LciA( .otn / upt 2 t.lpt 2)psl;/ otus7 LciA( .otn / upt t.lpt 3)psl;/ otus1 LciA( .otn / upt 9 t.lpt 4)psl;/ otus2 LciA( .otn / upt 3 t.lpt 5)psl;/ otus2 LciA( .otn / upt 3 t.lpt 6)psl;/ otus2 LciA( .otn / upt 3 nl i; )
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
95/157
27.2.13.
Musicians' Guide
This example shows what happens when you try to access elements beyond the end of a List with the "clipAt()" Function. For index numbers beyond the end of the List, the interpreter will simply return the last element.
( vrt =Ls.e; a L itnw t =[28071,3; L 4,2,,92] t.odt 0)psl;/ otus4 LflA( .otn / upt 2 t.odt 1)psl;/ otus80 LflA( .otn / upt 2 t.odt 2)psl;/ otus7 LflA( .otn / upt t.odt 3)psl;/ otus1 LflA( .otn / upt 9 t.odt 4)psl;/ otus2 LflA( .otn / upt 3 t.odt 5)psl;/ otus1 LflA( .otn / upt 9 t.odt 6)psl;/ otus7 LflA( .otn / upt nl i; )
This example shows what happens when you try to aceess elements beyond the end of a List with the "foldAt()" Function. For index numbers beyond the end of the List, the interpreter will start moving back through the List, towards the first element, "folding" through the List.
( vrt =Ls.e; a L itnw t =[28071,3; L 4,2,,92] t.rpt 0)psl;/ otus4 LwaA( .otn / upt 2 t.rpt 1)psl;/ otus80 LwaA( .otn / upt 2 t.rpt 2)psl;/ otus7 LwaA( .otn / upt t.rpt 3)psl;/ otus1 LwaA( .otn / upt 9 t.rpt 4)psl;/ otus2 LwaA( .otn / upt 3 t.rpt 5)psl;/ otus4 LwaA( .otn / upt 2 t.rpt 6)psl;/ otus80 LwaA( .otn / upt 2 nl i; )
This example shows what happens when you try to access elements beyond the end of a List with the "wrapAt()" Function. For index numbers beyond the end of the List, the interpreter will start again at the beginning of the List, "wrapping" around to the beginning.
11.3.6.3. LinkedList
Linked lists are very common structures for data management in computer science. They are more efficient than arrays for many tasks, particularly when it's impossible to know how many elements will be required in an array until the program is run. SuperCollider's List Class is implemented with arrays, and it offers nearly the same functionality as the LinkedList class. A true linked list is accessed most efficiently from the start (called the "head" of the list) or the end (called the "tail"). Each element is linked to the one before it, the one after it, or both. SuperCollider's LinkedList Class has elements which are linked both to the preceding and following elements, so it is called a "doubly linked list." Knowing when to use a LinkedList over a List is a question of efficiency, and for small collections of information, it isn't going to make a big difference - you might as well use a basic List. When you plan to store hundreds or thousands of elements, choosing the right Class becomes more important, and can save a lot of processor time. Here is how to know which Class you should use: If you're going to be adding elements to the start or end of the list, and accessing from the start or end of the list, the LinkedList Class will be more efficient. If you're going to be adding elements at arbitrary index numbers inside the list, and accessing elements at arbitrary index numbers inside the list, the List Class will be more efficient. If you're going to be adding elements to the start or end, but accessing specific indices, or adding elements at specific indices, but accessing from the start or end, then you get to choose where to save computation time. In one of these cases, it might not matter which one you choose. 11.3.6.3.1. Efficient Functions These Functions make use of the LinkedList Class in an efficient way. They are efficient because they access only the first or last element in the LinkedList. a d o j )adds o jto a LinkedList as the last item. d( b b a d i s ( o j )adds o jto a LinkedList as the first item. dFrt b b p premoves the last item in a LinkedList and returns it. o p p i s removes the first item in a LinkedList and returns it. oFrt f r treturns a copy of the first item in a LinkedList. is l s returns a copy of the last item in a LinkedList. at
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
96/157
27.2.13.
Musicians' Guide
11.3.6.3.2. Inefficient Functions These Functions make use of the LinkedList Class in an inefficient way, but they can be useful. They are inefficient because they may potentially have to review all of the elements in a LinkedList before completing. a ( i d x )pretends the LinkedList is an Array, and returns a copy of what would be the element at the given index t ne number. p t i d x , o j )pretends the LinkedList is an Array, and changes the element at the given index number to u( ne, b be o j b. r m v ( o j )searches through a LinkedList and removes the element judged to be equal to o j regardless of eoe b b, its index number. r m v A ( i d x )pretends the LinkedList is an Array, and removes the element located at the given index eoet ne number. 11.3.6.3.3. Example This example uses a LinkedList as a queue, adding numbers to the tail, and removing and printing from the head.
( vrt =LneLs.e; a L ikditnw t.d(4 ) Lad 2 ; t.d(8 ) Lad 9 ; t.oFrtpsl;/ pit 4 Lppis.otn / rns 2 t.d(26) Lad 5 ; t.oFrtpsl;/ pit 8 Lppis.otn / rns 9 t.d(90) Lad 0 ; t.oFrtpsl;/ pit 26 Lppis.otn / rns 5 t.oFrtpsl;/ pit 90 Lppis.otn / rns 0 nl i; )
27.2.13.
Musicians' Guide
second argument, really, is the integers from zero to one less than the number of elements in the Collection, increasing by one each time the loop executes a u c i n Fnto.
This example is of the first syntax shown. For each element in t , the interpreter executes the function once, giving it first L the corresponding element of the Collection, and then the iteration counter, which happens to be equal to the element's List index number.
( vrt =Ls.e; a L itnw vrmFn = a yuc { agie; r tm ie.otn tmpsl; } ; t =[7 4,12 8,3,0 3,2,23 6] L 2, 6 0, 1 4 , 9 6 0, 2; t.o mFn;) Ld( yuc ; nl i; )
This example does several things differently, but maintains the same basic functionality as the previous example. In this case, the Function only uses the first argument that the interpreter provides, and completely ignores the iteration counter. The syntax here also puts the Collection outside the parentheses, which perhaps makes it more clear that t is not part L of the function.
( 1.o {"eet.otn } ) 0d( rpa"psl; ; ; nl i; )
This example simply prints the string "repeat" ten times. If the Function accepted one argument, it would receive the integers zero through nine. If it accepted two arguments, both of the arguments would be equal.
27.2.13.
( 1.o {"eet.otn } ) 0d( rpa"psl; ; ; )
Musicians' Guide
and
( vrcutr=0 a one ; wie {cutr<1;} {"eet.otn cutr=cutr+1 }) hl( one 0 , rpa"psl; one one ; ; )
and
( vrcutr=0 a one ; {cutr<1;}wie {"eet.otn cutr=cutr+1 }) one 0 .hl( rpa"psl; one one ; ; )
You can see how it's easier to write this particular activity as a "do" loop. It's often the case that a "do" loop better reflects what you want to do, but not always. Contemplate a situation where you are waiting for the user to input some information, which you're going to use to calculate the rest of the composition. The following example isn't real code. It's intended to simplify a complex situation, so you can see where a "while" loop makes more sense than a "do" loop.
pa(sm bcgon msc) ly oe akrud ui ; wie {i teue siliptigifrain } {ke paigmsc}) hl( s h sr tl nutn nomto? , ep lyn ui ; so(sm bcgon msc) tp oe akrud ui ;
The background music is begun, and then the interpreter would enter the loop. For as long as the user is still inputting information, the interpreter will then "keep playing music." When the user is not still inputting information, the interpreter will move on to the next command, which stops the music. An equivalent "do" loop would be very difficult to write, if not impossible. This is because we won't know when the user has finished inputting their information until after they've finished, so we can't plan in advance for how long to play background music. Thus, the most appropriate use of a "while" loop is for cases where you cannot know in advance how many times something should be executed. For most other cases of repeated execution, a "do" loop is the most appropriate choice.
The following table lists unary boolean operators that take one arguments. These operators produce either t u or re fle as.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
99/157
27.2.13.
Musicians' Guide
Table 11.2. Unary Boolean Operators in SuperCollider Operator isPositive isStrictlyPositive isNegative Unary operators are actually functions, and must be used as such.
( vrx=5 a ; xiPstv;/ rtrs"re .soiie / eun tu" iNgtv(x) / rtrs"as" seaie ; / eun fle )
Meaning t u if the argument is greater than or equal to 0 re t u if the argument is greater than 0 re t u if i P s t v is f l e re soiie as
The use of these operators is explained below in the "Boolean Expressions" section.
11.3.8.2.2. Assignment/Equality Mistake Beware the following pitfall, common to a large number of programming languages:
a= 4;/ eautst "re o "as" dpnigo tevlei "" = 2 / vlae o tu" r fle, eedn n h au n a a=4;/ asgstevle4 t "" oe-rtn tepeiul-trdvle 2 / sin h au 2 o a, vrwiig h rvosysoe au
This way, if you accidentally leave out one of the =signs, the interpreter will stop execution and produce an error, rather than continuing with an unexpected assignment. 11.3.8.2.3. Equality versus Identity The identity-equivalence operators are not usually needed.
( vra=[22,8; a 1,44] vrb=[22,8; a 1,44] a= b / eautst "re = ; / vlae o tu" a==b / eautst "as" = ; / vlae o fle )
The = operator evaluates to t u because aand brepresent equivalent Objects - they are equal. The = =operator = re = evaluates to f l ebecause aand brepresent different instances of the Objects - they are not identical. as
( vra=[22,8; a 1,44] vrb=a a ; a= b / eautst "re = ; / vlae o tu" a==b / eautst "re = ; / vlae o tu" )
In this case, the = operator still evaluates to t u . The = =operator also evaluates to t u , because aand bboth = re = re represent the same Object. When the interpreter evaluates v r b = a in the example above, it actually assigns bthe a ; same value that astores, not a copy of it. 11.3.8.2.4. Logical A dand O n r The logical And and Or operators must receive two boolean arguments. Logical And returns t u if both of its arguments re are t u . Logical Or returns t u if one of its arguments are t u . re re re The following table illustrates how the SuperCollider interpreter will evaluate each of the following situations.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 100/157
27.2.13.
Musicians' Guide
Table 11.3. Truth Table If the left sub-expression is... tu re fle as tu re fle as ... and the right subexpression is... fle as tu re tu re fle as ... then logical A d n evaluates to... fle as fle as tu re fle as ... and logical O evaluates r to... tu re tu re tu re fle as
The interpreter evaluates the expression on the left first, and then the expression on the right only if it will influence the outcome. This means that, if the left-side expression of a logical Or operator evaluates to "true", the interpreter will not test the right-side expression, because the result will be "true" anyway. Similarly, if the left-side expression of a logical And operator evaluates to "false", the interpreter will not test the right-side expression, because the result will be "false" anyway. This can be exploited to help avoid errors like division-by-zero.
( vrx=5rn;/ asgsaped-admnme bten0ad5 a .ad / sin suorno ubr ewe n (x! 0)& ({x=1 /x }) / dentdvd b xi i wudcuedvso= & 7 ; ; / os' iie y f t ol as iiin b-eo yzr x / teitrrtratmtclypit ti vleatreeuin ; / h nepee uoaial rns hs au fe xcto )
If the left-side expression of the logical And operator is "false", the interpreter doesn't evaluate the right-side expression; it simply moves on to the next expression. If the left-side expression is "true" (meaning that x is not zero), then the right-side expression is evaluated. The right-side expression happens to be a Function which assigns "x" the result of dividing 17 by its previous value. The result of the logical And operation is simply discarded in this case - it doesn't really matter to us. This isn't the most straight-forward code, and there are other ways to avoid division-by-zero. If you use this, it's probably best to include a brief explanation of what the code does, as a commment. If you run this code many times, you will see that it gives many different results - one of which is zero, which proves that the code works as intended. If SuperCollider divides by zero, the result is "inf", representing infinity. Try modifying the code so that it will divide by zero, and see what happens. 11.3.8.2.5. Order of Precedence In complicated boolean expressions, it's important to clarify the order in which you want sub-expressions to be executed. This order is called the "order of precedence," or "order of operations" (see Order of Operations (Wikipedia), available at http://en.wikipedia.org/wiki/Order_of_operations for more information). In computer science, different programming languages enforce different orders of precedence, so you should use parentheses to clarify your intended order, to proactively avoid later confusion. The interpreter will evaluate an expression from left to right, and always fully evaluate parentheses before continuing. Even simple expression can benefit from parentheses. These produce the same results:
( vra=5= 5& 1 ! 5 a = & 7 = ; vrb=(5= 5)& (1 ! 5) / prnhsshl t caiy a = & 7 = ; / aetee ep o lrf a= b / eautst "re = ; / vlae o tu" ) ( vra=5iPstv & iNgtv(6)| 1 +5*4 -1>1 ; a .soiie & seaie | 2 2 8 vrb=(5iPstv & iNgtv(6))| ((1 +5 *4 -1 >1 ) / a .soiie & seaie | (2 ) 2 ) 8 ; / prnhsshl t caiy aetee ep o lrf a& b / eautst "re & ; / vlae o tu" )
... evaluates to "false"! They're equal - the interpreter doesn't follow the standard mathematical order of precedence rules! SuperCollider evaluates from left to right, so it's important to clarify to the interpreter what you mean. Where would you put parentheses so that SuperCollider evaluates the expression as per the standard mathematical order of precedence rules, with multiplication before addition and subtraction?
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
101/157
27.2.13.
Musicians' Guide
i (boenxrsin tuFnto,fleucin) f olaEpeso, reucin asFnto ;
and
boenxrsini(tuFnto,fleucin) olaEpeso.f reucin asFnto ;
It's possible to exclude the f l e u c i n which is like telling the interpreter, "If the boolean expression is true, then asFnto, execute this Function. Otherwise, don't execute it."
( vrts =[refle.hoe / ped-admycossoeo teeeet i te a et tu,as]cos; / suornol hoe n f h lmns n h Ls it i ((tu = ts ) {"tstu!.otn } {"tsfle"psl;}) f re = et , I' re"psl; , I' as!.otn ; nl i; )
This example prints out a nice message, saying whether t s is t u or f l e Because t s is already a boolean et re as. et value, we don't need to include it in an expression. The "if" statement could have been shortened like this: i ( t s , { f et "tstu!.otn } {"tsfle"psl;}) I' re"psl; , I' as!.otn ; Suppose we only wanted to be alerted if t s is t u . et re
( vrts =[refle.hoe / ped-admycossoeo teeeet i te a et tu,as]cos; / suornol hoe n f h lmns n h Ls it ts.f {"tstu!.otn }) eti( I' re"psl; ; nl i; )
In this example, the alternate "if" syntax is used, where the boolean expression is placed before the parentheses. "If" structures can also be "nested," which is like telling the interpreter, "If this is true, do this; otherwise if this is true, do this; otherwise if this is true, do this." In this relatively simple example of nesting, the interpreter evaluates each "if" structure only if the previous one was "false".
( vrts =[,,]cos;/ ped-admycossoeo teeeet i teLs a et 123.hoe / suornol hoe n f h lmns n h it i(1= ts,{"tsoe"psl;} f = et I' n!.otn , i(2= ts,{"tsto"psl;} f = et I' w!.otn , i(3= ts,{"tstre"psl;}))) f = et I' he!.otn ; nl i; )
As you can see, this type of nesting is not easy to figure out - from the standpoint of the original programmer or somebody else who wishes to use your code. In writing this example, it took me several attempts before getting the parentheses and braces right. Usually, if you have a long list of possibilities to test (like the nine in this example), it is better to use a "case" or "switch" structure. Not only does this help to make the code easier to understand, but the SuperCollider interpreter can apply optimizations that make the code run marginally faster.
27.2.13.
cs(cmaehs ae oprTi, tTi1 {dTi;} ohs, ohs , tTi2 {dTi;} ohs, ohs , tTi3 {dTi;} ohs, ohs ) ;
Musicians' Guide
You can include any number of cases. Notice that there is no comma after the last case, and that I've put the concluding ");" on a separate line with the same indentation as the word "case", so that it's easy to see. The following example shows a simple switch.
( vrgae =1.ad+1 / ped-admycoss0t 1,te ad 1t gv 1t a rd 1rn ; / suornol hoe o 1 hn ds o ie o 1 2 gae= rd sic(gae wth rd, 1 {"- } , D" , 2 {""} , D , 3 {"+ } , D" , 4 {"- } , C" , 5 {""} , C , 6 {"+ } , C" , 7 {"- } , B" , 8 {""} , B , 9 {"+ } , B" , 1,{"- } 0 A" , 1,{""} 1 A , 1,{"+ } 2 A" ) ; (Yu gaei"+gae.otn "or rd s rd)psl; nl i; )
The code picks a pseudo-random number between 1 and 12, then uses a "switch" structure to convert that number into a letter-grade, assigning it to the same g a evariable. Then, it adds the "Your grade is" string to the value of g a e(with a rd rd space between), and prints that result. This example avoids the complex nested "if" structure from above.
( vrtsA=[,,]cos;/ ped-admycossoeo teeeet i teLs a et 123.hoe / suornol hoe n f h lmns n h it vrtsB=[,,]cos; a et 123.hoe sic([et,et] wth tsAtsB, [,] {"tsoeadoe"psl;} 11, I' n n n!.otn , [,] {"tsoeadto"psl;} 12, I' n n w!.otn , [,] {"tsoeadtre"psl;} 13, I' n n he!.otn , [,] {"tstoadoe"psl;} 21, I' w n n!.otn , [,] {"tstoadto"psl;} 22, I' w n w!.otn , [,] {"tstoadtr!.otn } 23, I' w n he"psl; , [,] {"tstreadoe"psl;} 31, I' he n n!.otn , [,] {"tstreadto"psl;} 32, I' he n w!.otn , [,] {"tstreadtre"psl;} 33, I' he n he!.otn ) ; nl i; )
This is an elegant way to inspect two otherwise-separate variables. Remember that the first argument to "switch" (in this case, it's [ e t , e B ) is compared to the first argument of possibe result with the equality operator: = tsAts] = When evaluating which switch to use, the SuperCollider interpreter will always apply the last one that evaluates to t u . re
( sic(5 wth , 5 {"n"psl;} , oe.otn , 5 {"w"psl;} , to.otn , 5 {"he"psl;} , tre.otn ) ; nl i; )
All of these cases are true, but this will always result in "three" being printed.
27.2.13.
Musicians' Guide
Contemplate the following pseudo-code example, which represents a possible musical sitation, and a good use of the "case" structure.
( vrcoFnto = a olucin { cs ae {i teen mscpaig s hr o ui lyn? ADpol aei tero }{pa msc} N epe r n h om ly ui {hstesm sn be paigfrtoln? a h ae og en lyn o o og O i tesn brn?}{cag tesn } R s h og oig hne h og {hseeyoylf tero?}{tr oftemsc} a vrbd et h om un f h ui {hsasn be rqetd }{cag t ta sn } a og en euse? hne o ht og {i temsctolu?}{lwrtemscsvlm } s h ui o od oe h ui' oue {i temsctoqit }{rietemscsvlm } s h ui o ue? as h ui' oue {i temsctofs?}{lwrtemscstmo} s h ui o at oe h ui' ep {i temsctoso?}{rietemscstmo} s h ui o lw as h ui' ep {i eeyhn oa?}{wi fr1 scns} s vrtig ky at o 0 eod ; } ; (5= 5)wie coFnto ) / eeue coFnto cniosy = .hl( olucin ; / xcts olucin otuul )
It might seem like this example doesn't relate to a real SuperCollider programming situation, but in fact it might. If you could program Function's which determined all of those questions and all of the answers, this sort of "case" structure would be very helpful in a situation where a computer running SuperCollider were left in a room by itself, and expected to play music whenever anybody entered the room. Since five is always equal to five, the interpreter will run c o F n t o olucin forever. If the music needs adjustment in some way, the Function will adjust the music. If everything is okay, then the interpreter will wait for 10 seconds, and then the loop will cause the Function to be re-evaluated. Because many different criteria are evaluated in the "case" structure, this represents an efficient use of the structure. "Case" structures can be used to do the same thing as "switch" structures, but it's usually less elegant solution. Also, it doesn't allow the interpreter to use an speed optimization that it would have used in an equivalent "switch" structure.
( vrgae =1.ad+1 / ped-admycoss0t 1,te ad 1t gv 1t a rd 1rn ; / suornol hoe o 1 hn ds o ie o 1 2 gae= rd cs ae {1= gae }{"- } = rd; D" {2= gae }{""} = rd; D {3= gae }{"+ } = rd; D" {4= gae }{"- } = rd; C" {5= gae }{""} = rd; C {6= gae }{"+ } = rd; C" {7= gae }{"- } = rd; B" {8= gae }{""} = rd; B {9= gae }{"+ } = rd; B" {1 = gae }{"- } 0 = rd; A" {1 = gae }{""} 1 = rd; A {1 = gae }{"+ } 2 = rd; A" ; (Yu gaei"+gae.otn "or rd s rd)psl; nl i; )
This example is equivalent to one of the "switch" structure examples. This is not a good use of the "case" structure, because it requires a lot of code repetition. Unlike a "switch" structure, a "case" structure will always follow the first case that evaluates to "true".
( cs ae {5= 5 }{"n"psl;} = ; oe.otn {5= 5 }{"w"psl;} = ; to.otn {5= 5 }{"he"psl;} = ; tre.otn ; nl i; )
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
104/157
27.2.13.
Musicians' Guide
Notice how all of these S n s s are heard through the left channel only. The M xclass mixes all the UGen's together into iOc i one. You could use a bus to send the audio to both the left and right channels. What happens if we don't use the M x i class? Try to remove the function, and find out. You only hear some of the S n s 's. Which ones? The first two, iOc representing the left and right channels. If your audio interface has more than two channels, you may be able to hear more than those first two channels. There is another function offered by the M xclass, and it is a kind of loop. The function is called F l , and it takes two i il arguments: the number of times to run a function, and the function to run. The function is provided with one argument (like in a "do" loop), which is the number of times the function has already been run.
( vrn=8 a ; vrsnFn = a ieuc { agieain r trto; vrfe =40+ieain a rq 4 trto; Sns.r fe:rq ml1n) iOca( rqfe, u:/ ; } ; {Mxfl(n snFn ) }pa; i.il , ieuc ; .ly )
As you can see, the f l function itself is quite simple: you provide the number of UGen's to create, and a function that il creates UGen's. It's the s n F n function that is a little confusing. The argument is called "iteration", because it holds ieuc how many times the function has already been run - how many iterations have happened already. It uses this value to help calculate the frequency (stored in a variable called f e ), and then creates a S n s UGen. The m largument rq iOc u helps to automatically control the volume level. Since the total volume should be no more than 1.0, the s n F n function ieuc calculates UGen's' volume by dividing 1, the maximum level, by the number of UGen's that will be created. The slowly pulsating volume is part of the acoustic result of this many frequencies being so close together - it is not a hidden effect by SuperCollider.
Here, a two-element Array is the result of a Function, which gets sent the "play" message. Each of the elements is an equivalent, three-element Array where each element is a UGen.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 105/157
27.2.13.
Musicians' Guide
This representation also offers another benefit: each UGen can have a different "mul" value, which will be preserved.
{ [ [Sns.r40 0 02,Sns.r 80 0 01) Sns.r 16,0 00 )] iOca(4, , .) iOca( 8, , . , iOca( 60 , .5 , [Sns.r40 0 02,Sns.r 80 0 01) Sns.r 16,0 00 )] iOca(4, , .) iOca( 8, , . , iOca( 60 , .5 ] ; }pa; .ly
This sounds much less harsh than the first example. Try it with the Mix Class. Even with the different "mul" values, it sounds the same as the first example! This helps Mix to ensure that the total level doesn't exceed 1.0, but it has the disadvantage that careful level-balancing on your part will be erased.
11.3.9.3. Addition
This method of combinine UGen's into two channels uses the addition operator: +
{ [ (Sns.r40 0 01 +Sns.r 80 0 01)+Sns.r 16,0 01)) iOca(4, , .) iOca( 8, , . iOca( 60 , . , (Sns.r40 0 01 +Sns.r 80 0 01)+Sns.r 16,0 01)) iOca(4, , .) iOca( 8, , . iOca( 60 , . ] ; }pa; .ly
Notice that, like with the Mix Class, independent "mul" levels are not preserved.
and
{Ota(0 Sns.r fe:0,ml02)) }pa; u.r , iOca( rq50 u:. ; .ly
The first argument to "Out.ar" is the bus number for where you want to place the second argument, which is either a UGen or a multi-channel Array of UGen's. If the second argument is an Array, then the first element is sent to the first argument's bus number, the second argument is sent to one bus number higher, the third to two bus numbers higher, and so on. This issues is explained fully in Section 11.3.11, Busses, but here is what you need to know for now, working with stereo (two-channel) audio: If the second argument is a two-element Array, use bus number 0. If the second argument is a single UGen, and you want it to be heard through the left channel, use bus number 0. If the second argument is a single UGen, and you want it to be heard through the right channel, use bus number 1. If you're still struggling with exactly what the "Out" UGen does, think of it like this: when you create an audio-rate UGen, it starts creating an audio signal; the "Out" UGen effectively connects the audio-rate UGen into your audio interface's output port, so it can be heard through the speakers. In Section 11.3.11, Busses, it becomes clear that there are, in fact, other useful places to connect an audio-rate UGen (through an effect processor, for example), and the "Out" UGen can help you do that.
11.3.10.2. SynthDef
A SynthDef is what we use to tell the server how to create sound. In order to truly understand what SynthDef accomplishes, we need to recall the disconnect between the interpreter and the server. In reality, the interpreter has no idea how to make sound or work with audio hardware. The server, likewise, has no understanding at all of the SuperCollider language. The interpreter takes the code that we write, and does one of a number of things, depending on the nature of the code:
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
106/157
27.2.13.
Musicians' Guide
executes it completely, executes it partially, makes choices, and then does something else send the server information about how to synthesize sound, etc. For simple code like 2 p s l ;the interpreter just executes it. For code like { S n O c a ; } p a ;the interpreter .otn ics.r .ly expands it a bit, then sends instructions to the server, which deals with the rest of the synthesis process. A SynthDef is part of this last process; SynthDef Objects represent the synthesis information that is sent to the server before (or at the same time as) telling the server to play the sound. There are two steps to creating a useful SynthDef: making an interpreter Object, and sending the actual synthesis information to the server. There are two ways to write this, as follows:
smVral =Snhe.e(nmOSnhe,FntoCnannOtGn) oeaibe ytDfnw aefytDf ucinotiiguUe ; smVral.ed nmOSre ) oeaibesn( aefevr ;
and
Snhe.e(nmOSnhe,FntoCnannOtGn)sn(nmOSre ) ytDfnw aefytDf ucinotiiguUe .ed aefevr ;
The F n t o C n a n n O t G nis simply that - a function that, when executed, returns an O tUGen (meaning that ucinotiiguUe u the O tUGen must be the last expression in the function). The n m O S n h e should be a symbol (as described in u aefytDf Section 11.3.10.4, Symbols), but can also be a string. The n m O S r e is a variable that represents the server to aefevr which you want to send the SynthDef's information; unless you know that you need to use a different variable for this, it's probably just the letter "s", which the interpreter automatically assigns to the default server. Here is a demonstration of both methods:
( vrpaM = a lye { Ota(0 Sns.r fe:4,ml02)) u.r , iOca( rq40 u:. ; } ; vrpaMSnhe =Snhe.e(\lye paM ) a lyeytDf ytDfnw paM, lye ; paMSnhe.ed s) lyeytDfsn( ; nl i; )
and
( vrpaM = a lye { Ota(0 Sns.r fe:4,ml02)) u.r , iOca( rq40 u:. ; } ; Snhe.e(\lye paM )sn(s) ytDfnw paM, lye .ed ; nl i; )
The only advantage to assigning something to a variable is the ability to refer to it later. If you use the first method, then you can send the SynthDef to more than one server. Since it's rare that you will want to use more than one server, it's usually better to use the second style. In fact, if you won't be using the "playMe" Function again, you don't need to assign it to a variable!
Snhe.e(\lye {Ota(0 Sns.r fe:4,ml02)) })sn(s) ytDfnw paM, u.r , iOca( rq40 u:. ; .ed ;
This is all that's really needed to create and send a synthesis definition to the server. It looks long and frightening, but now at least you understand what all of the parts do.
11.3.10.3. Load
There is another way to send a SynthDef to the server: the "load" Function. The "send" Function sends the synthesis information to the server, which stores it in memory. When the server stops running, all synthesis information given with "send" is lost. The "load" Function, on the other hand, sends the synthesis information to the server, which stores it on disk and in memory. Every time the server is started, it loads all of the synthesis information previously sent to it with the "load" Function. The definition remains until you delete it specifically. This is most useful for a SynthDef that takes up a lot of memory, and which would use considerable network time to transfer to the server whenever the server is run. It is also useful to use the "load" Function instead of "send", when there are a lot of SynthDef's, regardless of the size of each one. The idea is the same: avoid sending the SynthDef in order to save time. The syntax and usage for "load" is the same as for "send".
11.3.10.4. Symbols
As stated in the section about variables, a symbol is simply something which represents something else. When used in the context of a SynthDef, a symbol is a string of characters that refers to a SynthDef that we've already sent to the server.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 107/157
27.2.13.
Musicians' Guide
What wasn't mentioned in the section about variables is that, in addition to the symbols that can be used as variable names, the SuperCollider language provides a distinct data-type (like numbers or strings) for symbols. Many programming languages don't provide a "symbol" data-type, so many programmers do not use them extensively, but they are very handy for situations like this. As local variable names are symbols representing data stored by the interpreter, here we are using the symbol data-type to refer to data stored on the server. Symbols are a better way to name SynthDef's than strings. Not only do symbols take up less memory, they aren't actually the interpreter doesn't actually think of them as Objects, and neither should you. Symbols are universally unique; only one instance of a symbol with the same characters can exist. On the other hand, an infinite number of strings with the same characters can exist. When we use a symbol, we are defining it universally. When we use a string, the server pretends that all strings with the same characters are the same philosophical object, even though they aren't. This isn't a technical problem, but it can be difficult to think about, and is cognitively dissonant. If all this seems a little abstract and ontological, that's because it is. 11.3.10.4.1. Symbols: the Easy Way Symbols are things that you should use to identify a SynthDef sent to the server. 11.3.10.4.2. Writing Symbols There are two ways to write out a symbol: between single-quotation marks, and after a back-slash. Symbols given between single-quotation marks can contain any characters but a single-quotation mark. Symbols given after a backslash can contain any characters but a space. Neither type of symbol name can cross onto a new line. The following example contains some valid symbols, and some invalid symbols.
\tpin\ ti i asmo soSg \ hs s ybl \tpsg \ ti i asmo cle 'tp floe b teurltdwr 'in so in \ hs s ybl ald so' olwd y h neae od sg' 'tpin \ ti i asmo soSg' \ hs s ybl 'tpsg'\ ti i asmo so in \ hs s ybl 'tp so sg'\ teelnsaentasmo,adwl cuea err in \ hs ie r o ybl n il as n ro
The following example illustrates the differences between strings and symbols.
vra="tpsg"\ asrn a so in \ tig vrb="tpsg"\ asrn wt tesm ltesa tefrtsrn a so in \ tig ih h ae etr s h is tig a= b \ rtrs"re bcuetesrnsaeeuvln = ; \ eun tu" eas h tig r qiaet a==b \ rtrs"as"bcuetesrnsaesprt cpe wt tesm = ; \ eun fle eas h tig r eaae ois ih h ae caatr hrces vrc='tpsg'\ asmo a so in \ ybl vrd='tpsg'\ tesm smo a so in \ h ae ybl c= d \ rtrs"re bcuetesmosaeeuvln = ; \ eun tu" eas h ybl r qiaet c==d \ rtrs"re bcuetesmosaeietcl = ; \ eun tu" eas h ybl r dnia
Recall that the interpreter automatically uses the Synth and SynthDef Classes when we send the "play" message to a Function. We can actually capture and use the Synth Object created from "play-ing" a Function, too. This example is almost the same as the previous one.
vrmSnh={Sns.r fe:4,ml02) }pa; a yyt iOca( rq43 u:. ; .ly
The difference is subtle: after the second example, we have no control over what name the interpreter gives to the SynthDef that it sends to the server, so we can't re-use the SynthDef. On the other hand, because we assign the name \ i l T t r a S to the SynthDef in the first example, we know what it's called, and we can re-use it. Theoretically, we slyuoilD can make an infinite number of synths from this single definition. Realistically, it's limited by the amount of memory the server can use; for most modern computers, this number is so high that we don't ever need to worry about it. As usual, the interpreter provides us with an optional short-cut:
vrmSnh=Snhe.e(\lye {Ota(0 Sns.r fe:4,ml02)) } a yyt ytDfnw paM, u.r , iOca( rq40 u:. ; )pa; .ly
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
108/157
27.2.13.
Musicians' Guide
This automatically sends the synthesis information to the server, creates a synth, and plays it. What minor functionality is lost when we use this shortcut?
Execute the program a few times. The result will be different each time: ten different SinOsc's with ten different frequencies. What if we convert the program to use a SynthDef and multiple Synth's instead? This program will probably cause an error the first time - this is exaplained below.
( vrmRnFn = a yaduc { vrfeuny=40rn +40 / poue a itgrbten40ad80 a rqec 4.ad 4; / rdcs n nee ewe 4 n 8 Ota(0 Sns.r fe:rqec,ml005)) u.r , iOca( rqfeuny u:.2 ; } ; Snhe.e(\yaduc mRnFn )sn(s) ytDfnw mRnFn, yaduc .ed ; 1.o {Snhnw \yaduc) }) 0d( yt.e( mRnFn ; ; )
Execute the program a few times. The result is still different each time, but it's the same ten SinOsc's, all with the same frequency. This is the nature of a SynthDef: once it's sent to the server, you can create a synth from the same instructions without resending them. This program causes an error the first time you run it. Inspect the error messages, and see if you can determine why. It's because the server is processing commands asynchronously: things don't happen right when the interpreter asks, but very shortly thereafter. The result is that the server is asked to make a new synth before it deals with the synth definition. There are ways to get around this, but they're too complex for this section - for now (to simplify this text's examples), just accept that the error may happen the first time you run a Synth.
When you use a UGen as a control-rate UGen, you have to think about its arguments quite differently than when using it as an audio-rate UGen. This table shows how the same argument gives a different result for an audio-rate vs. controlrate UGen used for pitch: Table 11.4. Parameters in Audio-Rate and Control-Rate S n s UGens iOc Parameter freq add mul In an audio-rate UGen... controls the pitch ?? controls volume level In a control-rate UGen... controls the speed of oscillation sets the middle point of the sine wave by adding this to the output sets the deviation from "add"
For an audio-rate SinOsc UGen, you set the frequency and the volume level. For a control-rate UGen, you set the midpoint of oscillation with a d the extremes of oscillation which will be a d - m land a d + m l and the speed of d, d u d u, oscillation with f e . The end result is very different numbers. rq
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
109/157
27.2.13.
Musicians' Guide
There is a handy UGen designed specifically for replacing pseudo-randomness in Functions. The following example restores the "ten different pitches" to the example from the last section.
( vrmRnFn = a yaduc { vrfeuny=Rn(40 80) / poue a itgrbten40ad80 a rqec ad 4, 8 ; / rdcs n nee ewe 4 n 8 Ota(0 Sns.r fe:rqec,ml005)) u.r , iOca( rqfeuny u:.2 ; } ; Snhe.e(\yaduc mRnFn )sn(s) ytDfnw mRnFn, yaduc .ed ; 1.o {Snhnw \yaduc) }) 0d( yt.e( mRnFn ; ; )
If you run this multiple times, you will again hear ten different pitches. Depending on audio hardware, previous musical experience, and other factors, some people may have difficulty hearing that the pitches are different. Try reducing the number of synths created in the loop.
I've decided to use the Rand UGen anyway, so that supplying a frequency is optional. This adds functionality while making the added complexity optional:
( vrmRnFn = a yaduc { agfeuny=40 r rqec 4; Ota(0 Sns.r fe:rqec,ml005)) u.r , iOca( rqfeuny u:.2 ; } ; Snhe.e(\yaduc mRnFn )sn(s) ytDfnw mRnFn, yaduc .ed ; 1.o {Snhnw \yaduc) }) 0d( yt.e( mRnFn ; ; )
If you use the SynthDef in the old way, as in the example, you'll get the expected result: ten Synth's, all with the same frequency. But, if you add a "rand" Function call into the loop, you can get ten different frequencies!
( vrmRnFn = a yaduc { agfeuny=40 r rqec 4; Ota(0 Sns.r fe:rqec,ml005)) u.r , iOca( rqfeuny u:.2 ; } ; Snhe.e(\yaduc mRnFn )sn(s) ytDfnw mRnFn, yaduc .ed ; 1.o {Snhnw \yaduc [feuny(4.ad+40]) }) 0d( yt.e( mRnFn, \rqec,40rn 4) ; ; )
Notice how we supply arguments: an Array with elements alternating between a string-quoted parameter name, and the value of the argument itself. If we "parameterized" all three main fields of the SinOsc, we could supply them like this:
Snhnw \yiOc [fe,4,ad0\u,.]) yt.e( mSns, \rq40\d,,ml02 ;
This helps to save even more time and memory: rather than destroying and creating synths all the time, you can simply change pre-existing ones. This modification of the ten-pseudo-random-tones example includes an extra line that lets you change the tones without destroying and re-creating the synths.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 110/157
27.2.13.
/ rnti frt / u hs is h=Ls.e; itnw
Musicians' Guide
/ rnti scn / u hs eod ( vrmRnFn = a yaduc { agfeuny=40 r rqec 4; Ota(0 Sns.r fe:rqec,ml005)) u.r , iOca( rqfeuny u:.2 ; } ; Snhe.e(\yaduc mRnFn )sn(s) ytDfnw mRnFn, yaduc .ed ; ) / rnti tid / u hs hr 1.o {had Snhnw \yaduc [feuny(4.ad+40])) }) 0d( .d( yt.e( mRnFn, \rqec,40rn 4) ; ; / rnti fut,a mn tmsa yupes / u hs orh s ay ie s o lae hd({agie;ie.e(\rqec,(4.ad+40 ) }) .o r tm tmst feuny 40rn 4) ; ;
The reason that you have to run each of those segments separately is two-fold: we need to store the List of Synth's in a single-letter variable because, for this simple demonstration, this is the most efficient way; second, for the asynchronous behaviour of the server that was previously noted as causing an error. The only aspect of that example that's a little tricky to understand is the "do" loop. Remember that when you run a "do" loop on a List, the interpreter automatically loops over each of the elements in the List, running the Function that you provide. Each time the Function is run, it receives the current List item, and its index number in the List, in that order. So the Function in this loop simply uses "set" to change the "frequency" argument. Take special note that the arguments in this case are not identical to those given with the "new" message. Compare the two forms below:
Snhe.e(\ytNm,[prmtr,au,prmtr,au]) ytDfnw Snhae \aaee1vle\aaee2vle ;
and
eitnSnhst \aaee1 vle \amtr,vle) xsigyt.e( prmtr, au, pree2 au ;
To get rid of one synth without stopping all sound, send its corresponding Synth the "free" message:
vralHligyt.re aibeodnSnhfe;
This stops the synth and frees the associated memory - on the server. Your Synth Object still exists in the interpreter, but you can't use it any more. A Synth Object represents a synth on the server; since you got rid of the synth on the server, the Synth Object represents something that doesn't exist. If you attempt to send the "free" message again, you'll get an error. For this reason, it's a good idea to get rid of the Synth Object at the same time:
<elcal>aibeodnSnh/elcal>fe; rpaebevralHligyt<rpaebe.re <elcal>aibeodnSnh/elcal>=nl rpaebevralHligyt<rpaebe i;
If you accidentally send "free" to an already-freed Synth, the interpreter will cause an error, and program execution will stop. If you accidentally send "free" to a variable set to "nil", nothing will happen. Proactively avoiding mistakes like this is good programming practice.
11.3.11. Busses
SuperCollider busses work just like busses in other audio creation contexts, which work similarly to busses used to transport humans. Busses are used to send audio from one place to another, and in SuperCollider they can also be used to send control-rate signals. Each SuperCollider bus is given an index number, which are integers starting at 0. Audio-rate busses and control-rate busses are independent, and are given an independent set of index numbers. Any number of unique signals can be routed into a bus, and any number of receivers can take signals from a bus - but the signal will be the sum of all the input signals. In other words, if you want to send two different sets of signals, you need two different busses with different index numbers.
27.2.13.
Musicians' Guide
The interpreter also keeps track of which bus numbers are used for which Bus Objects, so the signals will never get confused. Of course, you can still route signals through those bus numbers without using the Bus Object, but the Bus Class helps us to keep things straight. The following messages/functions can also be used with Bus Objects: Table 11.5. Some Functions of the B sClass u Message/Function index numChannels rate server Example bidx .ne; bnmhnes .uCanl; brt; .ae bsre; .evr Return Value The lowest bus number used by this Bus object. The number of busses used by this Bus object. Either a d oor c n r l ui oto. The name of the server used by the Bus object. The default server is lclot oahs
When you are done with a Bus, you can release the channels for use by other Bus Objects:
<elcal>yuVral<rpaebe.re rpaebemBsaibe/elcal>fe; <elcal>yuVral<rpaebe =nl rpaebemBsaibe/elcal> i;
Like when sending the "free" message to a Synth Object, you should set the variable name of a "free'd" Bus to "nil". This will prevent you from accidentally sending audio there after the Bus is released.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 112/157
27.2.13.
Musicians' Guide
This example contains three stages: prepare the server, create the synths, destroy the synths. These three stages will become familiar as you program in SuperCollider, whether or not you use busses frequently. The example is fairly complicated, so the code is explained here: b s u i S n hFunction: Accepts two arguments, and creates an audio-rate S n s , routed to the left output uAdoyt iOc channel. The frequency is determined by a control-rate bus given as an argument, and optionally with an offset that can be supplied as an argument. b s o t o S n hFunction: Accepts two arguments, and creates a control-rate S n s , routed to the bus given as uCnrlyt iOc an argument. Can also be given a frequency; the value produced by the synth is intended to be used to control pitch. The centre pitch of the oscillation is f e , and the range of oscillation is one-twentieth the size of f e (one-fourtieth rq rq both higher and lower than f e ). rq SynthDef: These commands are straight-forward. They send the synthesis definitions to the server. b = B s c n r l s ) : This should also be straight-forward. A single-channel control bus is created, and u.oto( ; assigned to the pre-declared variable b . For synth creation, xis assigned a control-rate synth, while yand zare assigned audio-rate synths. Each synth is given the variable b which refers to our control-rate bus. zis also given an argument for \ r q f s t which makes , feOfe, its frequency 200 Hz higher than the synth assigned to y . Don't worry about the a t rmessage for now. It's explained in Section 11.3.12.1, Ordering. fe 11.3.11.4.1. Why Use Global Variables Since this is just an example, and not an actual program, the program uses four automatically-declared global variables: b x y and z Because these variables are shared with everything, it's especially important to set them to n lwhen , , , . i you're done. If this were going to be written into a real program, it would be a good idea to change the variables to something which can't be accessed by other programs. 11.3.11.4.2. Why Use a Bus The control-rate bus in this example might seem trivial and pointless to you, especially since the use of a UGen to control frequency has already been illustrated in other examples. For this particular program, a control-rate UGen would probably have been a better choice, but remember that this is just an example. Here are some advantages to using a control-rate Bus over a UGen: The signal can be changed without sending the s tmessage to the audio-rate UGen, simply by changing the input to e the bus. Input to the bus can be produced by any number of control-rate UGen's. The signal in the bus can be received by more than one UGen, as it is in this example. One thousand audio-rate UGen's powered by 25 control-rate UGen's is a much better solution than if each audio-rate UGen were powered by its own control-rate UGen.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
113/157
27.2.13.
Musicians' Guide
Busses can be accessed quickly and efficiently from any place in the program that has access to the variable holding the Bus. It's easier and safer (less error-prone) than making all of your UGen's equally accessible. Some of these advantages could be seen as disadvantages. Whether you should use a Bus or a UGen depends on the particular application. The simpler solution is usually the better one, as long as you remember to avoid repetition! 11.3.11.4.3. Special Note about Control-Rate Busses Control-rate Bus'ses are a great way to enhance the flexibility of your program. The best part is that, in order to use a control-rate Bus, the UGen doesn't even need to have been written to accomodate it.
{Sns.r fe:nk(cnrlaeu,1) ml02) }pa; iOca( rqI.r otoRtBs , u:. ; .ly
Now you've managed to spice up an otherwise-boring synth! Also, control-rate Bus'ses don't need to be constantly changing. Unlike an audio-rate Bus, a control-rate Bus will hold the last-inputted value until another value is provided. You can the value of a control-rate Bus with the s tmessage (and a e single argument, which is the value). You can also get the current value, whether created by s tor a UGen, by using the e g tmessage, and sending a Function with one argument. e
( vrbs=Bscnrl s) a u u.oto( ; bsst 1 ) u.e( 2 ; bsgt {agvl vlpsl;}) u.e( r a; a.otn ; bsfe;bs=nl u.re u i; )
When running this example, you'll notice that the 1 doesn't get posted until after the program finishes with n l This is 2 i. because of the latency between when the interpreter asks the server to do something, and when the server does it. The amount of time it takes for the server to complete a command is usually very small, but as you can see, it can make an important difference to your program. This latency is also the reason that you can't call S n h e . e ( . . )and ytDfnw . S n h n w . . )at the exact same time. yt.e( . This latency is also the reason that we have to provide a single-argument function as an argument to the g tfunction. e Since the function won't immediately be able to get the value of the bus from the server, we can't expect the value to be returned by the function. Instead, when "get" gets the value of the bus from the server, it runs the function that you gave it.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
114/157
27.2.13.
(
Musicians' Guide
vrttraDcyik= a uoileaPn { agotu =0 efcBs r uBs , fetu, drc =05 / cnrl pooto o "iet /"rcse"sud iet .; / otos rprin f drc" poesd on vrsuc; a ore / Dcyn ple o PnNie / eaig uss f ikos. suc =Dcy.r i:mus.r fe:,pae02 ) ore ea2a( nIplea( rq1 hs:.5 , atcTm:.1 takie00, dcyie02 eaTm:., mlPnNiea u:ikos.r ) ; Ota(otu,(oredrc)) / mi otu u.r uBs suc*iet ; / an upt Ota(efcBs (ore(-iet)) / efcsotu u.r fetu, suc*1drc) ; / fet upt } ; vrttraDcyie= a uoileaSn { agotu =0 efcBs r uBs , fetu, drc =05 / cnrl pooto o "iet /"rcse"sud iet .; / otos rprin f drc" poesd on vrsuc; a ore / Dcyn ple o amdltn Sn wv. / eaig uss f ouaig ie ae suc =Dcy.r i:mus.r fe:.,pae 02) ore ea2a( nIplea( rq03 hs: .5, atcTm:., takie03 dcyie1 eaTm:, mlSns.r fe:iOck(fe:.,ml10 ad40 ) u:iOca( rqSns.r rq02 u:1, d:4) ) ; Ota(uBs (oredrc)) / mi otu u.rotu, suc*iet ; / an upt Ota(fetu,(ore(-iet)) / efcsotu u.refcBs suc*1drc) ; / fet upt } ; vrttraRvr = a uoileeb { agotu =0 iBs / dfutotu i adoitrae r uBs , nu; / eal uBs s ui nefc vript a nu; ipt=I.r iBs 1) nu na( nu, ; 1.o {ipt=Alas.r i:nu, 6d( nu lpsCa( nipt mxeatm:.4 adlyie00, dlyie{Rn(.0,.4 }dp eatm: ad00100) .u, dcyie3 eatm: ) } ) ; Ota(otu,ipt) u.r uBs nu ; } ; / sn snhssifraint tesre / ed ytei nomto o h evr Snhe(\uoileeb ttraRvr )sn(s) ytDf ttraRvr, uoileeb .ed ; Snhe(\uoileaPn,ttraDcyik)sn(s) ytDf ttraDcyik uoileaPn .ed ; Snhe(\uoileaSn,ttraDcyie)sn(s) ytDf ttraDcyie uoileaSn .ed ; / rsrea efcsBs / eev n fet u b=Bsado s) u.ui( ; ) ( x=Snhnw \uoileeb [iBs b ) yt.e( ttraRvr, \nu, ] ; y=Snhbfr(x \uoileaPn,[efcBs b ) yt.eoe , ttraDcyik \fetu, ] ; z=Snhbfr(x \uoileaSn,[efcBs b \uBs 1 ) yt.eoe , ttraDcyie \fetu, , otu, ] ; ) / Cag teblneo "e"t "r" / hne h aac f wt o dy yst \iet 1) / ol drc PnNie .e( drc, ; / ny iet ikos zst \iet 1) / ol drc Sn wv .e( drc, ; / ny iet ie ae yst \iet 0) / ol rvreae PnNie .e( drc, ; / ny eebrtd ikos zst \iet 0) / ol rvreae Sn wv .e( drc, ; / ny eebrtd ie ae yst \iet 05) / oiia PnNie .e( drc, . ; / rgnl ikos zst \iet 05) / oiia Sn wv .e( drc, . ; / rgnl ie ae (/ cmad t fe ec Ojc / omns o re ah bet xfe;x=nl .re i; yfe;y=nl .re i; zfe;z=nl .re i; bfe;b=nl .re i; )
I'm not going to explain this example as extensively as the previous one. It's definitely the most complex example so far. It's better if you figure out what the parts do by playing with them yourself. The bus works by routing audio from the \ u o i l e a P n and \ u o i l e a S n synths into the \ u o i l e e bsynth. The first two synths can be ttraDcyik ttraDcyie ttraRvr controlled to put all, none, or some of their signal into the bus (so that it goes through the \ u o i l e e bsynth), or ttraRvr
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 115/157
27.2.13.
Musicians' Guide
straight out the audio interface (bypassing the \ u o i l e e bsynth). Notice that the same effects processor is ttraRvr operating on two different input sources.
11.3.12.1. Ordering
Ordering is instructing the server to calculate in a particular order. The audio synthesized by the server takes the same form as any other digital audio: a series of samples are played at a particular speed (called sample rate), each with a set number of bits per sample (called sample format). For each sample, the server calculates the signal at that point in a pre-determined order. Each sample is calculated from scratch, so if a particular UGen depends on the output of another UGen, the other one had better be calculated first. For more information on samples, sample rate, and sample format, see Section 1.3, Sample, Sample Rate, Sample Format, and Bit Rate. Consider the following example:
{Sns.r fe:iOck(fe:,ad50 ml1 ) ml02) }pa; iOca( rqSns.r rq1 d:0, u:0 , u:. ; .ly
What happens if the server calculates the audio-rate UGen first? It wouldn't have a frequency. This is another one of those things which the interpreter takes care of automatically when we run Function rather than create a Synth. Since it's often preferable to use a synth instead of a Function, we need some way to control the order of execution. The interpreter and the server are only so good at guessing what we need, after all. There are two methods in the S n hClass that we can use to inform the server about our desired order of execution: yt "before" and "after". They represent a small extension to the "new" method, and they work like this: ffnSnhbfr( s u c y t . e o e variab leHoldingSynth, nameOfSynthDef, ListOfArguments) ; and f f n S n h a t r variab leHoldingSynth, nameOfSynthDef, ListOfArguments) sucyt.fe( ; And it works just as it looks, too: the server creates a new synth, adds it before or after the synth represented by "variableHoldingSynth" (depending on which Function you use), and uses "nameOfSynthDef" and "ListOfArguments" just as in the "add" method. This example, from Section 11.3.11.4, Using Busses: Control-Rate Example, uses the "after" Function to ensure that the control-rate synth is calculated before the audio-rate synths that depend on it.
(/ eeuefrt peaetesre / xct is: rpr h evr vrbsuiSnh= a uAdoyt { agbs feOfe =0 r u, rqfst ; Ota(0 Sns.r fe: I.rbs +feOfe ) ml01)) u.r , iOca( rq( nk(u) rqfst , u:. ; } ; vrbsotoSnh= a uCnrlyt { agbs fe =40 r u, rq 0; Otk(bs Sns.r fe:,ml(fe/0) adfe )) u.r u, iOck( rq1 u: rq4 , d:rq ; } ; Snhe(\uoiluiBs bsuiSnh)sn(s) ytDf ttraAdou, uAdoyt .ed ; Snhe(\uoilotoBs bsotoSnh)sn(s) ytDf ttraCnrlu, uCnrlyt .ed ; b=Bscnrl s) u.oto( ; ) (/ eeuescn:cet snh / xct eod rae yts x=Snhnw \uoilotoBs [bs b ) / cnrlsnh yt.e( ttraCnrlu, \u, ] ; / oto yt y=Snhatr x \uoiluiBs [bs b ) / lwadosnh yt.fe( , ttraAdou, \u, ] ; / o ui yt z=Snhatr x \uoiluiBs [bs b \rqfst 20 ) / hg ado yt.fe( , ttraAdou, \u, , feOfe, 0] ; / ih ui snh yt ) (/ cmad t fe ec Ojc / omns o re ah bet xfe;x=nl / cnrlsnh .re i; / oto yt yfe;y=nl / lwadosnh .re i; / o ui yt zfe;z=nl / hg adosnh .re i; / ih ui yt bfe;b=nl / cnrlbs .re i; / oto u )
In this case, the control-rate synth is created before the audio-rate synths - probably the easier way to think about it. Even so, it's possible to add them in the opposite order with a little extra thought. The other example from Section 11.3.11, Busses use the "before" Function to ensure that the "pink noise" and "sine wave" UGen's were calculated before the "reverberation" UGen. Especially since these are all audio-rate UGen's, the server would not reasonably know which to calculate first, so you need to let it know.
27.2.13.
Musicians' Guide
SuperCollider offers equally easy-to-use methods to change the order of execution. To move a synth's execution after another: v r a l H l i g y t f f n m v A t r variab leHoldingAnotherSynth) aibeodnSnhsucoefe( ; To move a synth's execution before another: vralHligytffnmvBfr( a i b e o d n S n h s u c o e e o e variab leHoldingAnotherSynth) ;
The "variableHoldingNewSynth" will often be the same as the "variableHoldingSynthToReplace," but not always. When you use this Function, the synth being replaced is freed from the server (equivalent to running "free"), so that variable should always be assigned something.
To re-start a synth:
vralHligyt.u(tu ) aibeodnSnhrn re ;
11.3.13. Scheduling
The practice of scheduling allows you to making things happen in a pre-determined amount of time. Scheduling is very different from ordering: ordering is a primarily technical consideration to ensure that the server synthesizes the sound in the right order; scheduling is a primarily musical consideration that allows you to control the perceived time that things happen.
11.3.13.1. Clocks
SuperCollider's clocks have two main functions: they know what time it is, and they know what time things are supposed to happen. There are three types of clocks, which each do slightly different things: TempoClock: These clocks are aware of metre (time signature) changes, and have an adjustable tempo. They are to be used for scheduling musical events, and they run with a high priority. SystemClock: This clock always runs in seconds. It can be used to schedule musical events, since it runs with a high priority. There is only one SystemClock. AppClock: These clocks always run in seconds. They are to be used for graphic events and other non-musical things not discussed in this guide. These clocks do not run with a high priority, so they can be temporarily "side-lined" by a TempoClock or the SystemClock, if one of those has something to do urgently.
The t i T r a . l c is not really a clock in itself, but refers to the clock which is responsible for scheduling the part hshedcok of the program where the command is written. It can be a little bit tricky working with this clock, since it may be either the SystemClock or a TempoClock.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
117/157
27.2.13.
SseCokbas ytmlc.et; Tmolc.eal.et; epCokdfutbas tiTra.lc.et; hshedcokbas
Musicians' Guide
This can be useful for scheduling events in an absolute way, or for a number of other things.
It looks like nothing happens. The 5does happen, but... well... it doesn't do anything. Scheduling a Function will do something:
SseCokshd 5 {5psl;}) ytmlc.ce( , .otn ;
When you run this, there are two things to notice: The interpreter prints out "SystemClock" first. This is to let you know that it did the scheduling as requested. The five prints out endlessly, in five-second intervals. For an explanation, see "Repeated Scheduling"
To avoid this, you can end your Function with n l which has been done sometimes through this guide. i,
SseCokshd 5 {5psl;nl }) ytmlc.ce( , .otn i; ;
This creates a new TempoClock. The arguments are optional, and have the following meanings: tempo: tempo of the clock, given in beats per second. To input a value in beats-per-minute, divide it by 60. Defaults to 60 beats per minute, or one per second. beats: starts the clock at this time. Default is zero.
tso; .tp t=nl i;
Equivalent to the "free" method for a Synth of Bus Object. This stops the clock, discards all scheduled events, and releases the resources used to run the clock. Setting the variable to "nil" afterwards is optional, but recommended, to avoid later programming mistakes.
tcer .la;
Allows you to change the clock's tempo. The new tempo should be in beats-per-second. To input a tempo in beats-perminute, divide the value by 60.
tpa(aucin) .ly Fnto ;
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
118/157
27.2.13.
Musicians' Guide
Schedules the Function to begin execution on the next beat. There are many other Functions in the TempoClock Class, related to absolute scheduling, scheduling with bars, and conversion of beats to and from seconds.
11.3.14.3. Email
If you feel comfortable sending an email to a mailing list, you can use the sc-users Mailing List, available at http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml. If you decide to subscribe to this list, be aware that it receives a large amount of mail every day.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
119/157
27.2.13.
Musicians' Guide
Method One (Optimized) is available at http://docs.fedoraproject.org/enUS/Fedora/15/html/Musicians_Guide/files/SuperCollider/Method_One-optimized.sc A FLAC-format recording of Method One is available at http://docs.fedoraproject.org/enUS/Fedora/15/html/Musicians_Guide/files/SuperCollider/Method_One.flac M t o _ n . cis an extensively-commented version of the source code. The comments not only describe the way the ehdOes code works, but pose some problems and questions that you may wish to work on, to increase your knowledge of SuperCollider. The problem with the verbosity of the comments is that it can be difficult to read the code itself, as it would be written in a real program. M t o _ n - p i i e . cis a less-commented version of the source code. I've also re-written part of the code, to ehdOeotmzds make it more flexible for use in other programs. The differences between this, and code that I would have written for myself only, are trivial. M t o _ n . l cis a recording that I produced of the program, which I produced in Ardour. ehdOefa
11.4.2. Inspiration
The intention of this program is to represent one way to write a SuperCollider program. I decided to take one class, SinOsc, and use it for "everything." Here, "everything" means any function that returns a sound, or any function that directly controls a SinOsc. In order to fill up time, I decided to employ a three-part "rounded binary" form: ABA' or "something, something new, then the first thing again." This is kind of like a sine oscillation, too!
I define a variable holding everything I want in the left channel, then the same for the right. I still use the [ , ] array notation to create a stereo array. Remember that SuperCollider functions return the last value stated, so it might look like the stereo array is ignored, but because this array is what is returned by the function contained between { and }, it is this array that gets played by the following ".play;" 5. I also added a frequency controller to the left SinOsc, and realized that it's getting a bit difficult to read again, especially if I wanted to add another parameter to the SinOsc.ar objects. So I placed the SinOsc.kr's into their own variables: frequencyL and frequencyR. This results in
{ vrfeuny =Sns.r fe:0 ml20 ad40) a rqecL iOck( rq1, u:0, d:0 ; vrfeuny =Sns.r fe:,ml5,ad10) a rqecR iOck( rq1 u:0 d:5 ; vrlf =Sns.r feuny ) a et iOca( rqecL ; vrrgt=Sns.r feuny ) a ih iOca( rqecR ; [lf,rgt] et ih }pa; .ly
6. Now I can experiment with the frequency-changing SinOsc's, to make sure that I get things just right. When I realize what the parameters do, I make a note for myself (see "FSC-method-1-.sc"), so that it will be easy to adjust it later. I also explicitly call the parameters. This isn't necessary, but it also helps to avoid future confusion. Most programmers would not explicitly call the parameters, but we're musicians, not programmers. 7. The left channel has something like a "melody," so I decided to add a drone-like SinOsc to it. This is easy, of course, because any SinOsc left alone is automatically a drone! But, where should it be added? Into the "left" variable, of course. We'll create an array using [ , ] array notation. There are two things that I would do at this point to help with future readability: a. Align all of the left-channel SinOsc's vertically (using tabs and spaces), so that each line is one soundgenerating UGen. b. At the end of each line, write a small comment describing what the UGen on that line doesn. 8. Now the volume is a problem. For most sound-producing UGen's, the "mul" argument controls the volume. For most of those, the default is "1.0," and anything greater will create distorted output. The physics and computer
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 120/157
27.2.13.
Musicians' Guide
science factors that wind up creating distortion are rather complicated, and it isn't necessary to understand them. What we need to know is that, if the output of a UGen (or some UGen's) sounds distorted, then we should probably adjust the "mul" argument. Sometimes, of course, you may prefer that distorted output. It seems that, when you're using multiple SinOsc's in one output channel, the "mul" of all of them must not add to more than 1.0 We're using two output channels (left and right). We'll leave the right channel alone for now, because it has only one output UGen. So, I'll change add a "mul" argument to each of the left-channel UGen's, to 0.5 9. Now we can't hear the left channel, because the right channel is too loud! Playing with volumes (sometimes called "adjusting levels" for computers) is a constant aesthetic concern for all musicians. Add a "mul" argument to the right channel, and set it to what seems an appropriate volume for the moment. It will probably change later, but that's okay. 10. But let's add another dimension to this: there's no reason to keep the volume static, because we can use a SinOsc to change it periodically! I added a SinOsc variable called "volumeL," which I used as the argument to "mul" for the "frequencyL" SinOsc in the left channel. 11. And now the sheer boredom of the drone in the left channel becomes obvious. I decide to make it more interesting by adding a series of overtones (an overtone is...). I decide to add six, then experiment with which frequencies to add. But, every time I adjust one frequency, I have to re-calculate and change all the others. So I decide to add a variable for the drone's frequency: "frequencyL_drone". This way, after finding the right intervals, I can easily adjust all of them just by changing the variable. I've decided on drone*1, 2, 5, 13, and 28. These are more or less arbitrary, and I arrived on them through experimentation. Of course, the drone will be way too loud. 12. Writing
Sns.r iOca( [rqecLdoe2feuny_rn,*rqecLdoe1*rqecLdoe2*rqe feuny_rn,*rqecLdoe5feuny_rn,3feuny_rn,8feu ny_rn] ml01) cLdoe, u:.
in your program is not easy to read, and actually it doesn't work out volume-balance-wise (for me, at least): the high frequencies are too loud, and the lower ones are not loud enough. In retrospect, I should have created a variable for the "mul" of these drones, so I could adjust them easily in proportion. But, I didn't. 13. A constant drone isn't as much fun as one that slowly changes over time. So, I changed the "frequencyL_drone" value to a SinOsc.kr UGen. Because it's supposed to be a "drone," it should change only very gradually, so I used a very small freqeuncy argument. It still moves quite quickly, but people won't want to listen to this too long, anyway! 14. I did something similar with the right channel, addding a slowly-changing drone and overtones above it. 15. After some final volume adjustments, I feel that I have completed the first part. There is no way to know for sure that you've finished until it happens. Even then, you may want to change your program later.
2. We already know that we want this to produce stereo output, and we already know that we're going to be using enough SinOsc's that we'll need to reduce "mul." Keeping in mind that there will be ten pitches, and two SinOsc's for each of them, set both of those things now, keeping just one pitch for now. 3. The first challenge is to implement pseudo-randomness. We'll use the number.rand function to generate a pseudo-random number (integer, actually), but if run as 5 . a d we will get a result between 0 and 50. As a 0rn, frequency, this is not useful: most audio equipment cannot produce pitches below 20 Hz, and many people have
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 121/157
27.2.13.
Musicians' Guide
problems hearing very low frequencies. This means that we'll need to add a value to .rand's output (like 1 0 + 0 5 . a d which will yield an integer between 100 and 150). I decided to go with a value between 200 Hz and 800 0rn, Hz instead, largely because I felt like it. Try setting the freq with the .rand call. 4. I hope you didn't end up with two different frequencies! If you did, you'll need to use a variable to temporarily store the pseduo-random frequency, so that both sides can use it. 5. Now we need to make ten of these, so copy-and-paste until there are ten different stereo pitches at once.
{ vrfeuny=20+60rn; a rqec 0 0.ad [Sns.r fe:rqec,ml00 ) Sns.r fe:rqec,ml00 )] iOca( rqfeuny u:.1 , iOca( rqfeuny u:.1 vrfeuny=20+60rn; a rqec 0 0.ad [Sns.r fe:rqec,ml00 ) Sns.r fe:rqec,ml00 )] iOca( rqfeuny u:.1 , iOca( rqfeuny u:.1 vrfeuny=20+60rn; a rqec 0 0.ad [Sns.r fe:rqec,ml00 ) Sns.r fe:rqec,ml00 )] iOca( rqfeuny u:.1 , iOca( rqfeuny u:.1 vrfeuny=20+60rn; a rqec 0 0.ad [Sns.r fe:rqec,ml00 ) Sns.r fe:rqec,ml00 )] iOca( rqfeuny u:.1 , iOca( rqfeuny u:.1 vrfeuny=20+60rn; a rqec 0 0.ad [Sns.r fe:rqec,ml00 ) Sns.r fe:rqec,ml00 )] iOca( rqfeuny u:.1 , iOca( rqfeuny u:.1 vrfeuny=20+60rn; a rqec 0 0.ad [Sns.r fe:rqec,ml00 ) Sns.r fe:rqec,ml00 )] iOca( rqfeuny u:.1 , iOca( rqfeuny u:.1 vrfeuny=20+60rn; a rqec 0 0.ad [Sns.r fe:rqec,ml00 ) Sns.r fe:rqec,ml00 )] iOca( rqfeuny u:.1 , iOca( rqfeuny u:.1 vrfeuny=20+60rn; a rqec 0 0.ad [Sns.r fe:rqec,ml00 ) Sns.r fe:rqec,ml00 )] iOca( rqfeuny u:.1 , iOca( rqfeuny u:.1 vrfeuny=20+60rn; a rqec 0 0.ad [Sns.r fe:rqec,ml00 ) Sns.r fe:rqec,ml00 )] iOca( rqfeuny u:.1 , iOca( rqfeuny u:.1 vrfeuny=20+60rn; a rqec 0 0.ad [Sns.r fe:rqec,ml00 ) Sns.r fe:rqec,ml00 )] iOca( rqfeuny u:.1 , iOca( rqfeuny u:.1 }pa; .ly
6. It doesn't work: you'll also have to rename your frequency-setting variable each time.
{ vrfeuny =20+60rn; a rqec1 0 0.ad [Sns.r fe:rqec1 ml00 ) Sns.r fe:rqec1 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 vrfeuny =20+60rn; a rqec2 0 0.ad [Sns.r fe:rqec2 ml00 ) Sns.r fe:rqec2 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 vrfeuny =20+60rn; a rqec3 0 0.ad [Sns.r fe:rqec3 ml00 ) Sns.r fe:rqec3 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 vrfeuny =20+60rn; a rqec4 0 0.ad [Sns.r fe:rqec4 ml00 ) Sns.r fe:rqec4 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 vrfeuny =20+60rn; a rqec5 0 0.ad [Sns.r fe:rqec5 ml00 ) Sns.r fe:rqec5 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 vrfeuny =20+60rn; a rqec6 0 0.ad [Sns.r fe:rqec6 ml00 ) Sns.r fe:rqec6 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 vrfeuny =20+60rn; a rqec7 0 0.ad [Sns.r fe:rqec7 ml00 ) Sns.r fe:rqec7 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 vrfeuny =20+60rn; a rqec8 0 0.ad [Sns.r fe:rqec8 ml00 ) Sns.r fe:rqec8 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 vrfeuny =20+60rn; a rqec9 0 0.ad [Sns.r fe:rqec9 ml00 ) Sns.r fe:rqec9 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 vrfeuny =20+60rn; a rqec0 0 0.ad [Sns.r fe:rqec0 ml00 ) Sns.r fe:rqec0 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 }pa; .ly
7. It still doesn't work! The error given in the "SuperCollider output" window is not easy to understand, but it means "You have to put all of your variable declarations before everything else."
{ vrfeuny =20+60rn; a rqec1 0 0.ad vrfeuny =20+60rn; a rqec2 0 0.ad vrfeuny =20+60rn; a rqec3 0 0.ad vrfeuny =20+60rn; a rqec4 0 0.ad vrfeuny =20+60rn; a rqec5 0 0.ad vrfeuny =20+60rn; a rqec6 0 0.ad vrfeuny =20+60rn; a rqec7 0 0.ad vrfeuny =20+60rn; a rqec8 0 0.ad vrfeuny =20+60rn; a rqec9 0 0.ad vrfeuny =20+60rn; a rqec0 0 0.ad [Sns.r fe:rqec1 ml00 ) Sns.r fe:rqec1 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 [Sns.r fe:rqec2 ml00 ) Sns.r fe:rqec2 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 [Sns.r fe:rqec3 ml00 ) Sns.r fe:rqec3 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 [Sns.r fe:rqec4 ml00 ) Sns.r fe:rqec4 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 [Sns.r fe:rqec5 ml00 ) Sns.r fe:rqec5 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 [Sns.r fe:rqec6 ml00 ) Sns.r fe:rqec6 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 [Sns.r fe:rqec7 ml00 ) Sns.r fe:rqec7 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 [Sns.r fe:rqec8 ml00 ) Sns.r fe:rqec8 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 [Sns.r fe:rqec9 ml00 ) Sns.r fe:rqec9 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 [Sns.r fe:rqec0 ml00 ) Sns.r fe:rqec0 ml00 )] iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 }pa; .ly
8. It still doesn't work! SuperCollider is confused because I was been lazy and didn't include enough semicolons. The error we get is, "Index not an Integer," which is a clue as to what SuperCollider is trying to do (but it's irrelevant). The real problem is that SuperCollider interprets our ten stereo arrays as all being part of the same statement. We don't want them to be the same statement, however, because we want ten different stereo arrays to
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 122/157
27.2.13.
Musicians' Guide
be played. Fix this problem by putting a semicolon at the end of each stereo array. You do not need to include one at the end of the last statement, because SuperCollider assumes the end of the statement when it encounters a } (end-of-function marker) after it. Since we're still building our code, we might move these around or add something aftwards, so it's better to include a semicolon at the end of each stereo array. 9. Now the file plays successfully, but with a disappointing result. If you can't already see the problem, try to think of it before continuing to read. 10. Only one SinOsc array gets played, and it's the last one. This is because the last statement is returned by the function that ends at } and it is that result which gets sent to the following .play 11. To fix this, and ensure that all of the stereo arrays are played, you should remove the .play from the end of the function, and add a .play to each stereo array statement. You end up with
{ vrfeuny =20+60rn; a rqec1 0 0.ad vrfeuny =20+60rn; a rqec2 0 0.ad vrfeuny =20+60rn; a rqec3 0 0.ad vrfeuny =20+60rn; a rqec4 0 0.ad vrfeuny =20+60rn; a rqec5 0 0.ad vrfeuny =20+60rn; a rqec6 0 0.ad vrfeuny =20+60rn; a rqec7 0 0.ad vrfeuny =20+60rn; a rqec8 0 0.ad vrfeuny =20+60rn; a rqec9 0 0.ad vrfeuny =20+60rn; a rqec0 0 0.ad [Sns.r fe:rqec1 ml00 ) Sns.r fe:rqec1 ml00 ) iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 ]pa; .ly [Sns.r fe:rqec2 ml00 ) Sns.r fe:rqec2 ml00 ) iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 ]pa; .ly [Sns.r fe:rqec3 ml00 ) Sns.r fe:rqec3 ml00 ) iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 ]pa; .ly [Sns.r fe:rqec4 ml00 ) Sns.r fe:rqec4 ml00 ) iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 ]pa; .ly [Sns.r fe:rqec5 ml00 ) Sns.r fe:rqec5 ml00 ) iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 ]pa; .ly [Sns.r fe:rqec6 ml00 ) Sns.r fe:rqec6 ml00 ) iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 ]pa; .ly [Sns.r fe:rqec7 ml00 ) Sns.r fe:rqec7 ml00 ) iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 ]pa; .ly [Sns.r fe:rqec8 ml00 ) Sns.r fe:rqec8 ml00 ) iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 ]pa; .ly [Sns.r fe:rqec9 ml00 ) Sns.r fe:rqec9 ml00 ) iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 ]pa; .ly [Sns.r fe:rqec0 ml00 ) Sns.r fe:rqec0 ml00 ) iOca( rqfeuny, u:.1 , iOca( rqfeuny, u:.1 ]pa; .ly }
12. When you execute this, no sound is produced, but SuperCollider outputs "a Function." Can you think of why this happens? It's because you wrote a function, but never told SuperCollider to evaluate it! At the end of execution, SuperCollider just throws away the function, because it's never used. This is the same thing that happened to the first nine stereo arrays - they were created, but you never said to do anything with them, so they were just thrown out. We need to execute the function. Because it doesn't produce a UGen, we can't use "play," so we have to use "value" instead. You can choose to do either of these:
{..}vle . .au;
or
vrmFnto ={..} a yucin . ; mFnto.au; yucinvle
13. This gives us yet another error, as if we can't play the stereo arrays! In fact, we can't - and we didn't do it in the first part, either. We play'ed the result of returning a stereo array from a function. The subtle difference isn't important yet - we're just trying to make this work! Use { and } to build a function for .play to .play 14. Now make the correction nine more times. 15. When you play execute the resulting code, you probably get something that sounds quite "space-age." Execute it a few times, to see the kind of results you get.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
123/157
27.2.13.
Musicians' Guide
3. You can schedule something on a TempoClock by using t c s h d x f ) , where fis a function to execute, _.ce( , ; and xis when it should be done, measured as the number of beats from now. So we can schedule our SinOsc like this:
tcshd 1 {[Sns.r fe:rqec1 ml00 ) Sns.r fe:rqec1 _.ce( , { iOca( rqfeuny, u:.1 , iOca( rqfeuny, ml00 )].ly}) u:.1 }pa; ;
4. Schedule the rest, in intervals of five beats (which is five seconds). They will all be scheduled virtually instantaneously (that is, the computer will notice the slight delay between when each one is scheduled, but humans will not). I started at one beat from now, to insert a slight pause before the sound begins. 5. If you've done this correctly, then we should get a build-up of ten pitches. But they never stop! This is going to take some more ingenuity to solve, because we can't just make a stereo array, play it, then throw it away. We need to hold onto the stereo array, so that we can stop it. The first step here is to store the stereo arrays in variables, and subsequently schedule them. You will end up with something like this:
vrsns1={[Sns.r fe:rqec1 ml00 ) Sns.r fe:rqec1 a ioc iOca( rqfeuny, u:.1 , iOca( rqfeuny, ml00 )]} u:.1 ; / teohrnn.. / h te ie. tcshd 1 {sns1pa;}) _.ce( , ioc.ly ; / teohrnn.. / h te ie.
6. It should still work, but we after all that cutting-and-pasting, we still haven't managed to turn off the SinOsc's. We need to "free" the object that was returned when we used the "play" function. We need to declare yet more variables: v r s 1 s 2 s 3 s 4 s 5 s 6 s 7 s 8 s 9 s 0 should appear anywhere before a o, o, o, o, o, o, o, o, o, o; the scheduler. 7. Now adjust all the scheduling commands so they look like this: t c s h d 1 { s 1 = s n s 1 p a ; } _.ce( , o ioc.ly ) ; 8. Now you can add ten of these, after the existing scheduling commands: t c s h d 5 , { s 1 f e ; } ) . _.ce( 1 o.re ; Be sure to schedule each one for 51 beats, so that they all turn off simultaneously, 5 beats after the last pitch is added. 9. It should work successfully. If it doesn't, then compare what you have to this, which does work:
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
124/157
27.2.13.
vrtc=Tmolc.eal; a _ epCokdfut { vrfeuny =20+60rn; a rqec1 0 0.ad vrfeuny =20+60rn; a rqec2 0 0.ad vrfeuny =20+60rn; a rqec3 0 0.ad vrfeuny =20+60rn; a rqec4 0 0.ad vrfeuny =20+60rn; a rqec5 0 0.ad vrfeuny =20+60rn; a rqec6 0 0.ad vrfeuny =20+60rn; a rqec7 0 0.ad vrfeuny =20+60rn; a rqec8 0 0.ad vrfeuny =20+60rn; a rqec9 0 0.ad vrfeuny =20+60rn; a rqec0 0 0.ad
Musicians' Guide
vrsns1={[Sns.r fe:rqec1 ml00 ) Sns.r a ioc iOca( rqfeuny, u:.1 , iOca( fe:rqec1 ml00 )]} rqfeuny, u:.1 ; vrsns2={[Sns.r fe:rqec2 ml00 ) Sns.r a ioc iOca( rqfeuny, u:.1 , iOca( fe:rqec2 ml00 )]} rqfeuny, u:.1 ; vrsns3={[Sns.r fe:rqec3 ml00 ) Sns.r a ioc iOca( rqfeuny, u:.1 , iOca( fe:rqec3 ml00 )]} rqfeuny, u:.1 ; vrsns4={[Sns.r fe:rqec4 ml00 ) Sns.r a ioc iOca( rqfeuny, u:.1 , iOca( fe:rqec4 ml00 )]} rqfeuny, u:.1 ; vrsns5={[Sns.r fe:rqec5 ml00 ) Sns.r a ioc iOca( rqfeuny, u:.1 , iOca( fe:rqec5 ml00 )]} rqfeuny, u:.1 ; vrsns6={[Sns.r fe:rqec6 ml00 ) Sns.r a ioc iOca( rqfeuny, u:.1 , iOca( fe:rqec6 ml00 )]} rqfeuny, u:.1 ; vrsns7={[Sns.r fe:rqec7 ml00 ) Sns.r a ioc iOca( rqfeuny, u:.1 , iOca( fe:rqec7 ml00 )]} rqfeuny, u:.1 ; vrsns8={[Sns.r fe:rqec8 ml00 ) Sns.r a ioc iOca( rqfeuny, u:.1 , iOca( fe:rqec8 ml00 )]} rqfeuny, u:.1 ; vrsns9={[Sns.r fe:rqec9 ml00 ) Sns.r a ioc iOca( rqfeuny, u:.1 , iOca( fe:rqec9 ml00 )]} rqfeuny, u:.1 ; vrsns0={[Sns.r fe:rqec0 ml00 ) Sns.r a ioc iOca( rqfeuny, u:.1 , iOca( fe:rqec0 ml00 )]} rqfeuny, u:.1 ; vrs1 s2 s3 s4 s5 s6 s7 s8 s9 s0 a o, o, o, o, o, o, o, o, o, o; tcshd 1 {s1=sns1pa;}) _.ce( , o ioc.ly ; tcshd 6 {s2=sns2pa;}) _.ce( , o ioc.ly ; tcshd 1,{s3=sns3pa;}) _.ce( 1 o ioc.ly ; tcshd 1,{s4=sns4pa;}) _.ce( 6 o ioc.ly ; tcshd 2,{s5=sns5pa;}) _.ce( 1 o ioc.ly ; tcshd 2,{s6=sns6pa;}) _.ce( 6 o ioc.ly ; tcshd 3,{s7=sns7pa;}) _.ce( 1 o ioc.ly ; tcshd 3,{s8=sns8pa;}) _.ce( 6 o ioc.ly ; tcshd 4,{s9=sns9pa;}) _.ce( 1 o ioc.ly ; tcshd 4,{s0=sns0pa;}) _.ce( 6 o ioc.ly ; tcshd 5,{s1fe;}) _.ce( 1 o.re ; tcshd 5,{s2fe;}) _.ce( 1 o.re ; tcshd 5,{s3fe;}) _.ce( 1 o.re ; tcshd 5,{s4fe;}) _.ce( 1 o.re ; tcshd 5,{s5fe;}) _.ce( 1 o.re ; tcshd 5,{s6fe;}) _.ce( 1 o.re ; tcshd 5,{s7fe;}) _.ce( 1 o.re ; tcshd 5,{s8fe;}) _.ce( 1 o.re ; tcshd 5,{s9fe;}) _.ce( 1 o.re ; tcshd 5,{s0fe;}) _.ce( 1 o.re ; }vle .au;
27.2.13.
Musicians' Guide
2. Take the code required to generate one stereo array of SinOsc's with a pseudo-random frequency. Put it in a function, and declare a variable for it (I used the name "func"). 3. Now remove the frequency1 (etc.) variables, and change the sinosc1 (etc.) variables to use the new function. Make sure that the code still works in the same way. It's much easier to troubleshoot problems when you make only one change at a time! 4. At this point, we've eliminated ten lines of code, and made ten more lines easier to read by eliminating the subtle copy-and-paste changes. If you can't manage to work it out, refer to the FSC_method_1.sc file for tips. 5. We can eliminate ten more lines of code by using a loop with an array. Let's change only one thing at a time, to make it easier to find a problem, if it should arise. Start by commenting out the lines which declare and initialize sinosc1, sinosc2, and so on. 6. Then declare a ten-element array in the same place: v r s n s = A r y n w 1 ) a ioc ra.e( 0 ; 7. The next part is to write code to get ten func.value's into the array. To add something to an array in SuperCollider, we use the "add" method: s n s . d ( t i g t _ d ) There is a small wrinkle to this, described in the iocad hn_oad ; SuperCollider documentation. It's not important to understand (for musical reasons, that is - it is explained on this help page), but when you add an element to an array, you should re-assign the array to the variable-name: s n s ioc = s n s . d ( t i g t _ d )Basically it works out like this: if you don't re-assign, then there is a chance iocad hn_oad that the array name only includes the elements that were in the array before the "add" command was run. 8. With this, we are able to eliminate a further level of redundancy in the code. Ten exact copies of s n s = ioc s n s . d ( { f n . a u ; } ) Now, ten lines that look almost identical actually are identical. iocad ucvle ; Furthermore, we don't have to worry about assigning unique names, or even about index numbers, as in other programming languages. SuperCollider does this for us! 9. This still won't work, because we need to adjust the rest of the function to work with this array. The scheduling commands be changed to look something like this: t c s h d 1 { s 1 = s n s [ ] p a ; } ) Since _.ce( , o ioc0.ly ; arrays are indexed from 0 to 9, those are the index numbers of the first ten objects in the array. 10. Remember that you need to put all of your variable declarations b efore anything else. 11. It should still work. Let's use a loop to get rid of the ten identical lines. 12. In SuperCollider, x d ( f ) will send the v l emessage to the function fxtimes. So, to do this ten times, we .o ; au should write 1 . o { s n s = s n s . d ( { f n . a u ; } ) } ) and get rid of the other ones. 0d( ioc iocad ucvle ; ; This is very powerful for simple things that must be done multiple times, because you are definitely not going to make a copy-and-paste error, because it's easy to see what is being executed, and because it's easy to see how many times it is being executed. 13. Now let's reduce the repetitiveness of the scheduling. First, replace so1, so2, etc. with a ten-element array. Test it to ensure that the code still works. 14. Getting the next two loops working is a little bit more complicated. We know how to run the exact same code in a loop, but we don't know how to change it subtly (by supplying different index numbers for the array, for example). Thankfully, SuperCollider provides a way to keep track of how many times the function in a loop has already been run. The first argument given to a function in a loop is the number of times that the function has already been executed. The first time it is run, the function receives a 0; if we're using a 1 . o s m t i g ) loop, then the 0d( oehn ; last time the function is run, it receives a 9 because the function has already been executed 9 times. Since our ten-element array is indexed from 0 to 9, this works perfectly for us. 15. The code to free is shorter: 1 . o { a g i d x t c s h d 5 , { s [ n e ] f e ; } ) } ) This 0d( r ne; _.ce( 1 oidx.re ; ; can look confusing, especially written in one line, like it is. If it helps, you might want to write it like this instead:
1.o 0d ( agidx { r ne; tcshd 5,{s[ne]fe;}) _.ce( 1 oidx.re ; }; )
Now it looks more like a typical function. 16. The next step is to simplify the original scheduling calls in a similar way, but it's slightly more complicated because we have to schedule a different number of measures for each call. With a little math, this is also not a problem - it's just a simple linear equation: n m e _ f m a u e = 5 * a r y i d x + 1Try to write this ubro_esrs ra_ne loop by yourself, before going to the next step. 17. If you missed it, my solution is
1.o {agidx tcshd (5idx+) {s =s.d(sns[ne]pa;) } 0d( r ne; _.ce( (*ne)1, o oad iocidx.ly ; ) }) ; ;
which includes some extra parentheses to ensure that the math is computed in the right order. 18. The code is already much shorter, easier to understand, and easier to expand or change. There is one further optimzation that we can easily make: get rid of the sinosc array. This simply involves replacing s n s [ n e ] iocidx with what all of its elements are: { f n . a u ; } ucvle 19. The resulting program is a little different from what ended up in FSC_method_1.sc, but produces the same output. What I have is this:
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
126/157
27.2.13.
vrtc=Tmolc.eal; a _ epCokdfut { vrs =Arynw 1 ) a o ra.e( 0 ;
Musicians' Guide
vrfn = a uc { vrfeuny=20+60rn; a rqec 0 0.ad [Sns.r fe:rqec,ml00 ) Sns.r fe:rqec,ml00 ) iOca( rqfeuny u:.1 , iOca( rqfeuny u:.1 ] ; } ; 1.o {agidx tcshd (5idx+) {s =s.d({ucvle}pa; 0d( r ne; _.ce( (*ne)1, o oad fn.au;.ly ) }) }) ; ; ; 1.o {agidx tcshd 5,{s[ne]fe;}) }) 0d( r ne; _.ce( 1 oidx.re ; ; }vle .au;
20. Finally, assign this Function to a variable (called "secondPart", perhaps), and remove the "value" Function-call. If we leave that in, the Function will execute before the rest of the program begins!
This Function is the perfect solution if you want ten pseudo-random pitches between 200 Hz and 800 Hz, and a fivesecond pause between each one. If you want nine or eleven pitches, if you want them to eb between 60 Hz and 80Hz, if you want a six-second pause between each - you would have to modify the Function. If you don't remember how it works, or if you give it to a friend, you're going to have to figure out how it works before you modify it. This is not an ideal solution. Let's solve these problems one at a time, starting with allowing a different number of SinOsc synths to be created. We know that we'll have to create an argument, and that it will have to be used wherever we need the number of SinOsc's. Also, to preserve functionality, we'll make a default assignment of 10. Try to accomplish this yourself, making sure to test your Function so that you know it works. Here's what I did:
vrtc=Tmolc.eal; a _ epCokdfut vrscnPr = a eodat { agnme_fSnss=1; r ubro_iOc 0 vrs =Arynw nme_fSnss) a o ra.e( ubro_iOc ; vrfn = a uc { vrfeuny=20+60rn; a rqec 0 0.ad [Sns.r fe:rqec,ml00 ) Sns.r fe:rqec,ml00 )] iOca( rqfeuny u:.1 , iOca( rqfeuny u:.1 ; } ; nme_fSnssd({agidx tcshd (5idx+) {s =s.d( ubro_iOc.o r ne; _.ce( (*ne)1, o oad {ucvle}pa;) }) }) fn.au;.ly ; ; ; nme_fSnssd({agidx tcshd 5,{s[ne]fe;}) }) ubro_iOc.o r ne; _.ce( 1 oidx.re ; ; } ;
The "do" loop doesn't need a constant number; it's fine with a variable. What happens when you pass a bad argument, like a string? This would be an easy way to sabotage your program, and in almost any other programming context it would concern us, but this is just audio programming. If somebody is going to try to create "cheese" SinOsc's, it's their own fault for mis-using the Function.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 127/157
27.2.13.
Musicians' Guide
Now let's modify the Function so that we can adjust the range of frequencies that the Function will generate. We know that we'll need two more arguments, and that they'll have to be used in the equation to calculate the frequency. But we'll also need to do a bit of arithmetic, because of the way the "rand" Function works (actually we don't - see the "rand" Function's help file). Also, to preserve functionality, we'll make default assignments of 200 and 800. Try to accomplish this yourself, making sure that you test the Function so you know it works. Here's what I did:
vrtc=Tmolc.eal; a _ epCokdfut vrscnPr = a eodat { agnme_fSnss=1, r ubro_iOc 0 pthlw=20 ic_o 0, pthhg =80 ic_ih 0; vrs =Arynw nme_fSnss) a o ra.e( ubro_iOc ; vrfn = a uc { vrfe =pthlw+(ic_ih-pthlw.ad a rq ic_o pthhg ic_o)rn; [Sns.r fe:rq ml00) iOca( rqfe, u:.1, Sns.r fe:rq ml00)] iOca( rqfe, u:.1 ; } ; nme_fSnssd({agidx tcshd (5idx+) {s =s.d( ubro_iOc.o r ne; _.ce( (*ne)1, o oad {ucvle}pa;) }) }) fn.au;.ly ; ; ; nme_fSnssd({agidx tcshd 5,{s[ne]fe;}) }) ubro_iOc.o r ne; _.ce( 1 oidx.re ; ; } ;
Notice that I changed the name of the variables, and the indentation in the "func" sub-Function, to make it easier to read. This isn't a particularly difficult change. Now let's allow the user to set the length of time between each SinOsc appears. We will need one more argument, used in the scheduling command. Try to accomplish this yourself, and if you run into difficulty, the next paragraph contains some tips. The change to the "do" loop which schedules the SinOsc's to play is almost trivial. My new argument is called "pause_length", (meaning "the length of the pause, in seconds, between adding each SinOsc"), so I get this modification: number_of_SinOscs.do(
{ agtm; r ie scnPr_lc.ce((+tm*),{sud =sud.d(fn.ly) }) eodatcokshd 1(ie5) ons onsad ucpa ; ; }; )
Again, I changed the indentation, and the names of the variables in this sub-Function. Recall that the "1+" portion is designed to add a one-second pause to the start of the Function's execution. The problem comes in the next "do" loop, where we have to know how the number of beats from now will be five seconds after the last SinOsc is added. We'll have to calculate it, so I added a variable to store the value after it's calculated. This also allows us to return it, as a convenience to the Function that called this one, so that it knows how long until this Function is finished. Try adding this yourself, then testing the Function to ensure that it works. I got this:
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
128/157
27.2.13.
vrtc=Tmolc.eal; a _ epCokdfut vrscnPr = a eodat { agnme_fSnss=1, r ubro_iOc 0 pthlw=20 ic_o 0, pthhg =80 ic_ih 0, puelnt =5 as_egh ; vrs =Arynw nme_fSnss) a o ra.e( ubro_iOc ;
Musicians' Guide
vrwe_oso =(1+(puelnt *nme_fSnss)) a hnt_tp as_egh ubro_iOc ; vrfn = a uc { vrfe =pthlw+(ic_ih-pthlw.ad a rq ic_o pthhg ic_o)rn; [Sns.r fe:rq ml00) iOca( rqfe, u:.1, Sns.r fe:rq ml00)] iOca( rqfe, u:.1 ; } ; nme_fSnssd( ubro_iOc.o { agtm; r ie tcshd (+tm*),{s =s.d(fn.ly) }) _.ce( 1(ie5) o oad ucpa ; ; }; ) tcshd we_oso, _.ce( hnt_tp { nme_fSnssd({agidx s[ne]fe;}) ubro_iOc.o r ne; oidx.re ; nl i; }; ) we_oso; hnt_tp } ;
I decided to "invert" the "free-ing" of the SinOsc's. Rather than scheduling number_of_SinOscs Function-calls at some point in the future, I decided to schedule one thing: a "do" loop that does the work. The indentation looks strange, but sometimes there's not much you can do about that. The "when_to_stop" variable must be the last thing in the Function, so that the interpreter returns it to the Function's caller. In order to retain the "bare minimum" robustness to be used elsewhere, we can't rely on the "TempoClock.default" clock having the tempo we expect, and we certainly can't rely on it being declared as "t_c". The solution is quite easy: create a new TempoClock within the Function.
vrtc=Tmolc.e;/ dfuttmoi oeba prscn a _ epCoknw / eal ep s n et e eod
We could hypothetically use the "SystemClock", since we're measuring time strictly in seconds. But, using a TempoClock is preferred for two reasons: 1. It has the word "tempo" in its name, and it's designed for scheduling musical events; the "SystemClock" is for system events. 2. We can easily extend this in the future to use a "TempoClock" set to a different tempo. There are some further ways to improve this Function, making it more robust (meaning that it will work consistently in a greater range of circumstances). Here are things that could be done to improve the Function, with an explanation of why it would make the Function more robust: Made the clock an argument, allowing this Function to schedule events on a clock belonging to some other Function. Since all clocks respond to the "sched" message, we could even accept the "SystemClock" or "AppClock". The default value would still be T m o l c . e epCoknw Use absolute scheduling rather than relative scheduling. Depending on how long the server and interpreter take to process the commands, it could lead to significant delays if the Function is asked to create a lot of SinOsc's. Create one SynthDef (with an argument) for all of the synths. Especially when asked to create a large numbe of SinOsc's, this will lead to faster processing and lower memory consumption. On the other hand, it increases the complexity of the code a little bit, requiring more testing. Each SinOsc is currently created with the same "mul" argument, regardless of how many SinOsc's are created. Set as it is, when asked to create 51 SinOsc's, the signal would become distorted. If you're puzzled about why 51, remember that for each SinOsc the Function is asked to create, it currently creates two: one for the left and one for the right audio channel. Allow the SynthDef to be passed in as an argument, with the requirement that such a SynthDef would need to accept the "freq" and "mul" arguments. This is going out on a limb a bit, and requires careful explanation in comments to ensure that the Function is used correctly. You will also need to test what happens if the Function is used incorrectly. Crashing the server application is a bad thing to do, especially without a warning. Use a Bus to cut the number of synths in half, so that one synth will be sent both to the left and right channels. Alternatively, you could add special stereo effects. As you can see, there are a lot of ways to improve this Function even further; there are almost certainly more ways than listed here. Before you distribute your Function, you would want to be sure to test it thoroughly, and add helpful comments so that the Function's users know how to make the Function do what they want. These are both large topics in themselves, so I won't give them any more attention here.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
129/157
27.2.13.
Musicians' Guide
Why is the "nil" required after "secondPart"? Because that function returns a number. As you know, any scheduled function which returns a number will re-schedule itself to run that many beats after the previous execution began. Since "secondPart" returns the number of seconds it takes to finish, it will always be re-started as soon as it finishes. Including "nil" disallows this repetition.
27.2.13.
Musicians' Guide
contains some help with the D s O tUGen, and links to other useful help files. This method is not further discussed iku here.
27.2.13.
Musicians' Guide
12.7.4. Input Notes 12.8. Work on a Piano Score (Tutorial) 12.8.1. Files for the Tutorial 12.8.2. Start the Score 12.8.3. Adjust Frescobaldi's Output 12.8.4. Input Notes 12.8.5. Troubleshoot Errors 12.8.6. Format the Score (Piano Dynamics) LilyPond is a musical notation program that creates a visually appealing musical score. LilyPond text files contain the semantic meaning of a musical score, rather than details about a musical score's visual appearance. Popular proprietary musical notation applications represent the visual apperance of a score. People who use visual notation applications constantly worry about how their score looks. LilyPond users only worry about what the score means, because LilyPond automatically creates an expert result. This is where LilyPond comes in - users don't need to worry about how their score will work, because they know that the expertly-crafted methods of LilyPond will automatically configure the objects on the score so that they look good, and are easy to read. LilyPond's users focus on what needs to be displayed, rather than on how it is going to be displayed. As with any particular approach, the LilyPond approach is not for everybody. However, once you have become accustomed to working with the software, and once you have learned methods to help deal with problems and organize your scores' source-files, you will probably realize that LilyPond is both much faster, and much more flexible, than traditional, commercially-available music engraving programs. With LilyPond, you can: Put a score into LaTeX or HTML documents. Put a score into an LibreOffice document, with the ooolilypond program. Use any major operating system. Manage parts and full scores for large compositions. Create new musical symbols with the Scheme programming language. It is the goal of this guide to help users more quickly overcome the initial learning handicap incurred because of the textbased approach. Making use of tools such as the Frescobaldi text-editor will help to increase productivity, to make trouble-shooting easier, and to ease the memory burden associated with the text-based approach.
27.2.13.
Musicians' Guide
Frescobaldi is an advanced text editor specifically for LilyPond source files. The Frescobaldi user interface simplifies the task of creating and editing musical scores in LilyPond. Here are some benefits of Frescobaldi: The Frescobaldi text-editing component, PDF-preview component, and help file viewer are the same as common applications you may already know (Kate/KWrite, Okular, and Konqueror). The Frescobaldi user interface allows you to view the LilyPond source file and the PDF output or a LilyPond help document at the same time. You can setup a new score quickly with the "Setup new score" tool. The "Setup new score" tool offers several advanced customization features. You can insert articulation, trill, and other musical symbols with the "Quick Insert" sidebar on the left side of the Frescobaldi window. You do not need to consult a LilyPond reference file to remember the correct command because Frescobaldi remembers for you. The LilyPond menu in Frescobaldi offers many tools to adjust and troubleshoot your score files. You can input notes with a MIDI keyboard, listen to the MIDI output of a LilyPond score, and print the PDF file of your score from within Frescobaldi.
Note
You do not need to fill every field. If you use GNOME, we recommend you set the "PDF Viewer" to e i c . Frescobaldi will use Evince when you vne choose O e P F The O e P Fbutton is only visible after you create a score. pn D. pn D If you want to play a LilyPond MIDI file, fill in the "MIDI Player" field. You can use timidity++ to convert the MIDI file into a sound file. You can use pmidi (from the Planet CCRMA at Home repository--see Chapter 4, Planet CCRMA at Home for information). Use a terminal emulator to view the man help page for timidity++ or pmidi. If you do not want to download the LilyPond help files whenever Frescobaldi uses them: Install the lilypond-doc package. This package takes a long time to download. Write / s / h r / o / i y o d d c 2 1 . / n e . t lin the "LilyPond documentation" field. ursaedcllpn-o-.61idxhm You must update this path when LilyPond is updated. By default, PackageKit will only download the changed documentation with each update, so only the first installation will have a long download. 4. The options for the "Editor Component" are the same as those for KWrite or Kate. If you change settings for Frescboaldi, they do not also change for KWrite or Kate. We recommend that you turn off auto-completion. Select the E i i gcomponent, then the A t C m l t o dtn uo opein tab, then ensure that both check-boxes are un-marked You may want to change other settings here; highly-flexible, customizable, powerful; applies only in Frescobaldi
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
133/157
27.2.13.
Musicians' Guide
We recommend the default way to indicate a "sharp" or "flat" note: add "is" to sharp a note, or add "es" to flat a note. This command means "b-flat, b, b-sharp": b s b b s e i. Show a double-sharp or double-flat with "isis" or "eses." This command means "b-double-flat, b, b-double-sharp": b s s ee bbss ii. "Is" and "es" are the Dutch names for "sharp" and "flat." LilyPond can read English names: b l t b b h r . We fa sap recommend you use Dutch names because they are faster. Pitch can be entered either absolutely, or relative to the preceding notes. Usually (for music without frequent large leaps) it is more convenient to use the "relative" mode. The symbols ,and '(comma and apostrophe) are used to indicate register. When entering absolute pitches, the register is indicated mostly as in the Helmholtz system (see Helmholtz Pitch Notation (Wikipedia) at http://en.wikipedia.org/wiki/Helmholtz_pitch_notation: octaves begin on the pitch "C," and end eleven tones higher on the pitch "B." The octave below "middle C" (octave 3 in scientific pitch notation - see Scientific Pitch Notation (Wikipedia) at http://en.wikipedia.org/wiki/Scientific_pitch_notation Scientific Pitch Notation) has no commas or apostrophes. The octave starting on "middle C" (octave 4) has one apostrophe; the octave above that (octave 5) has two apostrophes, and so on. Octave 2 (starting two octaves below "middle C") has one comma, the octave below that has two commas, and so on. It is usually not necessary to understand how to use this in LilyPond, or to be able to use it quickly, because most scores will use "relative mode." When entering pitches relative to the previous one, the register is still indicated with commas or apostrophes, but usually none are needed. When using this input mode, the octave of each note is guessed based on the octave of the previous note. Think of it this way: the next note will always be placed so it produces the smaller interval. For example, after a C, an E could be placed as a major third, a minor sixth, a major tenth, a minor thirteenth, and so on. In relative mode, LilyPond will always choose the "major third" option. If you wanted LilyPond to notate the E so that it's a minor sixth, you would tell LilyPond with a comma appended: c e so that LilyPond knows what you want. It's the same case if you were to input c , a s(meaning "C then A-flat"): the A-flat will be notated so that it is a major third from the C; if you wanted LilyPond to e notate it so that the A-flat is a minor sixth higher than the C, you would need to append an apostrophe: c a s e' The only possible ambiguity with this method is with a tritone. LilyPond solves this by not recognizing "tritones," per se, and thinking of them as "augmented fourth" or "diminished fifth." Unless instructed otherwise (with a comma or apostrophe), LilyPond will always notate the interval as an augmented fourth. You must always indicate a sharp or flat, even if it is already in a key signature. This ultimately helps to reduce the number of errors. Letters used to indicate pitch are always in lower-case.
12.5.3. Articulations
Many different symbols are used to tell LilyPond to add articulation signs to a note. They are all appended after the pitch and (if included) duration, and many have a position indicator, too. A full list of articulation markings is available in the LilyPond manual, and Frescobaldi remembers most of them for you (they are stored in the left-side panel). These are some of the most common articulation marks, which use a position indicator unless specified otherwise: (to begin a slur (no position indicator) )to end a slur (no position indicator) ~to begin a tie (which needs no end; no position indicator) .for a "staccato" mark >for an "accent" -for a "tenuto" mark ^for a "marcato" mark _for a "portato" mark (dot and line) There are three position indicators: -which means to put the articulation mark wherever LilyPond thinks it makes sense
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 134/157
27.2.13.
Musicians' Guide
_which means to put the articulation mark b elow the note-head ^which means to put the articulation mark ab ove the note-head These position indicators will sometimes result in notes like: g - , g _ , and g ^ , but although this may look incorrect, 4- 4_ 4^ it is perfectly acceptable.
12.5.4. Simultaneity
Simply put, anything enclosed inside < and > is considered by LilyPond to happen simultaneously. This can be used < > in any context (and any Context - see above/below). It is possible to tell LilyPond that you want two notes to happen at the same time in the same voice (yielding a chord), at the same time on the same staff (yielding polyphony), and so on. Moreover, any score with multiple staves will use < and > to tell LilyPond that the parts should begin at the same time, < > and creative use of < and > is one of the keys to advanced notation. < > It is not important to understand simultaneity at first. By observing how Frescobaldi creates scores for you, and how examples on the internet take advantage of these symbols, you will eventually understand how to use them.
12.5.5. Chords
Making use of the < and > idea to indicate simultaneity, if a note has multiple pitches indicated between >and <then < > LilyPond assumes that they are in a chord together. Notating a single chord with single < >brackets has two advantages: firstly, it is easier to see that they are a chord and not something more complex; secondly, it allows you to enter information more clearly. Consider the following examples, which should produce equivalent output: < g 4 > 5 b d >and < ' b d 4 > 5With <'-> g >-the first example, it is more difficult to see the chord notes, the duration, and what the 5means. With the second example, it is easy to see that the chord notes are a G a B and a D that they have quarter-note duration, and that the 5is actually a , , , fingering indication. There is another advantage to using <and >for notation of simple chords: they preserve logical continuity in "relative" mode. The following note will always be notated as relative to the lowest note in the chord, regardless of how many octaves the chord covers. This is not true with < and > , where where following notes will be notated as relative to the < > last note between the < and > < >
12.5.6. Commands
There are a wide variety of commands available in LilyPond, some of them quite simple, and other quite complex. They all begin with a backslash, followed by the name of the command, and subsequent "arguments" that give the command further information about what you want it to do. Just like using a letter to indicate a note, commands are simply another way for you to tell LilyPond how you want your score to be rendered. For example, \ i e 2 4and \ l f b s are two commands that you are likely to use quite often. They happen to do tm / ce as precisely what it seems like they should: \ i echanges the time signature and metre, and \ l fchanges the clef. they tm ce belong to differen contexts (\ i eapplies for the whole Score, but \ l ffor only one Staff). tm ce It can take some time to remember even these basic commands and the way you should format their input, and this is where Frescobaldi's built-in documentation viewer can help out. All of the official LilyPond documentation is made available in Frescobaldi, which makes it easy for you to view the documentation and make changes to your score in the same window of the same application.
12.5.6.1. Customization
It is rarely necessary to customize the output in a way that is very specific, and not allowed for in the standard LilyPond syntax. As a beginner, this can happen quite often when you are trying to exactly emulate the look of a pre-existing score. Remember that LilyPond provides a content-focussed way to express music, and that it will usually produce meaningful output without advanced interference. If in doubt about whether a customization is really necessary, ask yourself this: will it change the music that is played from the score? If you really must customize some setting, then keep in mind these two points: 1. Tinkering with LilyPond can become as complex as you want. 2. Ultimately all tinkering takes the form of commands. Searching the internet for LilyPond tips and tricks can be a life-saver, but it can also lead to needlessly complex solutions. Sometimes this is the result of poor solutions being posted on the internet, but more often it is the result of the ongoing development of LilyPond, which makes better solutions available regularly. For this reason, it is recommended to search the official LilyPond documentation first, then the "LilyPond Snippet Repository" (LSR - link here), and then Google.
12.5.6.2. Contexts
Another aspect of LilyPond that often confuses beginners is the idea of contexts. It is an essential concept for modifying default behaviour. Like everything in LilyPond, it makes perfect sense: "context" means "context." The three primary contexts are "Voice," "Staff," and "Score." Everything that happens in a score happens in a context - it's just that simple everything happens in a context! Everything that happens in a score happens in Score context, everything that happens on a staff happens in a Staff context, and everything that happens in a voice happens in a Voice context.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 135/157
27.2.13.
Musicians' Guide
To help clear things up a little, here are three examples: 1. Where does the title of a composition belong? Does it belong on the score? Yes, so it belongs in the Score context. Does it belong on a staff? No, so it doesn't belong in a Staff context. Does it belong in a voice? No, since it would have to be on a staff to be in a voice. The composition's title doesn't belong on a staff or in a voice, but it does belong on the score, so we say that it happens in the Score context. 2. Where does a clef belong? Does it belong on the score? Yes, because it is a part of notation. Does it belong on a staff? Yes, because it wouldn't make sense to have a clef off a staff. Does it belong in a voice? No, because it's not related to a specific "line" or voice. Clefs usually belong on the staff, at the beginning of every line, so we say that they happen in a Staff context. 3. Where does a note-head belong? Does it belong on the score? Yes, because it is a part of notation. Does it belong on a staff? Yes - even if it's on a ledger line, note-heads are meaningless unless they're on a staff. Does it belong in a voice? Yes, because one particular musical line is indicated primarily with note-heads. Note-heads belong to a particular voice, so we say they happen in a Voice context. To help further clarify, consider the following: As in the real world, objects in LilyPond can potentially happen in any context... (like a doorknob on a door) (like a bus driver sitting in a bus' drivers' seat) (like a person buying groceries at a supermarket) (like a flat-sign next to a note-head) ... some contexts are unusual, but make sense... (like a doorknob on a wall, if the wall is designed to look like a door) (like a bus driver sitting in a passenger seat, if they are going to the garage) (like a person buying groceries from a corner store, if the supermarkets are closed) (like a flat sign in a paragraph of text, if that paragraph describes what flat signs do) ... and some contexts do not make sense, but can still happen... (like a doorknob on a television) (like a bus driver serving patrons at a restaurant) (like a person buying groceries at a governmental office) (like a flat sign in the top corner of a score, where the page number should be) The LilyPond designers wisely decided that they could not think of all possible uses for their software, so LilyPond allows most engravers to be used in most contexts. Furthermore, a context can happen within an other context, which makes sense - a V i econtext only makes sense if it appears on a S a f and a S a fonly makes sense if it appears in a oc tf, tf Soe cr. So, when trying to sort out the context in which something should apply, ask yourself exactly that: "In what context does this apply?" Beams and flags happen in one voice, accidentals apply to a whole staff, and tempo markings apply to the whole score. Although it may take some careful thought to get used to the idea, contexts ultimately make perfect sense.
27.2.13.
Musicians' Guide
when using automated score-setup tools like Frescobaldi. The generic structure of a LilyPond source file is this:
\eso vrinnme vrin eso_ubr \edr{tig lk tte cmoe,ads o } hae hns ie il, opsr n o n \cr soe { \e Saf nw tf { ntsg hr oe o ee } \aot lyu { } ads o n o n }
Confusion arises here: for maximum flexibility, LilyPond allows source files to create its own commands. On hearing this, you may think, "Okay that's it - I don't need advanced commands or any of this stuff, so I'm packing it in and just using Finale!" There's no need to do that just yet - commands are easy! Think of commands - whether you wrote them or they were included with LilyPond - as a means of text-substition. It works like this: 1. You "define" (create) a command with the form c m a d a e = { l t o c m a d } omnNm os f omns 2. You can then use the command anywhere below that, as many times as you want, by writing \ o m n N m in cmadae your source file. When LilyPond processes that portion of text, it will instead see whatever you wrote in the definition. It's as easy as 1-2! Frescobaldi (along with most LilyPond users) take advantage of this functionality to provide well-organized, easy-to-use source files. Here is a good template source file, that might be created for you by Frescobaldi:
\eso ".22 vrin 21." \edr hae { tte="mt Eape il Epy xml" } voi =\eaiec' iln rltv ' { \e c\ao ky mjr \ie44 tm / %Mscfloshr. ui olw ee Ptyu mschr u or ui ee } \cr soe { \e Saf\ih nw tf wt { isrmnNm ="iln ntuetae Voi" } \iln voi \aot{} lyu }
This example uses many built-in commands (like \ e a i eand \ e ), and it defines the v o i command. rltv ky iln Frescobaldi places a % M s c f l o s h r .comment where you should input your notes. Notice that your notes ui olw ee belong in the v o i section. This means that you write part of the v o i command. iln iln Frescobaldi separates the violin's notes from the \ c r section so that the source file is easier to read. You can fix soe errors more easily in well-organized source files. If you complete the following tutorials, you will learn three strategies to organize sources files. The \ a o tsection is empty in this example. Like the \ c r section, \ a o tis a command. The \ a o t lyu soe lyu lyu command tells LilyPond to output a musical score. Advanced users sometimes remove the \ a o tcommand, but lyu most source files use it.
27.2.13.
Musicians' Guide
There are four quarter notes between each bar-check symbol, which is the right number of beats in the indicated metre. This example is incorrect, so LilyPond will print a warning.
\ie44 tm / c c c | 4 2 4 c c c| 4 2 c c c | 4 2 4
This example shows three measures of the same pattern: c c c . The second measure is missing the last quarter4 2 4 note symbol (a 4 so LilyPond outputs one quarter note followed by two half notes. The second measure is five beats, so ), the bar-check symbol does not coincide with the measure line after the fourth beat. LilyPond prints a warning when it reaches the bar-check symbol at the end of the second measure. Consider this example.
\ie44 tm / c ccc| 2 c ccc| 4
The first bar has four half-notes, which is twice as many beats as are allowed in one measure. A bar-check symbol only triggers a warning if it is placed where there is no bar line. Therefore, LilyPond will not print a warning for this example, even though only two of the three bar lines has a bar-line check symbol. One mistake in a file will sometimes cause LilyPond to print multiple warnings. A bar-check symbol does not force LilyPond to insert a bar line. LilyPond continues to insert notes with the duration shown in the file. Look at the following example, and the LilyPond output.
\ie44 tm / c c c | 4 2 4 c c c| 4 2 c c c | 4 2 4 Itrrtn msc. nepeig ui.. eapel::0 wrig brhc fie a:14 xml.y31: ann: acek ald t / c c c 4 2 |
The mistake in the second measure causes a warning at the bar-check symbol. LilyPond does not modify note durations, so the half note at the end of the second measure occupies the fourth beat of the second measure and the first beat of the third measure. The third measure is correct, with four beats, but the bar-check symbol causes a warning to be printed because LilyPond expects a bar line before the last quarter note, not after it. You can avoid confusion if you fix the first warning, then reprocess the file before you fix other warnings. One mistake may cause many warnings.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
138/157
27.2.13.
Musicians' Guide
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
139/157
27.2.13.
Musicians' Guide
Normally, figured bass parts are below the staves. This example is using the figured-bass feature of LilyPond to do something else, so we're going to move the figured bass so that it's where it needs to be. 1. the \score{ } section contains everything in the score; notice that the figured bass has the identifier \bassFiguresPart; remove this 2. scroll up to where it says "bassFiguresPart = ... " and comment it with % 3. scroll up to where it says "pianoPart = ... " and enter the "\new FiguredBass \figBass" line that you just commented out, on a line between the "right" and "left" staves 4. now erase the part that you commented in (2) (or leave it there) 5. Preview the file, and see that the figures now appear between the piano staves
27.2.13.
Musicians' Guide
Dedication: Comte d'Ogny and Prince Oettingen-Wallerstein Title: Sinfonia No. 92 Subtitle: "Oxford" Composer: Haydn, Joseph all the rest are blank 3. "Parts" Tab: Flute, 2 of Oboe, Bassoon Horn in F, Trumpet in C Timpani Violin, Violin, Viola, Cello, Contrabass 4. "Score settings" Tab: Key signature: G Major Time signature: 3/4 Tempo indication: Adagio other settings as desired; I recommend not remocing bar numbers, and removing the default tagline 5. Click "Try" to see if it works. The instrument names will not be the same as the PDF score. This will be fixed later. 6. Click "OK" to generate the score.
27.2.13.
Musicians' Guide
Violin I --> Violino I Violin II --> Violino II Cello --> Violoncello obligato Contrabass --> Basso 3. Now we have to change the horns' transposition to match the name. This is because Frescobaldi added a "Horn in F" part, which is the most common horn transposition. However, Haydn's score uses horns in G (or "Sol" in Italian). 4. Scroll up to the "hornF" section under the NOTES marker. Change the line \ r n p s t o fto tasoiin \rnpsto g tasoiin . 5. As it turns out, transposition can be a little more complicated than that. We'll deal with that when we get there.
27.2.13.
Musicians' Guide
3. Now to add the "forte" marking. You can add text (or any object, for that matter) onto a note (or rest, etc.) with one of these three symbols: ^ meaning "put this above the object" - meaning "put this above or below, as you think is best" _ meaning "put this below the object" As you saw earlier, Frescobaldi attached our staccato markings with the "as you think best" symbol, which is almost always the right choice for articulations. By convention, dynamic markings always go below the staff to which they apply, so we won't want to give LilyPond so much freedom, this time. 4. The easiest way to add (unformatted) text to a note is to simply attach it in quotation marks. For the "forte" marking, put this on the eighth-rest: r _ f a d s o 8"" n o n 5. When you preview this, you'll notice that the result is thoroughly underwhelming. It looks quite unlike a "forte" marking, and people reading the score would probably be confused, if just momentarily. 6. Thankfully, LilyPond provides a very easy and elegant way to input well-formatted dynamic markings. Change the eighth-rest to this: r \ a d s o 8f n o n 7. When you preview this, you will see that it now looks exactly like a typical "forte" marking. Not all dynamic markings have these short-forms, but most do. 8. The "a 2" marking, meaning "to be played by two players," does need the text-in-quotes format, however. Put that marking ab ove the d following the eighth rest. 9. Those two measures should now look like this: r8\f d-.^"a 2" g-. bes-. d-. bes-. | g8( cis) cis4 r | Note that d . " 2 gives the same result as d " 2 -^a " ^a ".
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
143/157
27.2.13.
Musicians' Guide
of something into the number of beat usually occupied by four of them. This is especially useful with cadenzas, and cadenza-like passages. Short-term Polyphonic Input (Divisi): Anything between < and > is interpreted by LilyPond as happening together. If you take a look at the "score" < > section at the bottom of the file, you will see that all of the parts are listed in that kind of bracket. This ensures that they all happen simultaneously. For short-term polyphonic input, use the formula < { u p r v i e n t s } \ { l w r v i e n t s < pe-oc oe \ oe-oc oe } > . Remember that the "upper voice" has upward-pointing stems, and the "lower voice" has downward> pointing stems. Ties: These can be written by adding ~ to the end of the note beginning the tie: c ~ c 4 8 Grace Notes: These take up no logical time, and are smaller than ordinary notes. Any notes appearing \ r c { gae i h r }would be considered grace notes. n ee Crescendo and Diminuendo Markings: These are added like other dynamic markings, attached with a backslash to the note where they begin. A crescendo is triggered with \ and a diminuendo with \ . < > The left-most point of the marking (its beginning) is indicated by where you put \ or \ < > The right-most (or end-)point is indicated by either another dynamic marking of any sort, or the special cancellation character \ ! Italic "staccato" Text: \ a k p { \ t l c { s a c t } } mru iai tcao Source File Measure Numbers: One of the techniques that can be used when inputting larger scores is writing measure numbers into the source file as comments. I usually write measure numbers every five measures, but it depends on the speed of the music, and what seems like it's useful.
27.2.13.
Musicians' Guide
This is simply a matter of personal taste, resulting from prior experience with C and C-like programming languages. Familiarize myself with the sections and commands created by Frescobaldi, getting a sense of what the section/command does (even if I don't understand what each specific command does). This makes it easier to sort out problems and customization down the road. Sometimes, when the setup is quite complex, I make comments about what seems to be going on. At this point, I also added the "Dynamics Context" commands, as described below in the "Piano Dynamics" section
27.2.13.
Musicians' Guide
Piano scores present some unique challenges with LilyPond, but they're easy to overcome with some careful thought. This tutorial will avoid step-by-step instructions on how to input particular notes, instead focussing on those unique piano challenges presented in this particular composition. The LilyPond "Notation Reference" provides a section dedicated to keyboard and piano music. Most of the situations described there are not present or discussed in this score, which gives this tutorial unique material.
12.8.4.2. Chords
There are two ways to input chords, but one will be used much more often. This style of chord notation is more common: < s c s 4 _Notice how only the pitches are notated inside the < > a e>brackets, and everything else attached to the end. There is one exception to this: fingering should be indicated on the pitch associated with that finger: < s 1 c s 3 4 _Not only does this help you to sort out what was probably intended, a- e->but it allows LilyPond to stack the fingering in the right order. When using "relative" entry mode, it is the lowest note of the chord that is taken into consideration when placing the next note. This style of chord notation is less common: < a 4 > c s >Notice how everything must be notated inside the < > <s- e> < > brackets. This can make it more difficult to read the chord in the source file, but it also allows much greater flexibility: only some chord members can have ties; certain chord members can last for longer than others; certain chord members can "break out" into or out of polyphonic passages. This notation is rarely needed, but you may be inclined to over-use it if you are trying to exactly copy the look of a hand-engraved score. Like the "times" command for tuplets, this is one of LilyPond's deceptively powerful techniques. When using "relative" entry mode, it is the last note of the chord that is taken into consideration when placing the next note.
12.8.4.3. Fingering
LilyPond allows you to indicate fingering by attaching the digit number to a note as an articulation mark: a 6 5will show 1a "5" as a fingering mark. As with all other articulation marks indicated in this way, you can use ^or _to instruct LilyPond to put the mark above or below the note, respectively. It is usually better to let LilyPond decide for itself by using a . When entering chords, it is recommended that you enter the fingering with the note to which it is attached, like < s 1 ac s 4 4 _ It is possible to enter this as < s c s 4 1 4 > but this not only looks confusing, it may confuse LilyPond e->-. a e>---, as to which digit is intended for which note. Because the extra digits look like they indicate note-lengths, it is recommended to mark them consistently. For this same reason, it is also recommended that fingering marks be added to source files only after the pitch and rhythm have been double-checked. The source file included with this tutorial puts fingering marks after any other articulation and length marking.
27.2.13.
Musicians' Guide
LilyPond Notation: These are notated in LilyPond with an exclamation mark placed before the note-value: c s 1 e!6
27.2.13.
Musicians' Guide
Follow these steps to create a "PianoDynamics" Context: 1. Between the left and right staves of the PianoStaff, add "\ e P a o y a i s = " y a i s \ y a i s For nw inDnmc d n m c " d n m c ". the Schubert score, this looks like:
\e Paotf \ih nw inSaf wt { isrmnNm ="in" ntuetae Pao } < < \e Saf="ih"\ih nw tf rgt rgt \e Paoyais="yais \yais nw inDnmc dnmc" dnmc \e Saf="et {\lfbs \et} nw tf lf" ce as lf > >
This creates a "PianoDynamics" context, and modifies the "PianoStaff" context so that it will accept a "PianoDynamics" context. 3. Before the "\score" section, add a section called "dynamics," like this:
dnmc = yais { %Dnmc g hr. yais o ee }
27.2.13.
Musicians' Guide
13.2.1. When You Run Solfege for the First Time 13.2.2. Instruments 13.2.3. External Programs 13.2.4. Interface 13.2.5. Practise 13.2.6. Sound Setup 13.3. Training Yourself 13.3.1. Aural Skills and Musical Sensibility 13.3.2. Exercise Types 13.3.3. Making an Aural Skills Program 13.3.4. Supplementary References 13.4. Using the Exercises 13.4.1. Listening 13.4.2. Singing 13.4.3. Configure Yourself 13.4.4. Rhythm 13.4.5. Dictation 13.4.6. Harmonic Progressions 13.4.7. Intonation
13.2. Configuration
It is not necessary to configure Solfege. The simple first-time configuration will help to customize the application for your needs, but it is not required. The other configuration options are explained for your reference. These configuration options are not required, but you may wish to change them. They are all available from the "Preferences" window, accesible through Solfege's main menu: 'File > Preferences'.
27.2.13.
Musicians' Guide
3. Select the "User" tab. 4. Input your vocal range, if you know it. Solfege uses this information to assign questions in a comfortable pitch range. 5. Input your biological gender in the "Sex" field. Solfege uses this information to assign questions in the correct octave.
13.2.2. Instruments
Tempo: Changes the speed at which examples are played. Default: Applies to everything that isn't an "Arpeggio." Arpeggio: Applies to arpeggios, which are, by default, played at three times the speed of the default tempo. This is standard practice. Preferred Instrument: This MIDI instrument will be used when playing examples. Chord Instruments: For polyphonic voices, these MIDI instruments will be used for the highest, middle, and lowest voices above the bass voice (which takes the "preferred instrument.") Percussion instruments: Count in: This MIDI instrument will be used to give "count in" beats that precede musical examples involving rhythm. Rhythm: This MIDI instrument will be used to dictate rhythm-only examples.
13.2.4. Interface
Resizeable main window: This allows users to resize the main Solfege window. Select language Identify tone keyboard accelerators: In exercises requiring the input of particular pitches, this will allow a conventional keyboard to be used as a MIDI keyboard - letters on the keyboard will be associated with particular pitches.
13.2.5. Practise
These options apply to exercises done in "Practise" mode. "Not allow new question before the old is solved": Solfege will not provide a new question until you have solved the current question. "Repeat question if the answer was wrong": Solfege will repeat a question if you provide an incorrect answer. "Expert mode": Solfege will provide advanced configuration options for individual exercises.
27.2.13.
Musicians' Guide
"No sound": This mode is used for testing and debugging Solfege. "Use device": This mode lets you specify which audio interface Solfege will use. "User external MIDI player": This mode lets you choose a MIDI synthesizer. The button, "Test": allows you to ensure that you've correctly configured Solfege.
27.2.13.
Musicians' Guide
Beats per Minute, which tests your ability to determine a tempo. Harmonic Progressions, which tests your ability to perceive and apply Roman numeral chord symbols for a series of chords played together. Hear Tones, which helps you to train for relative pitch. Cadences, which tests your ability to perceive and apply Roman numeral chord symbols for two chords played together. All of these exercises require the use of your aural skills outside an actual musical situation. This may seem fruitless, but it has long been recognized as an important part of the eventual ability to hear them within a musical context. Neither ability will suddenly appear; it will take dedicated practice.
27.2.13.
Musicians' Guide
especially to develop coordination when performing multiple independent musical lines. We recommend that you ignore Hindemith's instructions, and use tonic solfa syllables. For more information on tonic solfa, refer to Tonic sol-fa at http://en.wikipedia.org/wiki/Tonic_sol-fa Hoffman's The Rhythm Book was developed specifically for the takadimi rhythm system. Like Hall's text, The Rhythm Book progresses fro easy to difficult exercises, and offers helpful instructions for performance. Karpinski's two texts are the result of two decades of research about how musicians acquire aural skills. The Manual contains instructions, exercises, and tips on training yourself to hear musical elements and real music, and how to perform and imagine music. The Anthology is organized in chapters that coincide with the topics discussed in the Manual, and contains very few instructions. The Anthology contains a wide variety of musical excerpts, some from the public domain and others under copyright, taken from the "classical music" canon and from national repertoires. There are some three-part and four-part exercises, which should be performed by a group of people leraning aural skills together. When you practise sight-singing from any book, we recommend hearing the tonic pitch from a fixed-pitch instrument (like a piano or keyboard synthesizer) before you sing an excerpt. With the tonic pitch in your mind, and without singing aloud, find the starting note of the excerpt, and sing the excerpt in your mind several times, until you are sure that you are singing the excerpt correctly. When you have the melody in your mind, sing the excerpt out loud, as many times as you need to be sure that you are singing it correctly. Only after you sing the excerpt perfectly should you play it on a fixed-pitch instrument to confirm that you are correct. You should build your ear with as little help from external sources (pianos, and so on) as possible. A significant amount of research shows that this gives you a more flexible musical mind, and that, while the initial learning curve is very steep, you will ultimately be able to learn new concepts faster.
13.4.2. Singing
These are: "Sing intervals" 1. Select "Sing intervals" 2. Choose which ones you want to focus on 3. The exercise will begin, playing the first of the tones you are to sing 4. You must sing the first and the second tone, or to make it harder, only the second tone (tip: use sol-fa syllables!)
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 153/157
27.2.13.
Musicians' Guide
5. Solfege does not know whether you sang the interval correctly, so you must tell it. "Tap generated rhythm" 1. Select "Tap generated rhythm" 2. Choose a subcategory (they correspond to those in the dictation, but there is no compound metre available). See below. 3. Click "New" 4. It will play you a rhythm; listen carefully, and conduct the beat if you can. 5. as with rhythmic dictation, you will be given an intro 6. You must repeat the rhythm by click on the "Tap here" button 7. Best to use the space bar to tap in; here's how. 8. The "accuracy" may be set too high; I like 0.30 9. On "Config," change "Number of beats in question" to adjust the difficulty "Sing chord" 1. Select "Sing chord" 2. Choose the type of chords you want to sing 3. Click "New" 4. Solfege will automatically play an "A" for you, and you can hear it again by clicking, "440hz" 5. Sing the chord ascending 6. Verify that you sang correctly by clicking "Play answer" and hearing whether the pitches are the same. 7. Click "New" for another question 8. On the "Config" tab, it allows you to change how far it will transpose the built-in models; best to leave this as it is [ky,-,5 'e' 5 ] 9. Solfege does not know whether you sang the interval correctly, so you must tell it. "Sing chord tone" 1. Select "Sing chord tone" 2. Select which chordal member you want to practise singing 3. Click "New" 4. Solfege will display and play a chord in blocked form, and you must sing the chord member that it tells you to sing. 5. You can repeat the chord in blocked form ("Repeat") or in arpeggio form ("Repeat arpeggio"). It is much easier to hear a chord played in arpeggio form, so we recommend that you practice both ways. 6. When you are sure that you correctly sang the chord member, click "Play answer" 7. For the next question, click "New"
13.4.4. Rhythm
This is dictation or play-back. The rhythms described in this section use the "takadimi" rhythm system, which is explained in The Takadimi Article, available at http://www.takadimi.net/takadimiArticle.html. Use the rhythm system you prefer. For Rhythmic Dictation: 1. Click "Rhythm" 2. Choose which subcategory: Rhythms (easy) is: quarter, 2x eighths, 4x sixteenths Rhythms is: those plus ka-di-mi, ta-ka-mi, ta-ka-di, ta-mi, and ta-ka Rhythms (difficult) is: those plus rests and triplets
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html 154/157
27.2.13.
Musicians' Guide
Rhythms in 3/4 is: compound metre everything 3. Click "New" to get a new question 4. Click the buttons above the "Play" button to input the rhythm-units, in order from start to finish 5. Use paper to work it out 6. If you make a mistake inputting, use the "Backspace" button 7. You can "Repeat" to hear it again - not too many times! 8. You can change the difficulty by increasing the number of beats per question, on "Config" tab 9. If you get a question wrong, you will have a chance to correct it; the incorrect parts are underlined for you in red For Rhythmic Tap-Back, see above section "Singing Exercises."
13.4.5. Dictation
These dictation exercises are for melodic dictation. There is not a great variety of examples here, and they are either easy or difficult, with no middle-ground. 1. Click "Dictation" 2. Choose a level: Volkslieder 1: German folk songs (easy) Volkslieder 2: German folk songs (easy) Parts of 2 Bach inventions: only 2; the hardest of the four categories Norwegian children songs: only 3 (easy) 3. The clef, key and time signatures are given for you, along with the starting note, and title. 4. The quarter-note buttons allow you to play only part of the melody. 5. "Play the whole music" plays both parts of the music. 6. "Back" and "Forward" shifts through the excerpts for dictation. 7. It's best to "Play the whole music" as many times as needed (5 - 7 or less maximum, depending on the excerpt). 8. It's best to avoid playing only part of the music. 9. Write down the excerpt on paper, then when you're sure that you've finished it correctly, click "Show." 10. This exercise is self-policing, and does not track progress.
13.4.7. Intonation
In order to use the Intonation exercises, you must install the "Csound" application. See Section 13.1.4, Optional Installation: Csound for instructions to install Csound. 1. Click on "Intonation" 2. All of the exercises test an ascending perfect fifth. The closer the number is to 1.0, the less the difference when it is out-of-tune. 3. Click "New" to get a new question. 4. The interval will automatically play. 5. Click "Repeat" to repeat the interval.
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
155/157
27.2.13.
Musicians' Guide
6. You must choose whether the second tone is flat (the interval is too small), in tune (the interval is the right size), or sharp (the interval is too large). 7. When you are sure of your answer, click the corresponding button. 8. To get the next question, click "New."
Contributors
The following people have contributed to the Fedora 18 Musicians' Guide, or a previous version. Christopher Antila (writer) Motohiro Kanda (translatorJapanese) Ruedigger Landmann (mentor)
Revision History
Revision 0.0 27 July 2010 Initial creation of book by publican Revision 0.1 2 August 2010 First publically-available draft in DocBook format. Revision 0.2 3 August 2010 Revised section headings. Improved and consistent-ified "Requirements and Installation" for DAWs Revision 0.3 4 August 2010 Significantly revised Audacity chapter. Updated JACK installation slightly. Revision 0.4 5 August 2010 Added all external and internal links. Added all images. Revision 0.5 6 August 2010 Re-formatted ex-<pre> tags. Changed images to <inlinemediaobject>, where appropriate. Revision 0.6 7 August 2010 Added tables to SuperCollider chapter. Reviewed <code> tags, all but Basic Programming in SC. Christopher Antila Christopher Antila
Christopher Antila
Christopher Antila
Christopher Antila
Christopher Antila
Christopher Antila
Revision 0.7 8 August 2010 Christopher Antila Reviewed use of <code> tags in "Basic Programming in SC" chapter. Searched code for '' or ''' and replaced them with <emphasis> where appropriate. Formatted bibliography/book-list in the Solfege chapter. Revision 0.8 27 August 2010 Christopher Antila Re-wrote the JACK installation instructions, to incorporate the fact that jack2 will be in F14 Made other minor revisions to the sound servers section. Revision 0.9 6 September 2010 Christopher Antila Added links to tutorial files. Incorporated some comments from external sources. Changed numbering of Revision History. Added list of links that need to be updated with every release, to Musicians_Guide.xml Updated Audacity to make it publish-able. Replaced instances of "Fedora 14" with "Fedora $PRODVER;" Revision 14.9 23 December 2010 Christopher Antila Changed version numbering to correspond more closely to the intended Fedora release version. Removed "asdf" part introductions. Updated entity (.ent) file for Fedora 15. Updated hard-coded links to supplemental files for Fedora 15. Changed subtitle to remove possessive ("Fedora Linux's").
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
156/157
27.2.13.
Musicians' Guide
Revision 14.9.1 26 December 2010 Christopher Antila Fixed Bug 665663 ("URLs to all Tutorial Files Are Broken") for Fedora 15. Re-wrote Section 12.4.7.1 to fix the first error in Bug 654187. Renamed some section in Chapter 12, making them easier to translate (I hope). Revision 14.9.2 2 January 2011 Reformatted dates in Revision History. Re-wrote Section 12.4.8.2 to fix the second error in Bug 654187. Revision 14.9.3 Added fix for Bug 670520. 28 January 2011 Christopher Antila
Christopher Antila
Revision 14.9.4 27 February 2011 Added fixes for Bugs 677362 and 674335. Revision 14.9.5 Added fix for Bug 665660. Revision 15-1.0 Published for Fedora 15. Revision 15-1.0.1 Fixed Bug 710332. 2 May 2011
Christopher Antila
Christopher Antila
21 May 2011
Christopher Antila
3 June 2011
Christopher Antila
Revision 15.9.1 15 June 2011 Fixed Bug 670540. Revised parts of Chapters 9 (Rosegarden) and 10 (FluidSynth). Removed period from end of subtitle. Revision 15.9.2 26 June 2011 Fixed Bug 670533. Revised parts of Chapter 9 (Rosegarden configuration). Revised parts of Chapter 8 (Qtractor configuration). Fixed Bug 673519.
Christopher Antila
Christopher Antila
Revision 15.9.3 3 July 2011 Christopher Antila Added "O_S" and "OPERATING_SYSTEM" entities to aid potential adoption by other distributions. Started replacing "Fedora" and "Fedora Linux" with entities listed above. Added documentation of the Ardour "nudge tool." Integrated useful parts of "Frescobaldi" chapter into "LilyPond" chapter and removed "Frescobaldi." Revision 15.9.4 9 July 2011 Christopher Antila Added links to Qtractor tutorial recordings and revised opening paragraphs of tutorial. Updated copyright holder from "Red Hat Inc. and others" to "Fedora Project Contributors." Added "Contributors" appendix. Removed index; will replace it when it's useful. Removed my name from the Author_Group.xml, moved it into Contributors appendx. Removed "pulse-rt" from the groups required for JACK access. Updated all files, as appropriate, to replace "Fedora" and "Fedora Linux" with XML entities, to aid adoption by other groups. Revision 15.9.5 14 September 2011 Added R. Landmann to list of contributors. Updated "ooolilypond" to refer to LibreOffice. Hope it's okay. Started to proofread LilyPond introductory material. Branched for Fedora 16. Christopher Antila
Revision 16.9 30 December 2011 Christopher Antila Fixed Bug 751456 ("Update Binary Unit Notation for Docs Project Consistency") Fixed Bug 769137 ("F16 Planet CCRMA Documentation links to F13 Repo") Changed all "KPackageKit" references to "Apper." Revision 16.9.1 23 May 2012 Fixed Bug 710330 ("Section 11.5.1 Broken Link to Local Help File") Published draft version. Revision 17.9 18 December 2012 Branched for publication with Fedora 18 Christopher Antila
Christopher Antila
docs.fedoraproject.org/en-US/Fedora/18/html-single/Musicians_Guide/index.html
157/157