some scripts and samples for blog post part 4
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 14 Sep 2009 06:43:22 +0000 (06:43 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 14 Sep 2009 06:43:22 +0000 (06:43 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@62 01035d8c-6547-0410-b346-abe4f91aad63

codec2/TODO.txt
codec2/octave/plamp.m
codec2/octave/plphase.m
codec2/octave/png.m [new file with mode: 0644]
codec2/octave/postfilter.m [new file with mode: 0644]
codec2/wav/forig_speex_8k.wav [new file with mode: 0644]
codec2/wav/hts1a_speex_8k.wav [new file with mode: 0644]
codec2/wav/hts2a_speex_8k.wav [new file with mode: 0644]
codec2/wav/mmt1.wav [new file with mode: 0644]
codec2/wav/mmt1_speex_8k.wav [new file with mode: 0644]
codec2/wav/morig_speex_8k.wav [new file with mode: 0644]

index 66e62e49272ed0a81f388eb705a7d6af06067775..3a55dfc0ce78d192f1379cdbd69e4bfb8ffb1a3f 100644 (file)
@@ -2,19 +2,21 @@ TODO for codec2
 ---------------
 
 [ ] Important Open Issues
-    [ ] Why zero phase model doesn't work for mmt1
-    [ ] residual noise on zero phase model
+    [X] Why zero phase model doesn't work for mmt1
+        + error in LPC window and accidental random phase component and
+          effect of background noise on interformant harmonics
+    [X] residual noise on zero phase model
         + "navy" on hts1a, "frog" on morig
         + perhaps due to mis-alignment of phases at frame boundaries?
         + or possibly pitch errors
         + need a way to research this
-    [ ] Pitch errors on mmt1, morig
+    [X] Pitch errors on mmt1, morig
         + we may need a tracker
         + suggest manually step through each file, check for
           pitch errors, design tracker and check again
         + or develop manual pitch tracks and check estimator
           with tracker against these.
-    [ ] removal of LPC modelling errors for males
+    [X] removal of LPC modelling errors for males
         + first few haromic energies (e.g. mmt1, hts1a)  get raised
     [ ] good quality LSP quantisation of {Am}
     [ ] conversion to 20ms frames
@@ -37,7 +39,7 @@ TODO for codec2
 
     [ ] Go through papers referenced in thesis and credit various
         techniques to papers.
-      + sure there was somthing about zero phase synthesis is those papers
+      + sure there was something about zero phase synthesis is those papers
 
     [ ] voicing errors can be clearly seen in synthesised speech using pl2.m
 
index cdf6176ff99318da572c87ec316ec52d881a5e41..e4470699fc47018c490bce9a4f7346aea6729edb 100644 (file)
@@ -50,6 +50,7 @@ function plamp(samname, f)
     snr = load(snr_name);
   endif
 
+  k = ' ';
   do 
     figure(1);
     clg;
@@ -105,6 +106,11 @@ function plamp(samname, f)
 
     hold off;
 
+    if (k == 'p')
+       pngname = sprintf("%s_%d_sn_",samname,f)
+       png(pngname);
+    endif
+
     if (file_in_path(".",phase_name))
       figure(3);
       plot((1:L)*Wo*4000/pi, phase(f,1:L), ";phase;");
index 689615ab483b282c58cc278f045efccfa4c8a4fb..82cf0f26c048e253ea28f4978da774088cc539cd 100644 (file)
@@ -46,6 +46,7 @@ function plphase(samname, f)
     sn_  = fread(fs_,Inf,"short");
   endif
 
+  k = ' ';
   do 
     figure(1);
     clg;
@@ -53,6 +54,10 @@ function plphase(samname, f)
     plot(s);
     grid;
     axis([1 length(s) -20000 20000]);
+    if (k == 'p')
+       pngname = sprintf("%s_%d_sn",samname,f);
+       png(pngname);
+    endif
 
     figure(2);
     Wo = model(f,1);
@@ -87,6 +92,10 @@ function plphase(samname, f)
     endif
 
     hold off;
+    if (k == 'p')
+       pngname = sprintf("%s_%d_sw",samname,f);
+       png(pngname);
+    endif
 
     if (file_in_path(".",phase_name))
       figure(3);
@@ -98,6 +107,10 @@ function plphase(samname, f)
        grid
        hold off;
       endif
+      if (k == 'p')
+        pngname = sprintf("%s_%d_phase",samname,f);
+        png(pngname);
+      endif
     endif
 
     % synthesised speech 
@@ -107,6 +120,10 @@ function plphase(samname, f)
       s_ = sn_((f-3)*80+1:(f+1)*80);
       plot(s_);
       axis([1 length(s_) -20000 20000]);
+      if (k == 'p')
+        pngname = sprintf("%s_%d_sn_",samname,f)
+        png(pngname);
+      endif
     endif
 
     if (file_in_path(".",ak_name))
@@ -122,9 +139,16 @@ function plphase(samname, f)
       subplot(212);
       plot(angle(H(1:4000))*180/pi,";LPC phase spec;");
       grid;
+      if (k == 'p')
+        % stops multimode errors from gnuplot, I know not why...
+        figure(2);
+        figure(5);
+
+        pngname = sprintf("%s_%d_lpc",samname,f);
+        png(pngname);
+      endif
     endif
 
-    hold off;
 
     % autocorrelation function to research voicing est
     
@@ -155,26 +179,8 @@ function plphase(samname, f)
     % optional print to PNG
 
     if (k == 'p')
-    
-      pngname = sprintf("%s_%d",samname,f);
-
-      % small image
-
-      __gnuplot_set__ terminal png size 420,300
-      ss = sprintf("__gnuplot_set__ output \"%s.png\"", pngname);
-      eval(ss)
-      replot;
-
-      % larger image
-
-      __gnuplot_set__ terminal png size 800,600
-      ss = sprintf("__gnuplot_set__ output \"%s_large.png\"", pngname);
-      eval(ss)
-      replot;
-
-      % for some reason I need this to stop large plot getting wiped
-      __gnuplot_set__ output "/dev/null"
-
+       pngname = sprintf("%s_%d",samname,f);
+       png(pngname);
     endif
 
   until (k == 'q')
diff --git a/codec2/octave/png.m b/codec2/octave/png.m
new file mode 100644 (file)
index 0000000..09a7996
--- /dev/null
@@ -0,0 +1,25 @@
+% Copyright David Rowe 2009
+% This program is distributed under the terms of the GNU General Public License 
+% Version 2
+%
+% Replot current plot as a png, generates small and large versions
+
+function png(pngname)
+     % small image
+
+     __gnuplot_set__ terminal png size 420,300
+     ss = sprintf("__gnuplot_set__ output \"%s.png\"", pngname);
+     eval(ss)
+     replot;
+
+     % larger image
+
+     __gnuplot_set__ terminal png size 800,600
+     ss = sprintf("__gnuplot_set__ output \"%s_large.png\"", pngname);
+     eval(ss)
+     replot;
+
+     % for some reason I need this to stop large plot getting wiped
+     __gnuplot_set__ output "/dev/null"
+
+endfunction
diff --git a/codec2/octave/postfilter.m b/codec2/octave/postfilter.m
new file mode 100644 (file)
index 0000000..84f7dfc
--- /dev/null
@@ -0,0 +1,24 @@
+% Copyright David Rowe 2009
+% This program is distributed under the terms of the GNU General Public License 
+% Version 2
+%
+% Plot postfilter doing its thing
+
+function postfilter(samname)    
+    p = load(samname);
+    figure(1);
+    plot(p(:,1),";energy;");
+    hold on;
+    plot(p(:,2),";bg_est;");
+    hold off;
+    grid;
+    pngname=sprintf("%s_postfilter_1", samname);
+    png(pngname);
+
+    figure(2);
+    plot(p(:,3),";% unvoiced;");
+    grid;    
+    pngname=sprintf("%s_postfilter_2", samname);
+    png(pngname);
+endfunction
+  
diff --git a/codec2/wav/forig_speex_8k.wav b/codec2/wav/forig_speex_8k.wav
new file mode 100644 (file)
index 0000000..ac816f9
Binary files /dev/null and b/codec2/wav/forig_speex_8k.wav differ
diff --git a/codec2/wav/hts1a_speex_8k.wav b/codec2/wav/hts1a_speex_8k.wav
new file mode 100644 (file)
index 0000000..c192ee0
Binary files /dev/null and b/codec2/wav/hts1a_speex_8k.wav differ
diff --git a/codec2/wav/hts2a_speex_8k.wav b/codec2/wav/hts2a_speex_8k.wav
new file mode 100644 (file)
index 0000000..98293b6
Binary files /dev/null and b/codec2/wav/hts2a_speex_8k.wav differ
diff --git a/codec2/wav/mmt1.wav b/codec2/wav/mmt1.wav
new file mode 100644 (file)
index 0000000..b0526cb
Binary files /dev/null and b/codec2/wav/mmt1.wav differ
diff --git a/codec2/wav/mmt1_speex_8k.wav b/codec2/wav/mmt1_speex_8k.wav
new file mode 100644 (file)
index 0000000..f0191a2
Binary files /dev/null and b/codec2/wav/mmt1_speex_8k.wav differ
diff --git a/codec2/wav/morig_speex_8k.wav b/codec2/wav/morig_speex_8k.wav
new file mode 100644 (file)
index 0000000..d62d19b
Binary files /dev/null and b/codec2/wav/morig_speex_8k.wav differ