c@37
|
1
|
c@37
|
2 program test;
|
c@37
|
3
|
c@37
|
4 af = load may.stream.audiofile;
|
c@37
|
5 plot = load may.plot;
|
c@37
|
6 cm = load may.matrix.complex;
|
c@37
|
7 mat = load may.matrix;
|
c@37
|
8 vec = load may.vector;
|
c@37
|
9 manipulate = load may.stream.manipulate;
|
c@37
|
10 syn = load may.stream.syntheticstream;
|
c@37
|
11
|
c@37
|
12 { cqt } = load cqt;
|
c@37
|
13
|
c@37
|
14 //testStream = manipulate.withDuration 96000 (syn.sinusoid 48000 500);
|
c@37
|
15 //testStream = manipulate.withDuration 96000 (syn.pulseTrain 48000 4);
|
c@37
|
16 //testStream = af.open "sweep-48000.wav";
|
c@37
|
17 //testStream = af.open "sweep.wav";
|
c@37
|
18
|
c@38
|
19 testStream = manipulate.withDuration 64 (syn.sinusoid 8 2);
|
c@38
|
20
|
c@38
|
21 // So the stream is [ 0, 1, 0, -1, 0, 1, 0, -1, ... ]
|
c@37
|
22
|
c@37
|
23 eprintln "have test stream";
|
c@37
|
24
|
c@38
|
25 cq = cqt { maxFreq = testStream.sampleRate/2, minFreq = 1, binsPerOctave = 4 } testStream;
|
c@37
|
26
|
c@37
|
27 for cq do c:
|
c@37
|
28 mm = cm.magnitudes c;
|
c@37
|
29 for (mat.asColumns mm) (println . strJoin "," . vec.list);
|
c@37
|
30 done;
|
c@37
|
31
|
c@37
|
32 bigM = mat.concatHorizontal (map cm.magnitudes cq);
|
c@37
|
33
|
c@38
|
34 eprintln "overall output size = \(mat.size bigM)";
|
c@38
|
35
|
c@38
|
36 for [0..mat.width bigM / 8 - 1] do b:
|
c@38
|
37 println "\nColumns \(b * 8 + 1) to \(b * 8 + 8)\n";
|
c@38
|
38 for (mat.asRows (mat.columnSlice bigM (b*8) (b*8+8))) do row:
|
c@38
|
39 for (vec.list row) do v:
|
c@38
|
40 n = int (v * 10000);
|
c@38
|
41 print (strPad ' ' 10 "\(n / 10000)");
|
c@38
|
42 done;
|
c@38
|
43 println "";
|
c@38
|
44 done
|
c@38
|
45 done;
|
c@38
|
46
|
c@38
|
47
|
c@38
|
48 //\() (plot.plot [Contour bigM]);
|
c@38
|
49 //\() (plot.plot [Grid bigM]);
|
c@37
|
50
|
c@37
|
51 ()
|
c@37
|
52
|