CCRMA

Music 220b: Lecture Notes 8


MIDI Recording, Map Command, Soundfiles, Mixsounds, Sound Data Write


Recording MIDI

See the Stella manual, chapter 8, for a "how to." Recordings are preserved as threads and can be saved to a .midi file with the write command. For the reverse direction, .midi files can be read into threads with the import command.

Map Command

The map command in Stella is similar to map in Common Lisp. With it, you get to apply a function to each element of a list:

      <cl> (setf list-of-integers (list 1 2 3 4 5))
	    (1 2 3 4 5) 
      <cl> (defun plus-10 (x) (+ x 10))
	    PLUS-10 
      <cl> (map 'list #'plus-10 list-of-integers)    ; <output-type> #<map-function> <list-to-map-over>
	    (11 12 13 14 15) 
In Stella, map is used to access and change parameter values in a thread. Here, first a thread is made and then its contents listed:

    (thread plucktest ()
      (doitems (p (pitches c4 d e fs gs a c5 in random for 3))
	    (object pluck freq p rhythm .1)))
	    
Plucktest:
	  1.	#<pluck 0.1 0.1 freq:329.6276 	
	  2.	#<pluck 0.1 0.1 freq:329.6276 	
	  3.	#<pluck 0.1 0.1 freq:523.2511 	
; Now divide the rhythms by 3 with this command:

    map plucktest set rhythm (/ $rhythm 3)	; $ preceeds a parameter being accessed

Plucktest:
	  1.	#<pluck 0.033333335 0.033333335 freq:329.6276
	  2.	#<pluck 0.033333335 0.033333335 freq:523.2511 
	  3.	#<pluck 0.033333335 0.033333335 freq:329.6276
See the Stella manual, chapter 9, for the full command set that applies to map.

Playing and recording sound files

Sound.app is a good application to launch by double-clicking a file that has the .snd extension. It allows simple playback, graphing, editing and recording. Easy recording can be accomplished with the NeXT Station's built-in microphone. High quality recording requires Studio D and the AD64 program. The following command line typed to the Terminal application

	sndplay /zap/test.snd 
also plays a sound.

To close the MIDI Listener stream, you must be in syntax MIDI and issue the close command.

Mixsounds Examples

(Please read) mixsounds.rtf introduces the mixsounds "instrument".

mixsound-singletrack.lisp creates a scorefile that mixes several sounds from the /NextLibrary/Sounds when sent to mixsounds. The commands to mix and play are shown at the end of the file (beware, it does not get played by ScorePlayer).

mixsounds-printer-hell.lisp sounds like its name. It needs to be executed in 2 passes: first pass demonstrates writing data of an fm synthesis scorefile to a sound file. The second pass mixes that file with recorded sounds.


Assignment

Time to work on your project...


©1995 Fernando Lopez-Lezcano. All Rights Reserved.
nando@ccrma.stanford.edu