mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-31 15:44:21 +00:00
i've tested, now you can too
This commit is contained in:
1 parent
d3fcfa8245
commit
d67b96af8a
94 files changed
+25305
-2005
No files matched your search
@@ -4,8 +4,16 @@
|
||||
%
|
||||
% Plot ampltiude modelling information from dump files.
|
||||
|
||||
function plamp(samname, f)
|
||||
function plamp(samname, f, samname2)
|
||||
|
||||
% switch some stuff off to unclutter display
|
||||
|
||||
plot_lsp = 0;
|
||||
plot_snr = 0;
|
||||
plot_vsnr = 0;
|
||||
plot_sw = 0;
|
||||
plot_pw = 0;
|
||||
|
||||
sn_name = strcat(samname,"_sn.txt");
|
||||
Sn = load(sn_name);
|
||||
|
||||
@@ -17,6 +25,16 @@ function plamp(samname, f)
|
||||
Sw_ = load(sw__name);
|
||||
endif
|
||||
|
||||
ew_name = strcat(samname,"_ew.txt");
|
||||
if (file_in_path(".",ew_name))
|
||||
Ew = load(ew_name);
|
||||
endif
|
||||
|
||||
rk_name = strcat(samname,"_rk.txt");
|
||||
if (file_in_path(".",rk_name))
|
||||
Rk = load(rk_name);
|
||||
endif
|
||||
|
||||
model_name = strcat(samname,"_model.txt");
|
||||
model = load(model_name);
|
||||
|
||||
@@ -50,12 +68,24 @@ function plamp(samname, f)
|
||||
snr = load(snr_name);
|
||||
endif
|
||||
|
||||
% optional second file, for exploring post filter
|
||||
|
||||
model2q_name = " ";
|
||||
if nargin == 3
|
||||
model2q_name = strcat(samname2,"_qmodel.txt");
|
||||
if file_in_path(".",modelq_name)
|
||||
model2q = load(model2q_name);
|
||||
end
|
||||
end
|
||||
|
||||
Ew_on = 1;
|
||||
k = ' ';
|
||||
do
|
||||
figure(1);
|
||||
clf;
|
||||
% s = [ Sn(2*(f-2)-1,:) Sn(2*(f-2),:) ];
|
||||
s = [ Sn(2*f-1,:) Sn(2*f,:) ];
|
||||
size(s);
|
||||
plot(s);
|
||||
axis([1 length(s) -20000 20000]);
|
||||
|
||||
@@ -66,13 +96,14 @@ function plamp(samname, f)
|
||||
plot((1:L)*Wo*4000/pi, 20*log10(Am),";Am;r");
|
||||
axis([1 4000 -10 80]);
|
||||
hold on;
|
||||
% plot((0:255)*4000/256, Sw(f-2,:),";Sw;");
|
||||
plot((0:255)*4000/256, Sw(f,:),";Sw;");
|
||||
|
||||
if plot_sw
|
||||
plot((0:255)*4000/256, Sw(f,:),";Sw;");
|
||||
end
|
||||
|
||||
if (file_in_path(".",modelq_name))
|
||||
Amq = modelq(f,3:(L+2));
|
||||
plot((1:L)*Wo*4000/pi, 20*log10(Amq),";Amq;g" );
|
||||
if (file_in_path(".",pw_name))
|
||||
if (file_in_path(".",pw_name) && plot_pw)
|
||||
plot((0:255)*4000/256, 10*log10(Pw(f,:)),";Pw;c");
|
||||
endif
|
||||
signal = Am * Am';
|
||||
@@ -82,8 +113,13 @@ function plamp(samname, f)
|
||||
plot((1:L)*Wo*4000/pi, 20*log10(Amq) - 20*log10(Am), Am_err_label);
|
||||
endif
|
||||
|
||||
if (file_in_path(".",snr_name))
|
||||
snr_label = sprintf(";phase SNR %4.2f dB;",snr(f));
|
||||
if file_in_path(".",model2q_name)
|
||||
Amq2 = model2q(f,3:(L+2));
|
||||
plot((1:L)*Wo*4000/pi, 20*log10(Amq2),";Amq2;m" );
|
||||
end
|
||||
|
||||
if (file_in_path(".",snr_name) && plot_vsnr)
|
||||
snr_label = sprintf(";Voicing SNR %4.2f dB;",snr(f));
|
||||
plot(1,1,snr_label);
|
||||
endif
|
||||
|
||||
@@ -96,11 +132,11 @@ function plamp(samname, f)
|
||||
noise = (orig-synth) * (orig-synth)';
|
||||
snr_phase = 10*log10(signal/noise);
|
||||
|
||||
phase_err_label = sprintf(";phase_err SNR %4.2f dB;",snr_phase);
|
||||
plot((1:L)*Wo*4000/pi, 20*log10(orig-synth), phase_err_label);
|
||||
%phase_err_label = sprintf(";phase_err SNR %4.2f dB;",snr_phase);
|
||||
%plot((1:L)*Wo*4000/pi, 20*log10(orig-synth), phase_err_label);
|
||||
endif
|
||||
|
||||
if (file_in_path(".",lsp_name))
|
||||
if (file_in_path(".",lsp_name) && plot_lsp)
|
||||
for l=1:10
|
||||
plot([lsp(f,l)*4000/pi lsp(f,l)*4000/pi], [60 80], 'r');
|
||||
endfor
|
||||
@@ -108,33 +144,21 @@ function plamp(samname, f)
|
||||
|
||||
hold off;
|
||||
|
||||
if (file_in_path(".",phase_name))
|
||||
figure(3);
|
||||
plot((1:L)*Wo*4000/pi, phase(f,1:L), ";phase;");
|
||||
axis;
|
||||
if (file_in_path(".",phase_name_))
|
||||
hold on;
|
||||
plot((1:L)*Wo*4000/pi, phase_(f,1:L), ";phase_;");
|
||||
hold off;
|
||||
endif
|
||||
figure(2);
|
||||
endif
|
||||
|
||||
% autocorrelation function to research voicing est
|
||||
|
||||
%M = length(s);
|
||||
%sw = s .* hanning(M)';
|
||||
%for k=0:159
|
||||
% R(k+1) = sw(1:320-k) * sw(1+k:320)';
|
||||
%endfor
|
||||
%figure(4);
|
||||
%R_label = sprintf(";R(k) %3.2f;",max(R(20:159))/R(1));
|
||||
%plot(R/R(1),R_label);
|
||||
%grid
|
||||
%if (file_in_path(".",phase_name))
|
||||
%figure(3);
|
||||
%plot((1:L)*Wo*4000/pi, phase(f,1:L), ";phase;");
|
||||
%axis;
|
||||
%if (file_in_path(".",phase_name_))
|
||||
%hold on;
|
||||
%plot((1:L)*Wo*4000/pi, phase_(f,1:L), ";phase_;");
|
||||
%hold off;
|
||||
%endif
|
||||
%figure(2);
|
||||
%endif
|
||||
|
||||
% interactive menu
|
||||
|
||||
printf("\rframe: %d menu: n-next b-back p-png q-quit ", f);
|
||||
printf("\rframe: %d menu: n-next b-back p-png q-quit e-toggle Ew", f);
|
||||
fflush(stdout);
|
||||
k = kbhit();
|
||||
if (k == 'n')
|
||||
@@ -143,6 +167,13 @@ function plamp(samname, f)
|
||||
if (k == 'b')
|
||||
f = f - 1;
|
||||
endif
|
||||
if (k == 'e')
|
||||
if (Ew_on == 1)
|
||||
Ew_on = 0;
|
||||
else
|
||||
Ew_on = 1;
|
||||
endif
|
||||
endif
|
||||
|
||||
% optional print to PNG
|
||||
|
||||
@@ -157,7 +188,7 @@ function plamp(samname, f)
|
||||
pngname = sprintf("%s_%d_sw.png",samname,f);
|
||||
print(pngname, '-dpng', "-S500,500")
|
||||
pngname = sprintf("%s_%d_sw_large.png",samname,f);
|
||||
print(pngname, '-dpng', "-S800,600")
|
||||
print(pngname, '-dpng', "-S1200,800")
|
||||
endif
|
||||
|
||||
until (k == 'q')
|
||||
|
||||
Reference in new issue
Block a user