view yetilab/stream/test/audiofile_reference.yeti @ 222:77c6a81c577f matrix_opaque_immutable

Move block directory -> vector
author Chris Cannam
date Sat, 11 May 2013 15:58:36 +0100
parents 26111c11d8e4
children 8e04d298741b
line wrap: on
line source

module yetilab.stream.test.audiofile_reference;

syn = load yetilab.stream.syntheticstream;
filt = load yetilab.stream.filter;
vec = load yetilab.vector.vector;

pulseChannel rate =
   (pulseFreq = 2;
    pulseWidth = 0.01 * rate;
    generator i =
       (pulseNo = int ((i * pulseFreq) / rate);
        index = (i * pulseFreq) - (rate * pulseNo);
        if index < pulseWidth then
	    s = 1.0 - abs(pulseWidth/2 - index) / (pulseWidth/2);
	    if pulseNo % 2 != 0 then (-s) else s fi
        else 0
        fi);
    syn.generated rate generator);

referenceChannels rate =
   (leftovers rate n =
       (syn.generated rate \(n / 20) :. \(leftovers rate (n+1)));
    syn.sinusoid rate 600 :: pulseChannel rate :: leftovers rate 2);

afReference rate channels =
    filt.multiplexed (take channels (referenceChannels rate));
    
{
    afReference
}