Skip to content
Snippets Groups Projects
Select Git revision
  • ff7f28cd41e5256cd1ae3a78facd0583600d8970
  • master default protected
2 results

get_audio_loop.m

Blame
  • Martin Karlsson's avatar
    Martin Karlsson authored
    ff7f28cd
    History
    get_audio_loop.m 778 B
    
    
    % figure;
    
    allAudioLeft = [];
    allAudioRight = [];
    lastLastIndex = 0;
    lastIndex = 0;
    count = 0;
    while count < 60
        p = bass.Audio();
        if count == 0
            fs = p.Audio.sampleRate;
        end
        pause(0.1)
        lastIndex = p.Audio.lastFrameIndex;
        diffIndex = lastIndex - lastLastIndex;
        tempLeft = cell2mat(p.Audio.left);
        tempLeft = tempLeft(max(end-diffIndex+1,1):end);
        allAudioLeft = [allAudioLeft; tempLeft];
        
        tempRight = cell2mat(p.Audio.right);
        tempRight = tempRight(max(end-diffIndex+1,1):end);
        allAudioRight = [allAudioRight; tempRight];
        
        lastLastIndex = lastIndex;
        count = count+1
    %     plot(tempLeft);
    %     set(gca,'ylim',[-2^16/2 2^16/2])
    %     drawnow
        
    end
    allAudio = [allAudioLeft, allAudioRight];
    
    
    % bass.Stop()