Mercurial > hg > may
view may/vamp/test/test_vamppost.yeti @ 338:0a856c4d5338
Rename YetiLab -> May throughout
author | Chris Cannam |
---|---|
date | Tue, 11 Jun 2013 22:22:25 +0100 |
parents | yetilab/vamp/test/test_vamppost.yeti@4ab709d2c1b0 |
children |
line wrap: on
line source
module may.vamp.test.test_vamppost; vp = load may.vamp.vamppost; { compare } = load may.test.test; untimed n = { timestamp = Untimed (), values = [n] }; timed t n = { timestamp = Time t, values = [n] }; testdata = { output = { sampleType = OneSamplePerStep () }, config = { sampleRate = 1000, stepSize = 100 }, features = [ [], [ untimed 1 ], [ untimed 1, untimed 2 ], [], [ timed 1.1 1, untimed 2, timed 4 3 ] ] }; [ "fillOneSamplePerStep": \( // All features returned within a single process call (i.e. within // a single sub-list of the feature list) should be given the same // timestamp; the timestamp increments according to the config // step size between sub-lists filled = vp.fillTimestamps (testdata with { output = { sampleType = OneSamplePerStep () } }); compare filled [ timed 0.1 1 , timed 0.2 1, timed 0.2 2 , timed 0.4 1, timed 0.4 2, timed 0.4 3 ]; ), "fillFixedSampleRate": \( // "If the output feature's hasTimestamp field is true, the host // should read and use the output feature's timestamp. The host // may round the timestamp according to the sample rate given in // the output descriptor's sampleRate field [...] If // [hasTimestamp] is false, its time will be implicitly calculated // by incrementing the time of the previous feature according to // the [output descriptor's] sample rate". Note that the time is // based on that of the previous feature, not that of the previous // process cycle (as is the case with OneSamplePerStep features). filled = vp.fillTimestamps (testdata with { output = { sampleType = FixedSampleRate 5 } }); compare filled [ timed 0 1 , timed 0.2 1, timed 0.4 2 , timed 1.2 1, timed 1.4 2, timed 4.0 3 ]; ), "fillFixedSampleRate2": \( // As above, but with non-integer output sample rate filled = vp.fillTimestamps (testdata with { output = { sampleType = FixedSampleRate 2.5 } }); compare filled [ timed 0 1 , timed 0.4 1, timed 0.8 2 , timed 1.2 1, timed 1.6 2, timed 4.0 3 ]; ), "fillVariableSampleRate": \( // For VariableSampleRate outputs, the timestamps should always // be left entirely alone by fillTimestamps -- it's an error for // the plugin to return any features without valid timestamps, // but it isn't the job of fillTimestamps to handle that error filled = vp.fillTimestamps (testdata with { output = { sampleType = VariableSampleRate 5 } }); compare filled [ untimed 1 , untimed 1, untimed 2 , timed 1.1 1, untimed 2, timed 4.0 3 ]; ), ] is hash<string, () -> boolean>;