visualise voicing est in time
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 12 Nov 2010 00:49:34 +0000 (00:49 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 12 Nov 2010 00:49:34 +0000 (00:49 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@219 01035d8c-6547-0410-b346-abe4f91aad63

codec2/octave/plvoicing.m [new file with mode: 0644]

diff --git a/codec2/octave/plvoicing.m b/codec2/octave/plvoicing.m
new file mode 100644 (file)
index 0000000..7285d38
--- /dev/null
@@ -0,0 +1,47 @@
+% Copyright David Rowe 2009
+% This program is distributed under the terms of the GNU General Public License 
+% Version 2
+%
+% Plot voicing information from sample and dump files.
+%
+% samfilename is the raw source file, e.g. "../raw/hts1a.raw"
+% samname is the dumpfile prefix, e.g. "../src/hts1a"
+%
+% There is a 160 sample (two frame delay) from the when a sample
+% enters the input buffer until it is at the centre of the analysis window
+
+function plvoicing(samfilename, samname, start_f, end_f, pngname)
+  
+  fs=fopen(samfilename,"rb");
+  s=fread(fs,Inf,"short");
+
+  snr_name = strcat(samname,"_snr.txt");
+  snr = load(snr_name);
+  model_name = strcat(samname,"_model.txt");
+  model = load(model_name);
+
+  figure(1);
+  clf;
+  sp = s((start_f-2)*80:(end_f-2)*80);
+  plot(sp);
+  hold on;
+  vhigh = snr((start_f+1):end_f) > 7;
+  vlow = snr((start_f+1):end_f) > 4;
+  x = 1:(end_f-start_f);
+  plot(x*80,snr((start_f+1):end_f)*1000,';SNRdB x 1000;g+');
+  plot(x*80,-8000 + vhigh*2000,';7dB thresh;g');
+  plot(x*80,-11000 + vlow*2000,';4dB thresh;r');
+  hold off; 
+  grid
+  if (nargin == 5)
+      print(pngname, "-dpng", "-S500,500")
+  endif
+    
+  figure(2)
+  Wo  = model((start_f+1):end_f,1);
+  F0  = Wo*4000/pi;
+  %dF0 = F0(1:length(Wo)-1) - F0(2:length(Wo));
+  %plot(dF0,'+--')
+  %axis([1 length(dF0) -50 50])
+  plot(F0,'+--')
+endfunction