Mercurial > hg > silvet
comparison yeti/em_onecolumn.yeti @ 21:8e61ec97b34e
I think this may be the right arrangement. Print out some results.
author | Chris Cannam |
---|---|
date | Fri, 28 Mar 2014 12:52:11 +0000 |
parents | 982aa1197a7e |
children | 782b910394f3 |
comparison
equal
deleted
inserted
replaced
20:982aa1197a7e | 21:8e61ec97b34e |
---|---|
58 (pitches = vec.fromList | 58 (pitches = vec.fromList |
59 (map do note: | 59 (map do note: |
60 fold do acc instrument: | 60 fold do acc instrument: |
61 { w, p, s } = distributionsFor data instrument note; | 61 { w, p, s } = distributionsFor data instrument note; |
62 fold do acc bin: | 62 fold do acc bin: |
63 acc + s * (vec.at w bin) * (vec.at q bin); | 63 acc + s * p * (vec.at w bin) * (vec.at q bin); |
64 done acc [0..vec.length column - 1] | 64 done acc [0..vec.length column - 1] |
65 done epsilon data.instruments; | 65 done epsilon data.instruments; |
66 done [data.lowest .. data.highest]); | 66 done [data.lowest .. data.highest]); |
67 pitches = vec.divideBy (vec.sum pitches) pitches; | 67 pitches = vec.divideBy (vec.sum pitches) pitches; |
68 | 68 |
70 do instrument: vec.fromList | 70 do instrument: vec.fromList |
71 (map do note: | 71 (map do note: |
72 if not inRange data.ranges instrument note then epsilon else | 72 if not inRange data.ranges instrument note then epsilon else |
73 { w, p, s } = distributionsFor data instrument note; | 73 { w, p, s } = distributionsFor data instrument note; |
74 fold do acc bin: | 74 fold do acc bin: |
75 acc + (vec.at w bin) * (vec.at q bin); | 75 acc + s * p * (vec.at w bin) * (vec.at q bin); |
76 done epsilon [0..vec.length column - 1] | 76 done epsilon [0..vec.length column - 1] |
77 fi; | 77 fi; |
78 done [data.lowest .. data.highest]) | 78 done [data.lowest .. data.highest]) |
79 done data.instruments; | 79 done data.instruments; |
80 | 80 |
81 sourceDenoms = fold do acc instrument: | 81 sourceDenoms = fold do acc instrument: |
82 vec.add [acc, sources[instrument]] | 82 vec.add [acc, sources[instrument]] |
83 done (vec.zeros (data.highest - data.lowest + 1)) data.instruments; | 83 done (vec.zeros (data.highest - data.lowest + 1)) data.instruments; |
84 | |
85 \() (plot.plot [ Caption "Source numerators for piano", Vector (sources["piano-maps-SptkBGCl"]) ]); | |
86 | |
87 \() (plot.plot [ Caption "Source denominators", Vector sourceDenoms ]); | |
88 | 84 |
89 sources = mapIntoHash id | 85 sources = mapIntoHash id |
90 do instrument: | 86 do instrument: |
91 vec.divide sources[instrument] sourceDenoms; | 87 vec.divide sources[instrument] sourceDenoms; |
92 done (keys sources); | 88 done (keys sources); |