Tips for HW4

Homework 4

Step 1: copy "ats" package in your directory

The "ats" package is placed in /user/u/unjung/220/ats/. Follow the next commands to get /ats/ package in your home directory.

1. make a directory "/220". If you already have it, that is perfect. The directory should be named exactly as /220. It shouldn't be "/220a" or "/Mus220a". Type the following commands to do this.

	~>mkdir 220
	~>cd 220
	~/220>cp -r /user/u/unjung/220/ats .
2. Now you should have "ats" package in your home directory.If you have successfully copied the package, you'll see the following:
	~>cd 220/ats
	~/220/ats>ls -ls
	
		total 2
	0 drwxr-xr-x   2 yourlogin   games         512 Oct 26 15:32 analyses/
	0 drwxr-xr-x   2 yourlogin   games         512 Oct 26 15:35 plots/
	0 drwxr-xr-x   2 yourlogin   games         512 Oct 26 15:22 sounds/
	0 drwxr-xr-x   4 yourlogin   games         512 Oct 26 15:35 src/
	0 drwxr-xr-x   2 yourlogin   games         512 Oct 26 15:35 synthsounds/



Step 2: Loading "ats"

1. Now you are in /ats directory. Move to its sub-directory /src and check if there is a file named all.cl by typying:

	~/220/ats>cd src
	~/220/ats/src>ls -ls 

		total 69
	0 drwxr-xr-x   2 yourlogin   games         512 Oct 26 15:22 Synth/
	7 -rw-r--r--   1 yourlogin   games        7130 Oct 26 15:32 all.cl
	0 drwxr-xr-x   2 yourlogin   games         512 Oct 26 15:22 bugfixes/
       26 -rwxr-xr-x   1 yourlogin   games       26529 Oct 26 15:26 rt_synth_new_lnx*
       28 -rw-r--r--   1 yourlogin   games       28163 Oct 26 15:26 rt_synth_new_lnx.c
2. Open all.cl on xemacs editor by typying:
	~/220/ats/src>xemacs all.cl &
3. Split xemacs editor into 2:
ctrl-x-2
4. Fire up clm on one of the window:
ctrl-x-l
5. Compile and load all.cl on clm interpreter by typying:
	:cl all.cl



Step 3: Analyzing and synthesizing on ats

1. Place your .snd files to be analyzed in the directory ~/220/ats/sounds/. For hw4, move your plasticFlute.snd and clmFlute.snd files in ~/220/ats/sounds/. There are two ways of doing it.
On Netscape, visit here Click homework 1 which has all your plasticFlute.snd and clmFlute.snd files.And save your files in the directory ~/220/ats/sounds/ .
By Unix commands, in your home directory type:

~>cp ~/Library/Web/220a/hw1/plasticFlute.snd ~/220/ats/sounds/.
2. You will find comments starting and ending with #| inside of the all.cl. What you should do now is to evaluate the commands in the following order.

3. The following code should put your sound file (here, it is "plasticFlute.snd") through analysis.
	   (tracker "../sounds/plasticFlute.snd" 'yaft
		:dur 0.5
		:lMag .20 ; try 2.0 to hear with not enough partials
		:freqDev 0.45
		:dFund 250.0)
After the evaluation, it will show something like this:
	frames= 125 srate: 44100 M = 705 N = 1024 st 0.0 end= 22050.0
	tracking...
	.000 0 .004 1 .008 2 .012 3 .016 4 .020 5 .024 6 .028 7 .032 8 .036 9 .040 10 .044 11 .048 12 .052 13 .056 14 .060 15 
	.064 16 .068 17 .072 18 .076 19 .080 20 .084 21 .088 22 .092 23 .096 24 .100 25 .104 26 .108 27 .112 28 .116 29 .120 30
	.124 31 .128 32 .132 33 .136 34 .140 35 .144 36 .148 37 .152 38 .156 39 .160 40 .164 41 .168 42 .172 43 .176 44 .180 45
	.184 46 .188 47 .192 48 .196 49 .200 50 .204 51 .208 52 .212 53 .216 54 .220 55 .223 56 .227 57 .231 58 .235 59 .239 60
	.243 61 .247 62 .251 63 .255 64 .259 65 .263 66 .267 67 .271 68 .275 69 .279 70 .283 71 .287 72 .291 73 .295 74 .299 75
	.303 76 .307 77 .311 78 .315 79 .319 80 .323 81 .327 82 .331 83 .335 84 .339 85 .343 86 .347 87 .351 88 .355 89 .359 90
	.363 91 .367 92 .371 93 .375 94 .379 95 .383 96 .387 97 .391 98 .395 99 .399 100 .403 101 .407 102 .411 103 .415 104 
	.419 105 .423 106 .427 107 .431 108 .435 109 .439 110 .443 111 .447 112 .451 113 .455 114 .459 115 .463 116 .467 117 
	.471 118 .475 119 .479 120 .483 121 .487 122 .491 123 .495 124 
	NIL
*If you have an error like the following, try to edit your soundfile by cutting the silence in the beginning and the end of your file. Also try to vary the value of lMag the "tracker" code above.
   frames= 125 srate: 8000 M = 129 N = 256 st 0.0 end= 4000.0
	tracking...
	.000 0 
	Error: Stack overflow (signal 1000)
	[condition type: SYNCHRONOUS-OPERATING-SYSTEM-SIGNAL]

	Restart actions (select using :continue):
	0: continue computation
2. Now synthesize it by evaluating the following code. Now your resynthesized sound file is saved in ~/220/ats/synthesounds/yaft.snd.
	(with-sound 
		(:play t :output (namestring (make-pathname :directory *my-ats-resynth-dir* :name "yaft" :type "snd")) 
			:statistics t :verbose t :scaled-to 0.5)
		(osc-synth 0.0 yaft))
3. Save the data by evaluating the following code. The file yaft.ats is saved in the directory ../analyses/.
	(save-sound 'yaft (namestring (make-pathname :directory *ats-snd-dir* :name "yaft" :type "ats")))
4. Compile the data that was saved. Now yaft.fusl is saved in ~/220/ats/analyses/.
	(compile-file (namestring (make-pathname :directory *ats-snd-dir* :name "yaft" :type "ats")))
When you come back nex time, you don't need to complie again, you load yaft.fusl file by typying:
	(load (make-pathname :directory *ats-snd-dir* :name "yaft" :type "fusl")))
5. Plot the data that was resynthesized above by evaluating the following code. For 2D display, no file will be saved, while for 3D display, the following code generates and saves yaft.dat and yaft.eps files in the directory /plots.

For 2D display:
	(plot-sound yaft)
For 3D display:
	(cc-3d-plot-sound yaft (merge-pathnames *my-ats-plots-dir* "yaft"))
6. You have generated yaft.dat and yaft.eps files. Chek if there they are by typying:
	~/220/ats/plots/> ls -ls.
You should change the file format by following Step 5 below.



Step 4: Real-time synthesis from the data resynthesized

1. On clm interpreter, open a real-time controller with parameters:
(sui)
2. Call the sound:
(with-psound () (rt-synth-new yaft))
3. Manipulate the sliders of the parameters.



Step 5: How to use gimp to manipulate .eps files

The GIMP is the GNU Image Manipulation Program for UNIX and X. You may need to use this to change the format of your plot files.

1. Open "gimp" tool by typying: (If you haven't used gimp before, you have to install it when asked
	~/220/ats/plots>gimp
2. Open yaft.eps file(a plot) which is placed in ~/220/ats/plots. Save it as .jpg file.



unjung@ccrma.stanford.edu