From 8f72913c568fd78875588a69c7ea205bcadaf4ff Mon Sep 17 00:00:00 2001
From: Martin Karlsson <letter2martin@gmail.com>
Date: Thu, 24 Sep 2015 11:21:58 +0200
Subject: [PATCH] update

---
 get_audio_loop.m | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/get_audio_loop.m b/get_audio_loop.m
index 8fc74a0..3f151cf 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
-- 
GitLab