view yeti/em.yeti @ 13:e15bc63cb146

Ranges, EM initialisation
author Chris Cannam
date Fri, 21 Mar 2014 18:12:38 +0000
parents
children a91de434feb8
line wrap: on
line source

module em;

mm = load may.mathmisc;
vec = load may.vector;
mat = load may.matrix;

initialiseEM ranges notes size =
    {
        pitches = // z in the original
            array (map do note:
                map \(mm.random ()) [0..size.columns-1]
            done [0..notes-1]),
        sources =
            mapIntoHash id // u in the original
                do instrument:
                    array (map do note:
                        if note >= ranges[instrument].lowestNote and
                           note <= ranges[instrument].highestNote
                        then vec.ones size.columns
                        else vec.zeros size.columns
                        fi
                    done [0..notes-1])
                done (keys ranges);
    };

{
    initialiseEM
}