comparison yeti/em.yeti @ 13:e15bc63cb146

Ranges, EM initialisation
author Chris Cannam
date Fri, 21 Mar 2014 18:12:38 +0000
parents
children a91de434feb8
comparison
equal deleted inserted replaced
12:0f6db1895e1c 13:e15bc63cb146
1
2 module em;
3
4 mm = load may.mathmisc;
5 vec = load may.vector;
6 mat = load may.matrix;
7
8 initialiseEM ranges notes size =
9 {
10 pitches = // z in the original
11 array (map do note:
12 map \(mm.random ()) [0..size.columns-1]
13 done [0..notes-1]),
14 sources =
15 mapIntoHash id // u in the original
16 do instrument:
17 array (map do note:
18 if note >= ranges[instrument].lowestNote and
19 note <= ranges[instrument].highestNote
20 then vec.ones size.columns
21 else vec.zeros size.columns
22 fi
23 done [0..notes-1])
24 done (keys ranges);
25 };
26
27 {
28 initialiseEM
29 }
30
31