function detectBlink(baseline, currentMedian) {

    // get median and standard deviation for baseline
    let baselineMedian = mathFunctions.getMedian(baseline);
    let standardDeviation = mathFunctions.getStandardDeviation(baseline);

    // run inital setup for blink control
    if (init) {
        // get settings
        settings = blink.getSettings();

        // show Baseline data
        if (settings.debug) {
            console.log("=================Baseline=================");
            console.log("  Baseline size:\t" + baseline.length);
            console.log("  Baseline median:\t" + mathFunctions.getMedian(baseline).toFixed(2));
            console.log("  Variance:\t\t" + mathFunctions.getVariance(baseline).toFixed(2));
            console.log("  Standard deviation:\t" + mathFunctions.getStandardDeviation(baseline).toFixed(2));
            console.log("  median-standardDev*a:\t " + Number(baselineMedian - standardDeviation * settings.threshold).toFixed(2));
            console.log("  Max Value:\t\t" + mathFunctions.getMaxValue(baseline).toFixed(2));
            console.log("  Min Value:\t\t" + mathFunctions.getMinValue(baseline).toFixed(2));
            console.log("==============================================");
        }

        // start socket server
        server.startSocketServer();

        // flash commands in musicplayer
        startFlashCmd();

        init = false;
    }

    // Check if current median contains a blink
    findBlink(currentMedian, baselineMedian, standardDeviation);

}
/**
 * get median and standard deviation for baseline and start Blink Detection, log baseline
 * @params: baseline: Array of last window medians, currentMedian: current median to compare with baseline
 */
get median and standard deviation for baseline and start Blink Detection, log baseline
@params: baseline: Array of last window medians, currentMedian: current median to compare with baseline
get median and standard deviation for baseline and start Blink Detection log baseline @params : baseline : Array of last window medians currentMedian : current median to compare with baseline
function detectBlink(baseline, currentMedian) {
    let baselineMedian = mathFunctions.getMedian(baseline);
    let standardDeviation = mathFunctions.getStandardDeviation(baseline);
    if (init) {
        settings = blink.getSettings();
        if (settings.debug) {
            console.log("=================Baseline=================");
            console.log("  Baseline size:\t" + baseline.length);
            console.log("  Baseline median:\t" + mathFunctions.getMedian(baseline).toFixed(2));
            console.log("  Variance:\t\t" + mathFunctions.getVariance(baseline).toFixed(2));
            console.log("  Standard deviation:\t" + mathFunctions.getStandardDeviation(baseline).toFixed(2));
            console.log("  median-standardDev*a:\t " + Number(baselineMedian - standardDeviation * settings.threshold).toFixed(2));
            console.log("  Max Value:\t\t" + mathFunctions.getMaxValue(baseline).toFixed(2));
            console.log("  Min Value:\t\t" + mathFunctions.getMinValue(baseline).toFixed(2));
            console.log("==============================================");
        }
        server.startSocketServer();
        startFlashCmd();
        init = false;
    }
    findBlink(currentMedian, baselineMedian, standardDeviation);
}
function detectBlink ( baseline , currentMedian ) { let baselineMedian = mathFunctions . getMedian ( baseline ) ; let standardDeviation = mathFunctions . getStandardDeviation ( baseline ) ; if ( init ) { settings = blink . getSettings ( ) ; if ( settings . debug ) { console . log ( "=================Baseline=================" ) ; console . log ( "  Baseline size:\t" + baseline . length ) ; console . log ( "  Baseline median:\t" + mathFunctions . getMedian ( baseline ) . toFixed ( 2 ) ) ; console . log ( "  Variance:\t\t" + mathFunctions . getVariance ( baseline ) . toFixed ( 2 ) ) ; console . log ( "  Standard deviation:\t" + mathFunctions . getStandardDeviation ( baseline ) . toFixed ( 2 ) ) ; console . log ( "  median-standardDev*a:\t " + Number ( baselineMedian - standardDeviation * settings . threshold ) . toFixed ( 2 ) ) ; console . log ( "  Max Value:\t\t" + mathFunctions . getMaxValue ( baseline ) . toFixed ( 2 ) ) ; console . log ( "  Min Value:\t\t" + mathFunctions . getMinValue ( baseline ) . toFixed ( 2 ) ) ; console . log ( "==============================================" ) ; } server . startSocketServer ( ) ; startFlashCmd ( ) ; init = false ; } findBlink ( currentMedian , baselineMedian , standardDeviation ) ; }
get median and standard deviation for baseline and start Blink Detection, log baseline
 @params: baseline: Array of last window medians, currentMedian: current median to compare with baseline
get median and standard deviation for baseline and start Blink Detection log baseline @params : baseline : Array of last window medians currentMedian : current median to compare with baseline
// get median and standard deviation for baseline // run inital setup for blink control // get settings // show Baseline data // start socket server // flash commands in musicplayer // Check if current median contains a blink