diff --git a/get_audio_loop.m b/get_audio_loop.m index 8fc74a09b0fb9b8a7ec59c944a29ffddd564007d..3f151cf35822d102be8c73c906ec2dadb4b0154c 100644 --- a/get_audio_loop.m +++ b/get_audio_loop.m @@ -1,21 +1,31 @@ +figure; - -allAudio = []; +allAudioLeft = []; +allAudioRight = []; lastLastIndex = 0; lastIndex = 0; count = 0; -while count < 10 +while count < 50 p = bass.Audio(); if count == 0 fs = p.Audio.sampleRate; end - pause(1) + pause(0.1) lastIndex = p.Audio.lastFrameIndex; diffIndex = lastIndex - lastLastIndex; - temp = cell2mat(p.Audio.left); - temp = temp(max(end-diffIndex+1,1):end); - allAudio = [allAudio; temp]; + 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 -end \ No newline at end of file + + plot(tempLeft); + set(gca,'ylim',[-2^16/2 2^16/2]) + drawnow + +end