COSMOS 2005

Computer Music and Computer Graphics

EXAMPLE PROGRAMS


A basic oscillator: oscillator.txt
This lets you listen to a sinusoidal wave, with adjustable frequency and amplitude.

A basic (monophonic) soundfile player: fileplayer.txt
This lets you listen to (the first channel of) a .wav or .aif soundfile.

A basic (monophonic) soundfile recorder: filerecorder.txt
This lets you record (the first channel of) the audio input of your computer into a .wav or .aif soundfile.

Experiment with RGB color values: trycolors.txt
You can try any mix of red, green, and blue, to see what color results.

Interference of two sinusoids: interference.txt
This demonstrates interference effects when adding two sinusoids of different frequency. It also demonstrates how to visualize an audio signal using Jitter.

Convert (MIDI) pitch to frequency: pitchfrequency.txt
This shows the formula for converting MIDI pitch to frequency in Max.

Mix 16 oscillators: harmonics16.txt
This allows you to mix 16 harmonically-related sine tones to try different timbres.

Rotate the colorwheel angle of the hue of an image: changehuerotation.txt
This demonstrates changing the colors of an image by rotating its hue angle on the color wheel.

Alpha channel for transparency: glalphablending.txt
You can try different alpha values of a GL object to vary its opacity.

16 oscillators: oscillators16.txt
This program is a one-minute automated "composition" in which sixteen sinusoidal waves slowly change in frequency and amplitude over the course of one minute. It starts with all oscillators at 800 Hz, and ends with each oscillator on a different harmonic (harmonics 1-16) of the fundamental frequency of 100 Hz.

Send MIDI messages to play a note: playonerawMIDInote.txt
This demonstrates a ridiculously simple example of sending out MIDI data to play a note.

Convert numbers to MIDI data to play a note: playoneMIDInote.txt
This demonstrates another ridiculously simple example of sending out MIDI data to play a note.

Show incoming MIDI data: showMIDIinput.txt
This uses the midiinfo object to find what input devices are available, and sets the midiin object to receive from one device.

Play MIDI notes with the computer keyboard: keyplay.txt
This uses the ASCII code of the keys typed on the computer keyboard (from the key object) as MIDI pitch numbers.

Play a major scale up and down: majorscaleupdown.txt
This demonstrates using the counter object to step through a table object containing a stored list of pitches.

Use MSP to generate MIDI data: sinusoidalbend.txt
This uses snapshot~ to capture the value of a low-frequency sine wave in MSP, and converts that value to a MIDI pitch bend value.

Use a low frequency sinusoid to vary playback speed: speedchange.txt
This uses cycle~ (at a very low rate) to vary the speed of an sfplay~ object, varying the playback from .5 to 1.5 times its original rate.

Use MIDI bend data to process video: bendbrightness.txt
This uses incoming MIDI pitch bend data to control the brightness of a Jitter video.

Use MIDI note data to draw a shape: xylophone.txt
This uses incoming MIDI note data to determine the horizontal location of a shape painted by jit.lcd.

Rotate the hue angle of an image: changehuerotation.txt
This uses an automated process, or the sound level coming into the computer, to vary the "hue_angle" attribute of a jit.hue object.

Linear mapping example: MIDItosaturationandrotation.txt
This converts MIDI pitchbend data into a rotation angle, to rotate a video around its center point, and it converts MIDI note data into a change in the color saturation of the video.

Spring-loaded slider in Max: springyslider.txt
This demonstrates how you can make a slider in Max have the same tyupe of "spring-loaded" behavior as an actual pitch bend wheel.

Sources of numeric data in Max: numbersources.txt
A compendium of a few of the many ways to generate numbers in Max. These ways are also compiled in a plain text list.

Capture key strokes on the computer keyboard: ASCIIkey.txt
This shows how to detect a particular key press on the computer keyboard and do something as a result.

Automated diatonic improvisation: onehandplaying.txt
This shows how to use a certain range of values in a table, and a specified offset within the table, to read a small varying group of values from the table automatically, resulting in a continuously evolving "improvisation".

Using a stored waveform in a buffer buffershape.txt
This shows how to use a stored waveform in a buffer~ in two different ways - reading through the waveform cyclically at an audio rate, and also reading through it at a subaudio rate and using its shape as a control function in MSP.

Switch between two videos A-B_switch.txt
This shows a simple way to switch between two videos in Jitter.

Crossfade between two videos A-B_fade.txt
This shows a simple way to crossfade between two videos in Jitter.

Slideshow of images, with crossfade slideshow.txt
This demonstrates a method for an automated slideshow of an entire folder of still images in Jitter, with crossfading between slides. This program is also explained, tutorial style, in an accompanying text file.

Monophonic wavetable synthesizer with vibrato and tremolo synthesizer.txt
This demonstrates some basics of synthesis: using a buffer~ to store a waveform and a cycle~ to read through 512 samples of it repeatedly, using line~ to trigger an amplitude envelope when the note is started (and to turn it off when the note is stopped), using a low-frequency cycle~ to modulate the frequency, and using a low-frequency cycle~ to modulate the amplitude. For this program to work properly, you'll also need this very small AIFF file: gtr512.aiff

Soundfile playback with vibrato, tremolo, and panning modulatedsound.txt
This shows how to apply low-frequency modulation not only to the amplitude of a sound, but also to the playback rate and the balance between speakers.

Delay line with feedback delay+feedback.txt
This shows how to implement a delay line in MSP, and adds the output of the delay line back into the input for a repeated echo (feedback echo) effect.


This page was last modified July 26, 2005.
Christopher Dobrian
dobrian@uci.edu