An AIFF file (like an AU file) is simply a record of the wave forms sensed by a microphone at a series of times t0,t1,... The duration between samples determines the accuracy of the digital sound. In other words, if you have an extremely accurate digitization of the sound, the rate of sampling (measured in Megahertz) will be great (eg 33MHz), whereas a crude approximation will sample the wave less frequently (eg 8MHz). A less frequently sampled sound wave generates approximate data (squarish waves) in much the same way a pixelated file approximates an image.
Midi files are control scripts for midi-devices-- traditionally things like keyboards. These devices often understand how to play "samples" (here I mean "blurbs" of music, sound, etc.), but they can also play notes according to wave form definitions. We don't really have much equipment for authoring Midi files, although some software and equipment exists in the music department. Midi files are intriguing because they can compact extensive durations of music into very small files.
newmedia> file vader.au vader.au: Sun/NeXT audio data: 8-bit ISDN u-law, mono, 8000 Hz
AudioClip snd; public void init(){ snd = getAudioClip(getCodeBase(),"my.au"); } public boolean keyDown(Event e, int key){ if(key == 'a'){ snd.play(); } return true; }
int play[] = { 100,100, 110,110, 100,120 }; // a triangle int stop[] = { 120,100, 140,100, 140,120, 120,120 }; // a square public boolean mouseDown(Event e, int x, int y)P if(y>100 && y<120){ if(x>100 && x<120) snd.play(); else if(x>120 && x<140) snd.stop(); } return true; } public void paint(Graphics g){ Polygon p = new Polygon(); for(int i=0;i}
(Move pointer within the applet bounds and hit 'a' key to play sound)