function generateTalkIntervals(speakSamples) {
    var talkIntervals = []; // startTime, endTime
    var i = 0;
    while (i < speakSamples.length) {
        j = i;

        // traverse the array while samples belong to the same talking interval
        while (j < speakSamples.length - 1 && this.isWithinTalkTimeout(speakSamples[j].timestamp, speakSamples[j+1].timestamp))
        {
            j = j + 1
        }

        // new interval ended. Because each sample is duration millisecond long, we add this to the endTime
        var newTalkInterval = {'startTime':speakSamples[i].timestamp, 'endTime': speakSamples[j].timestamp+speakSamples[j].duration};
        dataLog("start time is: "+newTalkInterval.startTime);
        dataLog("Is it min length?: "+dateToString(newTalkInterval.startTime)+" "+dateToString(newTalkInterval.endTime)+" "+(newTalkInterval.endTime-newTalkInterval.startTime));
        if (this.isMinTalkLength(newTalkInterval)) {
            dataLog("Adding: "+dateToString(newTalkInterval.startTime)+ " "+dateToString(newTalkInterval.endTime));
            talkIntervals.push(newTalkInterval);
        }
        // set i to hold the next startTime
        i = j + 1
    }
    return talkIntervals;
}
// Generates talking intervals using given samples (assumes samples indicate speaking)
Generates talking intervals using given samples (assumes samples indicate speaking)
Generates talking intervals using given samples ( assumes samples indicate speaking )
function generateTalkIntervals(speakSamples) {
    var talkIntervals = []; 
    var i = 0;
    while (i < speakSamples.length) {
        j = i;
        while (j < speakSamples.length - 1 && this.isWithinTalkTimeout(speakSamples[j].timestamp, speakSamples[j+1].timestamp))
        {
            j = j + 1
        }
        var newTalkInterval = {'startTime':speakSamples[i].timestamp, 'endTime': speakSamples[j].timestamp+speakSamples[j].duration};
        dataLog("start time is: "+newTalkInterval.startTime);
        dataLog("Is it min length?: "+dateToString(newTalkInterval.startTime)+" "+dateToString(newTalkInterval.endTime)+" "+(newTalkInterval.endTime-newTalkInterval.startTime));
        if (this.isMinTalkLength(newTalkInterval)) {
            dataLog("Adding: "+dateToString(newTalkInterval.startTime)+ " "+dateToString(newTalkInterval.endTime));
            talkIntervals.push(newTalkInterval);
        }
        i = j + 1
    }
    return talkIntervals;
}
function generateTalkIntervals ( speakSamples ) { var talkIntervals = [ ] ; var i = 0 ; while ( i < speakSamples . length ) { j = i ; while ( j < speakSamples . length - 1 && this . isWithinTalkTimeout ( speakSamples [ j ] . timestamp , speakSamples [ j + 1 ] . timestamp ) ) { j = j + 1 } var newTalkInterval = { 'startTime' : speakSamples [ i ] . timestamp , 'endTime' : speakSamples [ j ] . timestamp + speakSamples [ j ] . duration } ; dataLog ( "start time is: " + newTalkInterval . startTime ) ; dataLog ( "Is it min length?: " + dateToString ( newTalkInterval . startTime ) + " " + dateToString ( newTalkInterval . endTime ) + " " + ( newTalkInterval . endTime - newTalkInterval . startTime ) ) ; if ( this . isMinTalkLength ( newTalkInterval ) ) { dataLog ( "Adding: " + dateToString ( newTalkInterval . startTime ) + " " + dateToString ( newTalkInterval . endTime ) ) ; talkIntervals . push ( newTalkInterval ) ; } i = j + 1 } return talkIntervals ; }
Generates talking intervals using given samples (assumes samples indicate speaking)
Generates talking intervals using given samples ( assumes samples indicate speaking )
// startTime, endTime // traverse the array while samples belong to the same talking interval // new interval ended. Because each sample is duration millisecond long, we add this to the endTime // set i to hold the next startTime