From: drowe67 Date: Mon, 14 Sep 2009 06:43:22 +0000 (+0000) Subject: some scripts and samples for blog post part 4 X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=335721c19a6d5dea6d8d067ae69f0140bb3b6cbd;p=freetel-svn-tracking.git some scripts and samples for blog post part 4 git-svn-id: https://svn.code.sf.net/p/freetel/code@62 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2/TODO.txt b/codec2/TODO.txt index 66e62e49..3a55dfc0 100644 --- a/codec2/TODO.txt +++ b/codec2/TODO.txt @@ -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 diff --git a/codec2/octave/plamp.m b/codec2/octave/plamp.m index cdf6176f..e4470699 100644 --- a/codec2/octave/plamp.m +++ b/codec2/octave/plamp.m @@ -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;"); diff --git a/codec2/octave/plphase.m b/codec2/octave/plphase.m index 689615ab..82cf0f26 100644 --- a/codec2/octave/plphase.m +++ b/codec2/octave/plphase.m @@ -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 index 00000000..09a79968 --- /dev/null +++ b/codec2/octave/png.m @@ -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 index 00000000..84f7dfc7 --- /dev/null +++ b/codec2/octave/postfilter.m @@ -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 index 00000000..ac816f9c 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 index 00000000..c192ee02 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 index 00000000..98293b60 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 index 00000000..b0526cbd 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 index 00000000..f0191a26 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 index 00000000..d62d19b2 Binary files /dev/null and b/codec2/wav/morig_speex_8k.wav differ