About the R Example Programs
December 2010

Donald Byrd

 

Beats.r Demo of the acoustic phenomenon of beats with two sine waves whose frequencies are very close.
CardMatchingFunExample.r (from the Music Informatics group R Tutorial)
ChromaticWanderings.r Program to play a randomly meandering chromatic melody. (MelodicWanderingsPlus, listed below, is a considerably fancier program of the same type.)
CombineWaves.r, CombineWaves_Fancy.r Demo of "superposition" of sounds: add two Wave objects read from files and play them and the result.
DescribeAudioSegments.r #
ExamineSound.r Read a .wav file, display information about it, and play it.
FourierRandomSynthesis.r Add up harmonics of a given frequency with random amplitudes and phases, i.e., use Fourier synthesis to create a random waveform (sort of a random timbre, though one that's absolutely static). (Formerly called "FourierRandomTimbre.r".)
FourierAnalSuccessiveApprox.r Reproduce an arbitrary waveform as a sum of sinusoids. Generate a random waveform; do Fourier analysis of it (via FFT); then display (and optionally play) better and better approximations using more and more sine waves.
FourierSuccessiveApprox3D.r An earlier version of FourierAnalSuccessiveApprox, but with an added 3D surface plot showing the successive approximations.
GlissandoSimple.r, GlissandoFancy.r Two versions of a program to generate a glissando and display info about it; can also be used to demo "aliasing" (really imaging, and a.k.a. foldover).
Intervals.r Demonstrate that two frequencies that have the same ratio will have the same musical interval.
LineBreaksInRStatements.r Demonstrates that adding a line break in the middle of an R statement might make R consider it to be two separate statements, which can cause serious problems.
LoopDemo.r Demonstrate simple loops with musical applications.
MelodicWanderingsPlus.r Program to play a randomly meandering chromatic melody.
MicrotonalApprox2Diatonic.r Compute how good the best microtonal equal-tempered approximations (for a given number of steps per octave) are to the pure diatonic intervals.
PlayMelody_LoopV1.r Simple program to play a series of notes with sine waves. Version 1: loop written in the simplest way.
PlayMelody_LoopV2.r Simple program to play a series of notes with sine waves. Version 2: loop written in a way that makes it easier to do fancier things.
PlayMelodyPOOR_LOOP.r #
PriceCrash.r (from the Music Informatics group R Tutorial)
QuantizationNoiseDemo.r Demo of effects of adding increasingly large random numbers to each sample; this simulates quantization noise.
ReadWave.r Demo of creating a Wave object from a file, and displaying and playing it.
RGLSphereDemo.r Draw a bunch of spheres with various options: demo of RGL, a 3D visualization package for R based on OpenGL
Sine2Ways.r Demonstration of how to create and play sine waves both the easy (but limited) way, and the more complex (but much more flexible) way
SinesDemo.r Simple program to create and play sine waves the easy (but limited) way
Spectrogram.r Display a simple spectrogram of a sound.
SuperSawtooth.r Generate two superposed sawtooths with unique sample values per period, e.g., to debug network audio problems.
Table+BarGraphDemo.r How to read tables and manipulate their contents, with simple bargraphs of their contents.

Comments to: donbyrd(at)indiana.edu
Copyright 2010, Donald Byrd

Music InformaticsSchool of InformaticsIndiana University