]> git.parisson.com Git - cnaq.git/commitdiff
testacqui.m changed in getdelay.m
authormanu <manu@5fc3e0e6-29bc-4d03-b52b-c088cb822bde>
Wed, 28 Nov 2007 15:15:01 +0000 (15:15 +0000)
committermanu <manu@5fc3e0e6-29bc-4d03-b52b-c088cb822bde>
Wed, 28 Nov 2007 15:15:01 +0000 (15:15 +0000)
comments added in getdelay.m
Plot replaced by histogram in getdelay.m

git-svn-id: http://svn.parisson.org/svn/CNAQ/trunk@123 5fc3e0e6-29bc-4d03-b52b-c088cb822bde

tests/getdelay.asv [new file with mode: 0644]
tests/getdelay.m [new file with mode: 0644]
tests/testacqui.m [deleted file]

diff --git a/tests/getdelay.asv b/tests/getdelay.asv
new file mode 100644 (file)
index 0000000..3e2617e
--- /dev/null
@@ -0,0 +1,33 @@
+function [delai]=getdelay(n)
+%this function allows measuring the lattency of the playrecord process for
+%n generation/acquisition operations
+if nargin < 1, n = 10; end
+
+%signal generation
+f_min=100;
+f_max=20000;
+lt=5;  
+t=0:1/44100:lt;
+sig=0.9*chirp(t,20,lt,20000,'logarithmic');
+len_sig = length(sig);
+
+%playrecord signal
+for it = 1:n
+        pause(0.1)
+    inputbuffer = pa_wavplayrecord(sig',1,[44100],0,[1],[1],1,['asio']);
+    Co=xcorr(inputbuffer',sig');
+    [Y(it),I(it)] = max(Co);
+    delai(it)=I(it)-len_sig;
+       
+end
+
+mfv=mode(delai);
+mfvt =num2str(mfv);
+sprintf('%s','the most frequent delay is ', mfvt,' samples.')
+
+%Plot results
+hist(delai)
+title('delay distribution')
+xlabel('delay')
+
+
diff --git a/tests/getdelay.m b/tests/getdelay.m
new file mode 100644 (file)
index 0000000..3e2617e
--- /dev/null
@@ -0,0 +1,33 @@
+function [delai]=getdelay(n)
+%this function allows measuring the lattency of the playrecord process for
+%n generation/acquisition operations
+if nargin < 1, n = 10; end
+
+%signal generation
+f_min=100;
+f_max=20000;
+lt=5;  
+t=0:1/44100:lt;
+sig=0.9*chirp(t,20,lt,20000,'logarithmic');
+len_sig = length(sig);
+
+%playrecord signal
+for it = 1:n
+        pause(0.1)
+    inputbuffer = pa_wavplayrecord(sig',1,[44100],0,[1],[1],1,['asio']);
+    Co=xcorr(inputbuffer',sig');
+    [Y(it),I(it)] = max(Co);
+    delai(it)=I(it)-len_sig;
+       
+end
+
+mfv=mode(delai);
+mfvt =num2str(mfv);
+sprintf('%s','the most frequent delay is ', mfvt,' samples.')
+
+%Plot results
+hist(delai)
+title('delay distribution')
+xlabel('delay')
+
+
diff --git a/tests/testacqui.m b/tests/testacqui.m
deleted file mode 100644 (file)
index 9f18527..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-function testacqui(n)
-
-if nargin < 1, n = 50; end
-if n == 1, n=2; end
-%signal generation
-f_min=20;
-f_max=20000;
-lt=5;  
-
-t=0:1/44100:lt;
-sig=0.9*chirp(t,20,lt,20000,'logarithmic');
-len_sig = length(sig);
-
-%playrecord signal
-for it = 1:n
-        pause(0.1)
-    inputbuffer = pa_wavplayrecord(sig',1,[44100],0,[1],[1],1,['asio']);
-    Co=xcorr(inputbuffer',sig');
-    [Y(it),I(it)] = max(Co);
-    delai(it)=I(it)-len_sig;
-       
-end
-mfv=mode(delai);
-mfvt =num2str(mfv);
-sprintf('%s','the most frequent delay is ', mfvt,' samples.')
-
-%Plot results
-plot(delai);
-axis([1 n (min(delai)-2) (max(delai)+2)]);
-figure()
-plot(Y);
-axis([1 n min(Y) max(Y)]);
-