Happy Birthday eCards Celebrate a birthday by sending a free happy birthday eCard. Open Me has a huge selection of birthday eCards designed by Threadless and other top designers - cupcakes, cakes, squirrels and whales - many fun designs to choose from. The analog-to-digital (ADC) and digital-to-analog (DAC) converters in your computer or sound card usually handle the details of converting from a continuous signal to a discrete signal and back again. Most ADC’s have filters on them to remove any frequency content higher than one-half the sample rate. This site’s homepage has very clear headlines and a simple, but effective design. The right info stands out, making it easy for the visitor to understand what this site is all about. Recollection Recollection is a website with a bold background sound that gives this page personality, making it look and sound bold and creative!

Yes…we know you’ll say sounds or music are annoying when you open a new website in your browser. We agree. But in some cases, adding sounds or music to a website will make it special and increase its value!

That is why we selected 22 websites that use background music or sounds masterful! These websites were created for music or artistic niches, and sounds fit in gracefully in the designs.

These music-themed website designs will inspire you – whether it’s the typography, color palette, graphic elements arrangement or layout interpretation, you will notice something special at each and every one of these creative websites.

What do you think? Have you ever used sounds in a website design? Let us know in the comment section below!

Relax, we are the good guys

Relax, they’re the good guys and they have a pretty awesome website. It has a black and white animated design layout and it also uses a background sound! This site’s homepage has very clear headlines and a simple, but effective design. The right info stands out, making it easy for the visitor to understand what this site is all about.

Recollection

Recollection is a website with a bold background sound that gives this page personality, making it look and sound bold and creative!

Amy

This website presents the journey of Amy Winehouse and her beautiful music. If you’re a fan, go ahead and analyze this website, listen to her music and get inspired. The homepage looks gorgeous. It catches your attention with the full-screen video and it is also very intuitive and user-friendly.

More Hazards

More Hazards is a Nashville folk duo and this website focuses on presenting their music in a creative way. The website has a creative and colorful design with a homepage that impresses through high-resolution illustrations and intriguing background music.

John Iacoviello

John Iacoviello is a software developer and this website definitely suits him. My Static Self is his personal portfolio website that also uses background sounds. This homepage design amazes through its simplicity and a great selection of music.

Fornasetti

With a little creativity and compelling illustrations, you can surely change a website’s image and increase the impact it makes on your visitors! This is a great example! Fournasetti has a delirious animated background and uses some really nice background music. The pattern changes as you click on it.

Melas

Melas’s website has an interactive abstract background that makes the triangle shapes move as you hover on them. When they move they also make a sound. This website has a simple, but content-rich homepage as well, due to its awesome scrolling function. This makes it easy for the user to read through the content, without clicking on too many links.

Calvin Harris

Calvin Harris’ newest album is out and you can have a sneak peek on his website. Enter it and listen to his music.

Pivovarov

Pivovarov is a musician and he has some really nice music which you can listen on this website. His website can definitely inspire you and so can his music.

The Vending Machine

On this website, you can see and buy Chris Taylor’s creative projects. The website looks modern and elegant. It uses a simple dark background and large thumbnail photos for each project.

Hashima Island: A Forgotten World

The Hashima Island is a Google project that presents the forgotten world of an abandoned island which is situated at about 15 miles from Nagasaki. This island is a symbol of Japan’s rapid industrialization. The website introduces you into this world through black and white Google navigation and subtle scary sounds.

Wayne McGregor, Random Dance

Sound

Wayne McGregor is an award-winning choreographer and this website presents his work and his teams’ through sounds, images and text.

Janis

Janis is a fashion website that uses calm music, such as the ones you hear at the mall, in clothing stores. This website uses a simple full-screen background image and a minimalist menu bar at the bottom of the page.

The Build Film

The Build Film also uses sounds on their website. This is an interactive film project exploring the world of custom motorcycle making through the stories of 3 different motorcycle builders.

Studio Venezia

Besides the cool preloader which will definitely grab your attention, this website uses a series of animations and background sounds which will definitely inspire you. This is a sound experiment which was created for the Venice Biennale. It was created by Xavier Veilham and it represents the French Pavilion.

Studiogusto

Studiogusto is a creative agency that puts culture and creativity first. This agency has a really nice animated website that uses computer background sounds and short films.

Brightly Preflight Nerves

This is Charlie Gleason’s website. He is both a musician and a programmer and he has an awesome website which will definitely inspire you in your next project. It presents his music and programming skills in a creative way. The website uses full-screen videos on which lyrics come up as he sings.

The Instant Love

Bold texts, simple typography, colored backgrounds and unique images, this is what makes a great homepage design. Instant Love celebrates songs through a colorful website. You can listen to many songs on this website and get inspired. You can scroll through artists and genres until you find that song you were searching for.

Conoce Valencia de Una Forma Diferente

This website user a modular grid layout in a creative way. It divides the page into 4 equal parts and each part has an image of a different singer. Hover your mouse over the images and you’ll notice they are in fact videos of people singing.

Dubfire

This website was specially created for a band called Dubfire. It combines futuristic/abstract illustrations with subtle animation effects and does it successfully! The website uses a simple black background and overlays geometric vector elements in its design layout. Each cube contains information about the band and as you hover your mouse over different cubes you’ll find out more about the band. Cubes turn fully-red when hovered over and they make a sound.

Sound Creatures, by Is-Real

This website has a simple, light-toned color palette and a unique illustration on the homepage. It contains a portfolio of hand-drawn creatures, with each creature having its own particular sound!

You may also like:

Eastman Csound Tutorial

Chapter 1: Basics

1. Introduction

This tutorial provides an introduction to Csound. The reader also should have in his/her possession a Csound ReferenceManual, and should consult the pertinent sections [indicatedwithin square brackets]of this manual while readingthe tutorial material covered here.

This tutorial covers only a small fraction of the audio signal generatingand processing resources that are available within Csound.However, the resources we will discuss are among the most fundamentalelements of computer music generation. Additionally, they are quite powerfuland extensible (you can get a lot of mileage out of these things), andalso will be used to illustrate the logic and syntactical conventionsof Csound. An understanding of these conventionswill enable you to begin constructing your own instrumentalgorithms, and to figure out how to use the myriad of resources inCsound that are not covered here.

Distributions of Csound periodically are updated by a volunteerteam of Csound users currently led by John ffitch,and we install new versions at Eastman as they become available. Newversions often contain a few bugs. ECMC users should check the helpfile csound for a list of known bugs in our current version of Csound, andadvise one of our staff members if you stumble across any new ones.

Computer systems make music by computing samples (numbers that represent the amplitude of a sound at evenly spaced timeintervals). In MIDI systems, MIDI controllers and/or a general purpose microcomputersend out control signals to special-purpose hardware circuits (oscillators,envelope generators, and the like), each optimized to perform one task asefficiently as possible. These sound generating and processing hardwarecircuits may exist in an external box -- a synthesizer or sampler (it'shard to tell the two apart these days) or 'effects box,'such as the K2000, Wavestation SR or PCM70 in the ECMCMIDI studio) -- or else in a sound card attached to the computer buss.

In software (or 'direct') synthesis systems, bycontrast, a computer CPU itself, running a program loadedinto RAM, computes and processes the sound samples. If the computer is fastenough, and the signal generating algorithm is simple enough, and the scoreis not too complex, this can be done in real time, and the samples can bepassed directly to digital-to-analog converters for immediate audition.However, software synthesis is inherently slower than hardware synthesis,and often the time required to compute the samples exceeds the durationof the sounds. Most often, therefore, the samples are first computed andwritten to a disk file, which can be played at the completion of the compilejob.

Some hybrid sound synthesis systems, such as Turbosynth (anentry-level synthesis system marketed by Digidesign for Macintosh computers) andKyma (a far more powerful system marketed by Symbolic SoundCorporation for Windows and Mac platforms)attempt to combine the flexibility of software procedureswith the speed of hardware synthesis. The user interface allows greaterflexibility in connecting processing devices thanis generally available in fixed architecure hardware-based systems,and the system uses additionalDSP or sound card hardware to relieve the CPU of repetitive operations andto compute the samples. For some types of operations such systems work quitewell. However, they tend to offer less flexibility than fully software-basedsystems, and less speed than hardware systems, or else(as with the Kyma system) are quite expensive.

With fully software-based music programs, such as Csound, Princeton's CMIX,and several commercial programs at recently have been introduced forPCs and Macs(see the April 1998 issue of Electronic Musician,pp. 68 ff. for examples)the synthesis or sound processing architecture is not fixed. One is notlimited, for exam- ple, to a particular number of simultaneous polyphonic'voices,' or to only types of certain processing algorithms.Rather, users can constructand implement their own signal generating, processing and 'effects' algorithmsby 'patching together' various procedures from a library of available utilityprograms and sub-routines, called unit generators (oropcodes) in Csound, using only those procedures that are needed, and calling as many as willfit in computer memory at once. Thus, if we want a hundred oscillators orfilters for some application, and our computer has sufficient RAM,we can create them with a hundred calls toan oscillator or filter unit generator. The values we supply to these oscillatorsor filters can be arbitrarily complex, involving a mixture of many simultaneouscontrol signals created by other unit generators.

Currently, Csound is the most widely used software synthesis system. Compiledpublic domain versions are available for all of themajor computer operating system platforms -- various flavors of Unix (SGI, Linux,Sparc and generic Unix), several Windows ports,Macintosh (PowerPC and 68xxx) and even Atari -- and can be downloaded at nocost over the internet via a web browser or ftp fromhttp://mitpress.mit.edu/e-books/csound/frontpage.html(the Csound Front Page) and mirror sites.Csound thus provides us with an avenue to study and put tocreative use music synthesis and sound processingprocedures apart from the limitations of particular hardware andsoftware systems. Often,the knowledge gained from this process is directly applicable to other typesof computer music systems as well.

Sound Cards Creative

In this tutorial, then, our primary goalwill be not to transform you into Csound wizzards, but rather to use thetools of Csoundto examine various types of computer music resources and procedures.Those already familiar with various MIDI synthesistechniques will find many familiar concepts within this tutorial and within Csound. Many of the unit generators in Csound have hardware counterparts in synthesizers, samplers, mixing consoles,and outboard gear. However, the implementation of these procedures presentedhere will likely be new, and may at times seem more complicated.

1.1. Orchestra and Score Files

Csound requires that the user supply two input files - an orchestra file and ascore file - which, together, define a signal processing algorithm and all ofthe data needed for the compilation of output samples.

A Csoundorchestra file is a user-written computer program, written according to the syntacticalconventions of the Csound 'language,' that defines one or more instruments - audio signal processing algorithms. This program provides the Csoundcompiler with a step-by-step series of instructions, and some of the necessaryargument values, required for the computation of each output sample. Designingan instrument algorithm bears certain similarities to patch editing on a MIDI synth, except thatwe usually begin with a 'blank page' (or from an 'init' state), rather thanwith certain pre-defined operations determined by the hardware architectureof the synth.

Some instrument algorithms or modules (sub-routines withinan algorithm) generate audio signals from scratch, by sampling a synthetic waveform,such as a sinusoid, or else a digitized acoustic sound, such as a violin tone.Other instrument algorithms or modules process such signals. EastmanCsound Library instruments sf, rev and delays, which some ofyou may already have used, are examples ofCsound instrument algorithms that produce no sound themselves,but rather process audio signals from other sources, adding reverberation,echos, spectral modifications (EQ) or other types of sound modifications.

A score file provides values (such as pitch and duration) that vary from note tonote. These argument variables for each note are specified in the form of parameter fields (p1, p2, p3 and so on). Additionally, the score file provides anyrequired function definitions, from which Csound creates tables of numbersused to generate or process sounds.The numbers within a function table may represent an audio waveshape, such as a sinusoid ora sawtooth wave, or a digitized acoustic sound. Other types of tables are used to represent 'control' or 'performance' elements, such as the amplitudeenvelope, or the time varying vibrato shape or width, within a tone.In still other cases a function table merely providesus with a convenient way to input a complete series of numbers in a singleoperation. We will return to score parameter fields and function definitionsshortly.

Up to this point, ECMC users have been using the Eastman Csound Library instruments,for which score11 score templates have been provided. Throughout this tutorial, we will continueto use the score11 preprocessor to simplify the creation of our actual Csound score files.(Non-ECMC users can refer to the online Appendix,which includes Csound score file compilations for all of the score11examples in this tutorial.)These Csound score files (called sout, short for 'scoreoutput' file, by score11) look much like the MIDI controller event list files produced by MIDI sequencerssuch as Logic, Cubase, Performer, Cakewalk or Vision. When creating simple one or two note test score files for a new instrumentalgorithm, however, you might wish to bypass score11 and type in your Csound score file directly.

Csound also provides alternative ways to generate score files. With certainunit generators one can use standard type 0 MIDI files created with a sequencerprogram, or with an interactive program such as MAX, or use real-time MIDI controller input,to make music with Csound, and only a skeletal score file is required.The ECMC midiins algorithms illustrate this type of MIDI inplementation.)Advanced users may wish to explore the resources of the SCOT score translator, or the CSCORE score generating program, both of which are documented in the Csound referencemanual. Other advanced users write their own score generating programs,or employ spreadsheet programs for particular applications.

1.2. Orchestra file headers

[ See the discussions of SYNTAX OF THE ORCHESTRA,ORCHESTRA STATEMENT TYPESandORCHESTRA HEADER STATEMENTS>in the Csound reference manual ]

Every Csound orchestra must begin with a header, which establishes certain global values that are used by all instruments within the orchestra. Here is asample Csound header:

sr=44100
kr=2205
ksmps=20
nchnls=1

1) The sr variable fixes the sampling rate (also called the audio-rate, or a-rate, in Csound). This determines how many samples per second will be calculatedfor each channel to represent sounds.

In the ECMC studios we currently use 44100 as a 'universal,' device-compatible,high quality sampling rate on all of our digital audio systems, from sourcerecordings of acoustic sounds all the way through compact disc production.(However, we may be upgrading one or more of our systems in the near futureto a 96 k sr, 24/32 bit format.)

For initial tests with Csound, however, lower sampling rates, such as 32000or 22050, will compute more quickly and require only halfas much disk space for output soundfiles. And if we run Csound in real time,sending the samples directly to the system DACs rather than writing them to asoundfile (by means of the ECMC csoundplay command, or its alias csp),lower sampling rates can enable us to employ more complex signal processingprocedures, and to play more simultaneous 'polyphonic' notes, before reachingthe system throughput limitations.

Remember, however, that the highest frequency that can be represented digitallyis one half the sampling rate, which is called the Nyquist frequency. If we attempt to create a sound that includes partial frequencies higherthan the Nyquist, these higher frequencies will alias, or 'fold over,' accordingto the formula :

sr - freq

Thus, with the sampling rate set to 22050, a frequency of 12000 herz willactually be heard at 10050 Herz. And if we attempted to create a sine wave glissandobetween 20 Hz. and 22kHz., the resulting pitch would rise from 20 herz upto 11025 herz, but would then glissando back down to 50 herz.

Remember, too, that the 'smoothing' filters built into all DACs, as wellas the 'anti-aliasing' low pass filters within ADCs, also serve to attenuatefrequencies above approximately 38 of the sampling rate, reaching 'total'attenuation (-60 dB) at around, or slightly below, the Nyquist frequency. Withcheap converters, the rolloff is even less steep.

2) kr specifies a control rate. There are many types of subaudio control signals, such as vibrato andtremolo patterns, that do not need to be computed at the sampling rate toachieve a satisfactory resolution. To do so would waste processor (and user)time. For such operations our orchestra header above specifies a controlrate of 2205 updates per second, a value we gen- erally recommend. Controlrates typically vary between about 500 and 5000. However, the k-rate must divide evenly into the s-rate.

3) ksmps, an irksome but required part of Csound headers, is the ratio between the s-rate and the k-rate. Thus, in our example above, the ratio is 20 sample calculations for eachcalculation of control signals. In other words, every value computed atthe control rate will be used for 20 successive audio samples, then updated(recomputed).

4) The final header variable, nchnls, determines the number of output audio channels. Use 1 for mono, and 2for stereo.

The Eastman Csound Library macro SETUP presents the same information on a single line of code :

SETUP(44100,22050,1)

Note that if you use this macro format, the value of ksmps is calculated and filled in automatically. The three arguments to the SETUP macro specify the sampling rate, the control rate, and the number of outputchannels. When using this macro format, make sure that the word SETUP is capitalized, and that there are no spaces between any of the characters.An orchestra file that uses any of the Eastman Csound Library macros,such as SETUP, must be processed by the Eastman utility m4orch (which can be abbreviated m4o). m4orch expands such macros into Csound code, and writes its output to a file named orch.orc (which can be abbreviated orc). This file should be used as your orchestra file input to Csound.

1.3. Audio, Control and Initialization Rates

[ See the discussion of CONSTANTS AND VARIABLESin the Csound referencemanual, but do not worry about Global variables yet. ]

Csound instrument algorithms are constructed by patching together various unit generators, each of which performs a particular type of mathematical operation. TheCsound reference manual describes these unit generators and other featuresof the compiler in a manner designed for quick reference by experiencedusers. It is unlikely that you will want to take this manual along to thebeach for a relaxing read. The manual groups unit generators together byfamily and function. In this tutorial, we will look at the more commonlyused operations. This will mean a lot of skipping around in the manual.

Before we examine these unit generators, we need to clarify a few basicthings about the syntax with which one writes lines of Csound code. Reprintedbelow are the definitions for four Csound unit generators as they appearin the reference manual. The first two unit generators (oscil) create basic oscillators. The two concluding lines (rand) create white noise generators.

  • The signal output produced by the operation is specified at the far left,separated by one or more spaces from
  • the name ('opcode,' or 'operation code') of the unit generator, followed by
  • the required arguments to the operation, separated by commas, and finally by
  • any optional arguments we wish to include.

    Optional arguments are indicated by square brackets in the Csound referencemanual, but these brackets are not included in one's actual Csound code.

An oscillator or white noise generator can run either at the audio rate,if this signal will be heard as a sound, or else at the control rate, ifthe signal will instead control (modify) some characteristic of an audiosignal created by some other unit generator. We determine the output rateby the output name (or 'result') we supply. If this name begins with a k, the unit generator will run at the control rate; if the name begins withan a, the operation will be computed at the audio rate. We can choose any namewe wish for these output names, so long as they begin with a k or an a.

If our oscillator will be producing a vibrato signal that modifies the pitchproduced by another oscillator, for example, we might call the result kvibrato, or perhaps kvib, or k1, or, perversely, kKxg6w. If our white noise generator is producing audible noise, we might callthe output anoise, or asignal, or asig, or a2.

To the right of the unit generator name, the arguments (input values) thatit needs to perform its computations are listed. Each argument is separatedby a comma. Blank spaces or tabs may be included between arguments for easeof reading.

Any argument beginning with an i is one for which a value will be established at the initialization (onset) of the note, and will not change during the note's duration. Anyargument starting with a k can change values either at the control (k) rate, or else at the i rate. An argument that begins with an a is updated at the audio-rate. Finally, an argument beginning withan x can be given at the a-rate, at the k-rate, or as an initialization value. In other words, inputs to various mathematical operations may bespecified only once per note, or change at either the control or audio rate.Some arguments must be specified at a certain rate, while with other arguments it is up tothe user to select the appropriate update rate.

The oscil unit generator has three required arguments - an amplitude (amp) value, a frequency (cps) value, and a function number (fn). It is also possible, if we wish, to include a fourth argument (phs), which specifies where in the function table the oscillator should begin reading (more on thislater).

If the oscillator is running at the control rate, the amplitude and frequencyarguments can be either constant (i-rate) values, or else k-rate control signals, previously created by other unit generators. The functionnumber argument is fixed (an i-rate value) for the duration of each note. (Normally, we cannot change waveshapesin the middle of a note.) However, the function table number can change from one note to the next. If the oscillator is running at the audiorate, its amplitude argument can be updated at any rate.

The white noise unit generator rand has only one required argument, which determines the amplitude of the noiseband. If we run rand at the audio rate, we can update this amplitude value every sample (a-rate), every control period cycle (k-rate), or only once per note (i-rate). If rand is running at the k rate, audio rate amplitude updates are not possible.

1.4. A Simple Instrument Algorithm

See the discussion of INSTRUMENT BLOCK STATEMENTSin the Csound reference manual ]

We are now ready to start making some music, or at least some sound. So,without further ado, we present our first orchestra, which we would typeinto a file with a text editor such as vi. We will call this file first.orc:

sr= 44100
kr= 2205
ksmps= 20
nchnls= 1
instr 1
asound oscili 15000, 440, 1
out asound
endin

This is about as simple an orchestra as we could design. Savor it. In acouple of weeks, as you ponder the intricacies on lines 47 through 63 ofsome distant descendent of this little fellow, you may look back on thesefew pristine lines with almost unbearable nostalgia. But perhaps not. Thisorchestra also is so limited that it is highly unlikely you would ever wantto use it, or to listen to its output for more than a couple of seconds.

Our orchestra includes a single instrument block, or algorithm. An instrument block consists of three things: A line identifyingthe number of the instrument block; the body of the instrument; and finally,the word endin, which signifies the end of this instrument block.

Here, we have given the instrument the auspicious number '1.' Any numberbetween 1 and 200 will do, but every instrument block within an orchestramust have a unique number.

For

The two line body of this instrument. can be translated as follows: Createan interpolating oscillator (oscili, a cousin of the basic oscil unit generator discussed above). Run this oscillator at the audio-rate,and write the results of its operations into a RAM memory location we willcall asound. Give the oscillator a fixed amplitude of 15000 (on a scale of 0 to 32767).Make it sample a waveshape defined in our score by function table number1. Set the output frequency to 440 herz. Then (out asound) write the output of RAM memory location asound to the output soundfile.

1.5. Oscil and Oscili

[ See the discussion of OSCIL and OSCILIin the Csound reference manual]

The oscili unit generator in the example above requires a closer look, since oscillatorsare the most important components of many instruments. An oscillator isa signal generator, which often (but not always), it is used to create a periodic signal, in which some pattern is repeated many times. As noted earlier,Csound oscillators have three required input arguments - amplitude, frequency and function number - and an optional fourth argument (not used in the example above) specifyinga starting phase at which the function is to be read.

Computer Sound Cards

Function Number (3rd oscillator argument) :

Digital oscillators cycle through a table of numbers (called a function, in Csound), which often represents one cycle of some waveform or shape.Practically any shape can be defined in a function definition, as we willsee later, but a particularly common common waveshape is the sine wave.Functions are defined and numbered in the score. The third argument to oscil or oscili specifies the number of the score function to be read by the oscillator.Functions are created and loaded into memory at the beginning of a Csoundsoundfile compilation job, and unless one employs the -d option of the csound command, all functions within the score file are displayednear the beginning of the the sterr (standard error message) output of the Csound compilation job.

Starting Phase (optional 4th oscillator argument)

The optional fourth argument [iphs] specifies where the oscillator should begin reading within the table. The default, whenthe argument is left blank, is to begin at the beginning of the table. Validarguments range between 0 and 1. . A value of .5 would cause the oscillatorto begin reading half way (180 degrees) through the table; a value of .333would cause reading to begin 1/3 of the way (120 degrees) into the table.

For a repetitive sine wave audio signal of, say, 440 herz, the startingphase makes no audible difference, and the argument can be omitted. However,if a control oscillator is creating a subaudio, five herz sine-wave vibratosig- nal, beginning at a starting phase of .5 (half-way through the sinewave) would cause the resulting pitch first to be lowered, then raised,rather than the reverse.

The partials produced by most acoustic instruments are often not in phase,but these phase differences seem to make little audible difference. (Thispoint has been studied and debated for many decades, however.) Phase differencesDO become significant when mixing signals of the same or nearly same frequency(e.g. doubling a note between instruments, or combining direct and delayedsignals).

Frequency (2nd oscillator argument) :

The second argument to an oscillator specifies the rate at which it mustread through the function table. A value of 440, as in the example above,will cause the oscillator to read through the table ('wrap around') 440times for each second of sound created.

An oscillator will almost never read every number within a single cyclefunction table in continuous succession. Rather, since both the samplingrate and the size of the function table are fixed, the oscillator will needto skip over several numbers within the table before taking each new sample readingin order to produce the correct frequency. This 'skip' value is called the sampling increment.

In our example, with a sampling rate of 44100 and a requested frequencyof 440 Herz, the oscillator will need to spit out 100.22727 samples to representeach cycle :

100.22727 samples per cycle * 440 cycles = 44100 samples per second

Csound function table sizes generally must be a power of two (exceptionsare noted later), and a table size of1 k (1024 numbers) is a typical length. To figure out the correct samplingincrement, the oscillator employs the formula

or, in our example,

This means that our oscillator will read in the first number from the table,using it to compute the first output sample value, then skip the next tennumbers within the table, using the eleventh number to compute output sample2, the 21st table number to compute output sample 3, and so on. On approximatelyevery fifth output sample, the oscillator will skip eleven rather than tennumbers within the table.

Every frequency requires a unique sampling increment. However, none of thismathematical unpleasantness need concern the user; the oscillator takescare of all of this automatically.

1.5.1. Interpolating and Truncating Oscillators

This brings us to the difference between interpolating oscillators, such as the Csound oscili, and truncating (non-interpolating) oscillators, like oscil. With a sampling increment of 10.21678, the oscillator should find valuesat the following points in the table :

0 10.21678 20.43356 and so on

Obviously, there is no value at location 10.21678 in the table - only valuesat locations 10 and 11. Truncating oscillators (oscil) keep accurate track of the cumulative sampling increment, but, in the exampleabove, return the values of table locations 0, 10, 20, 30 and so on. Theinterpolating oscili, by contrast, will take the time to compute the difference between the numbersin table locations 10 and 11, multiply this difference by .21678, and addthe result to the number in table location 10. By interpolating betweenadjacent table locations for each input sample in this fashion, oscili will provide better resolution (representation) of the waveform, with lessround-off error and thus less harmonic distortion. The price? Greater computationtime for this particular unit generator, by at least a factor of two.

If our orchestra contains a single oscillator, the difference in computationtime between oscil and oscili might be trivial. But if our orchestra includes several interpolating oscillators,and our score requires that many notes be computed simultaneously, the computationtime difference becomes more substantial. For non-real-time synthesis of audio signals, oscili is often the better, or at least the safer, choice. For control signals,such as a 5 herz vibrato pattern, however, it is unlikely that the higherresolution would make much audible difference. We would probably use thefaster oscil to create this signal, and would run this oscillator at the control raterather than at the audio rate.

Note that by using very large table sizes - say, 4096 or 8192 points,rather than 1024 - to represent a waveform, round-off error can be reducedwhen truncating oscillators are used. This is the solution often employedin higher quality commercial digital synthesizers, and one we also employwhen running Csound in real time.However, larger tables require more RAM.Such tradeoffs between computation time, memory space and signal resolutionare encountered frequently in digital synthesis. The harsh, nasal timbresproduced by many cheaper hardware synthesizers result from such factors:low sampling rates, and round-off errors produced when truncating oscillatorsread waveshapes stored in comparatively small tables.

Amplitude (1st oscillator argument) :

The tables of numbers for most sine wave and other synthetic audio functionsare floating point values that range between -1. to +1. The amplitude argument to an oscillator specifies a multiplier for each number read infrom the function table. On a 16-bit integer system, the output integersamples are scaled between 0 to +/- 32767. Thus, the number 15000 used inour example merely denotes a value within the acceptable range. It is impossibleto say whether this value will be perceived as mezzo-piano, forte, or whatever.(Recall that timbre is often a more important factor in our perception ofloudness than ampitude.)

In general, we try to create source signals at fairly hot levels, with amaximum amplitude peak somewhere between 15000 and 32000 for 16 bitsignals, in order to takeadvantage of the full 16 bit signal resolution. Level and balance adjustmentsbetween different signals within a mix generally are accomplished duringmixing operations, in the same manner that one users faders on a mixingconsole (or vitural faders in a sequencing or audio mixing program)when bouncing multiple tracks down to a stereo master.In creating source soundfiles, however, one must take care not toexceed a maximum amplitude of 32767 (for 16 bit samples) at any given point, or else severe distortionwill result. The Csound sterr terminal output provides the error message 'samples out of range' wheneverthe amplitude of a sample exceeds 32767. If several copies of an instrumentare playing simultaneously (for example, a chord, or overlapping sustainingnotes), be conservative in your initial amplitude arguments. These can alwaysbe increased on subsequent runs of the job if you find that the resultingtotal amplitude values are low.

In sum, we can paraphrase the three required arguments to an oscillatoras three questions. These are:

(1) What is the intensity level of the signal? (amplitude);

(2) How many times per second, or at what rate, is the waveshapebeing produced? (frequency); and

(3) What is the time-varying waveshape of the signal? (function number, whichpoints to a table of numbers that has been compiled and stored in RAM.)

Output statements: out, outs, outs1 and outs2

[ See the discussion of unit generators OUT and OUTSin the Csound reference manual ]

The statement out asound on the penultimate line of our sample orchestra file is called a 'standardout' statement. The out unit generator sends the current value of the RAM memory location we havecalled asound to an output buffer. Here it is added to any value (from other notes beingplayed simultaneously by this instrument, or by other instruments withinthe orchestra) already in the buffer. Eventually, a group of a thousandor so samples within the buffer are written as successive samples to thedisk soundfile, or, if Csound is being run in real time, toe system DACs.

Eumus Design Sound Cards Free

Since our orchestra is monophonic, we don't have to worry about spatiallocalization. However, if we change our orchestra to stereo (by settingthe header nchnls argument to 2), we must use unit generator outs (or else outs1 and outs2), rather than out, in order to specify stereo localization. The standard out statement mightlook like this:

Download
outs a1, a1

This would send the signal at full amplitude to both output channels. Ifthe standard out statement looked like this:

outs (.7*a1), (.3*a1)

or else like this :

outs1 .7*a1
outs2 .3*a1

70 % of the signal would be sent to the left channel, and 30 would be sentto the right.

1.6. Score files

[ Read the discussions of THE STANDARD NUMERIC SCORE and of
I STATEMENT (INSTRUMENT or NOTE STATEMENT)in the Csound reference manual ]

Our first.orc file provides a working, if trivial, instrument algorithm. Now we musttell this algorithm how many notes to play, what the durations of the notesshould be, and what waveform the oscillator should read. We could createa score11 file like the following to create a sine wave table (f1, where the 1 corresponds to the function number we have told our oscillator to use),and then to specify a single note lasting three seconds:

Score11 input file:

The resulting score11 output file sout, a Csound format scorefile, would look like this:

We are now ready to compile our soundfile with Csound :

Alternatively, since our Csound score is so simple, we might find score11 superfluous, and instead type the three lines of the Csound score directlyinto a file. In this case, we might include Csound comments, which beginwith a ; (rather than with a <):

We need not call this Csound score file 'sout.' Perhaps first.sco, or - yes! - evocative.sco would be more descriptive.

Note that the single I Statement line in our score has three parameters: p1 (i1) specifies which instrument within the orchestra file is to play this note;p2 (0.000) specifies the starting time of the note; and p3 (3.000) specifies the duration of the note.

1.7. Creating Function Table Definitions

[ See the discussion ofF (FUNCTION TABLE) STATEMENTin the Csound reference manual ]

Our next major topic concerns function table definitions, which must beincluded in our score file whenever we employ one or more oscillators withinour orchestra. Like I (note) statements, F (function) statements consist of a series of parameters (variables):

Note that in score11 input files, the f must be preceded byan asterisk, a flag that tells score11 simply to reproduce the line as is, and must conclude with a semicolon.

The first parameter field (f1), specifies the number of the function, in this case 1, although 10, 125 or 1000 would do just as well.One cannot have two different functionswithin a score with the same number active at the same time. However, twoor more oscillators can read simultaneously from the same function table.

The second p-field determines at what time the function will be created.In this case, the function is created at time '0,' that is, before the computationof samples begins.

If we were creating a long, complex soundfile, say, 40 seconds or so, anddidn't need this particular function until halfway through, we could giveit a starting time of 20. The table then would not be created until 20 beatsinto the soundfile. This might be elegant, but is rarely required, unlesswe don't have enough computer RAM to squeeze in everything that happensin the first 20 seconds. With today's computers, this is rarely a problem.

The third parameter (1024) determines how many numbers will be used to outlinethe desired shape. As discussed earlier, the higher the number, the greaterof resolution, but the more memory space required to store the table. Thetable size must be either a power of 2, (2, 4, 8, 16, 32, 64, 128, 512, 1024, 2048, 4096, 8192 etc.)or else a power of two- plus-one (3, 5, 9, 17, 33, 65, 129, etc.).

=> If the function is going to read repetitively by an oscillator, then a power of two should be used.
=> If the function will be read only once per note, a power of two plus one is better. Examples of the latter case will be discussed in the sectionon envelopes.

The fourth p-field in the function definition statement is a call to a particularfunction generating program, which will actually calculate the numbers ofthe table and load them into RAM. These programs are called gen routines in Csound (and in many other music compilers as well, since they are allderived from programs of the same name originally written at Bell Labs inthe 1960s). Our function table definition invokes gen10.

1.8. GEN Routines : gen10

Eumus Design Sound Cards & Media Devices Driver Download For Windows

[ See the discussion ofGEN10in the Csound reference manual. ]

gen10 creates a table that represents one cycle of an audio waveform consistingentirely of harmonic partials. By harmonic, we mean that every frequency component is an integer ratio - exactly twicethe fundamental frequency, three times the fundamental, and so on. The relativeamplitude of each harmonic is indicated, successively, in the remainingp-fields of the function definition. In our example sine wave function definition,only one additional p-field is included, specifying a value of 1. This means that the first partial (the fundamental) has a relative strengthof 1, while the remaining harmonics all have a relative strength of 0. Thiswill produce a sine wave.

Suppose we want to create a wave that consists of only odd numbered harmonics,all of equal intensity. Our function definition might now look somethinglike this:

Here, harmonics 1,3,5,7,9 and 11 all have the same relative strength, whileall even numbered partials are suppressed.

Of course, this likely would produce a rather unnatural timbre. It wouldbe much more likely for the various harmonics to have different relativestrengths :

This makes the fundamental stronger, and the higher odd partials progressivelyweaker. In fact, the function above would approximate a square wave, thoughwith sloped sides, because the waveshape is band-limited in frequency. We have specifiedonly odd harmonics 1, 3, 5, 7, 9 and 11. Additional, higher odd-numberedharmonics would be necessary to produce the right angles of a true squarewave. As of this writing, function definitions, as well as Csoundorchestra and score files, can include up to 150 p-fields (a limit that maysoon be raised), so we could addmany more harmonics if we so desired. However, we would have to be carefulabout using such a function to create high-pitched tones, especially atlower sampling rates, since the highest harmonics might exceed the Nyquistfrequency and alias.

Example: With a sampling rate of 22050 and a pitch of 1000 Herz, any harmonicabove number 11 would fold over.
(Although not required, it is generally good practice to give a value of1 to the strongest partial -- which will not always be the fundamental -- andto scale the others accordingly, as numbers between 0 and 1.)

The time hasfinally come to put to use what we have learned so far, to experiment withsome audio function definitions, and to create a couple of soundfiles whichare available for your listening and dancing pleasure in the sflib/x directory.To do this, however, we must first upgrade our orchestra file, replacingsome of constant values with score p-field variables, so that we can varythe oscillator's amplitude, frequency and function number arguments fromnote to note. Our revised orchestra file now looks like this:

Soundfile example ex1-1 in /sflib/x was created by means of the orchestra file above, and the following score11 file:

The Csound score file ('sout') produced by the above score11 file looks like this:

Some questions to ponder on this example:

  • Note that although the physical amplitude of all 10 notes is identical,the perceived loudness of these notes varies considerably. Why?
  • Most of the notes begin and end with a pop? Why?
  • Why does the third note sound an octave higher than the first two notes?

After experimenting with some isolated test tones in this fashion, we oftencan isolate some material that can be used to create a more intriguing musicalgesture. Listen to and study the following example, which makes considerableuse of random selection procedures. Three audio waveshape functions similarto f4 in the previous example are employed. The fundamental frequencies at thevery end of the example are subaudio (see p4 below).

This does not prevent us from creating inharmonic partials, but it doesrequire some slight-of-hand within our function table definition and inthe frequency input to our oscillator. Consider the orchestra and score11 files, reproduced below, used to create soundfile example ex1-3. The orchestra file is identical to our previous orchestra except for theoscillator frequency argument (shown here in boldface). Within the score11 file, the partial frequencies for both audio functions also are shown herein bold type.

score11 file used to create this soundfile:

Within the function definition of f1, we specify partial frequencies of 10, 27, 54 and 81. Within the orchestrafile, we have modified the oscillator frequency argument, directing it towrap around function tables at a rate one tenth the value specified in p4. Thus, for the first note in our score, where the oscillator frequency isset to 55 herz in p4, the oscillator actually will wrap around the table at a rate of only 5.5cycles per second. The frequencies of the waveform will be 10, 27, 54 and81 times this 5.5 herz base, or, respectively, 55, 148.5, 297 and 445.5herz. The audible result, of course, will be identical to that producedby an oscillator wrapping around a table at 55 herz, with partial frequenciesof 1., 2.7, 5.4 and 8.1, except that we have eliminated the discontinuityin the waveform.

The second function in our score, used for notes 3 and 4, specifies partialfrequencies of 21, 29, 91, 100, 161 and 170, which actually become frequencyratios of 2.1 , 2.9 , 9.1, 10., 16.1 and 17. These partials are almost, but not quite, harmonic. Therefore, even with no fundamental specified,this spectrum will produce a clearly defined pitch at the phantom fundamentalfrequency, but with amplitude beating resulting from the slight inharmonicity.

Note, too, that because these two tables produce very complex waveshapes(since they include so many cycles of each partial), we have increased thetable sizes from the customary 1024 to 2048. 4096 might produce even betteraudio quality.

Obtaining copies of the orchestra and score files examples

ECMC users can obtain copies of the orchestra and companion scorefiles for all of the examples within this tutorial (such as ex1-1, ex1-2and ex1-3 above)in either of two ways:

  1. If you are working in a shell window on one of the SGI systems:
    • To obtain a listing of available orchestra ('instrument') files fromthis tutorial, type: lsins
    • To copy one or more of these orchestra files into a file called orch.orc(which can be abbreviated simply as orc) within your current working Unix directory,use the ECMC mko ('make orchestra file') command:
    • To obtain a listing of available score11 input files for the tutorialexamples, type: lsex
    • To display one or more of these score11 input files, type
    • To copy one or more of these score11 input files into a file of your own,redirect the output:
      getex filename(s) > myfile
      For example, typing
      getex ex1-1 ex1-2 ex1-3 > chap1scores
      will copy the score11 input files for tutorial examples ex1-1, ex1-2 andex1-3 into a file called chap1scores within your current working Unixdirectory.
  2. If you are using cecilia to run Csound you can access orchestraand Csound (not score11) score files for all of the examples in this tutorial,as well as for Eastman Csound Library algorithms, by selecting
    File > New > ESMTutorial
    and then selecting the desired orc/sco module. Please consult the ECMC helpfile cecilia for details on setting up your cecilia environmentto include these ECMC tutorial modules, as well as modules from the EastmanCsound Library, such as marimba, samp and gran.
Assignment

1) Study and review the material in this chapter, and in the correspondingpages of the csound manual. Jot down any questions you have (before youforget them) and bring up these questions in the next class. Do this eachweek.

2) Using the examples within this chapter as initial models, create two or threesimple Csound orchestra files, and a few brief scores for these orchestras toplay. Your scores should include functions using gen9 and gen10. Compilesoundfiles from these orchestra and score files and play these soundfiles (orelse run Csound in real-time mode)and make sure that you are getting what you expect. Be adventurous.

Eastman Csound Tutorial: End of Chapter 1