Select Git revision
get_audio_loop.m
Martin Karlsson authored
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()