Debian Codegraph @

texmf-dist/doc/latex/vocaltract/vtMAINVisual.m

raw
1 function vtMAINVisual(VocalTractVecToTime,SWPDForBMP)
2
3 if nargin < 2
4 SWPDForBMP = 'BMP'; % PDF, BMP
5 %========================================================================================
6 % 1. Jaw Position 4. Tongue Apex 7. Larynx Height 10. Nasal Cavity
7 % 2. Tongue Position 5. Lip Aperture 8. Glottal Aperture 11. Phoneme Label
8 % 3. Tongue Shape 6. Lip Protrusion 9. Glottal Frequency
9 %========================================================================================
10 % 1 2 3 4 5 6 7 8 9 10 11
11 % JW TP TS TA LA LP LH GA FX NS
12 % 3 3 3 3 3 3 3 3 3 3 Max
13 % 0 0 0 0 0 0 0 0 0 0 Relax
14 % -3 3 -3 -3 -3 -3 -3 -3 -3 -3 Min
15 %========================================================================================
16 VocalTractVecToTime = ...
17 {[ 0.5, -2, 1 , -2 , 1, -1 , 0, 0, 0, 0], 'i' ;
18 [ 0.5, -2, 1 , -2 , 0, 2 , 0, 0, 0, 0], 'y(\"u)' ;
19 [-1 , -1, 1 , -2 , 1, -0.5, 0, 0, 0, 0], 'e' };
20 end
21
22 % if you want a BMP Figure (not a PDF Animation) use first line
23 if strcmp(SWPDForBMP,'BMP') && size(VocalTractVecToTime,1)>1
24 VocalTractVecToTime = VocalTractVecToTime(1,1:2);
25 end
26
27
28 NumberOfTimeFrames = size(VocalTractVecToTime,1);
29 VocalTractVecToTimeSTR = Mat2StrCustom(VocalTractVecToTime);
30
31 %---------------- Add some commands before and after ---------------
32 LatexDefCommandsOfCordsPre = ['\newarray\SpeakVec' ...
33 '\readarray{SpeakVec}{'];
34
35 LatexDefCommandsOfCordsPost = ['}'...
36 ' \dataheight=11' ...
37 ' \def\Nframes{' num2str(NumberOfTimeFrames+1) '}'];
38
39 % %------- Create the Coordinates file ----------------
40 fid = fopen('vtLatex_TimeParams.tex', 'w');
41
42 fwrite(fid,sprintf('%s %s %s',LatexDefCommandsOfCordsPre,...
43 VocalTractVecToTimeSTR,...
44 LatexDefCommandsOfCordsPost),'char');
45 fclose(fid);
46
47 %---------------- START the Compilers -----------------------------
48
49 if strcmp(SWPDForBMP,'BMP')
50 %-- tex2dvi
51 !latex -interaction=nonstopmode vtLatex_FigureLauncher.tex
52 %--- view dvi
53 %!"C:/Program Files/MiKTeX 2.8/miktex/bin/yap.exe" vtLatex_FigureLauncher.dvi
54 %--- dvi2ps
55 !dvips -o vtLatex_FigureLauncher.ps vtLatex_FigureLauncher.dvi
56
57 %--- ps2bmp
58 strpwd = lower(pwd);
59 eval(['!i_view32.exe "' strpwd '\vtLatex_FigureLauncher.ps"' ...
60 ' /crop=(130,250,550,600) /convert="' ...
61 strpwd '\vtLatex_FigureLauncher.bmp" ']);
62
63 %--- read and show
64 a = imread('vtLatex_FigureLauncher.bmp');
65 imshow(a);
66 elseif strcmp(SWPDForBMP,'PDF')
67 %-- tex2dvi
68 !latex -interaction=nonstopmode vtLatex_AnimationLauncher.tex
69 %--- view dvi
70 %!"C:/Program Files/MiKTeX 2.8/miktex/bin/yap.exe" vtLatex_AnimationLauncher.dvi
71 %--- dvi2ps
72 !dvips -o vtLatex_AnimationLauncher.ps vtLatex_AnimationLauncher.dvi
73 %---- ps2pdf
74 !ps2pdf vtLatex_AnimationLauncher.ps
75 %--- view pdf
76 !AcroRd32.exe vtLatex_AnimationLauncher.pdf
77 end
78
79
80
81
82 %===================================================================
83 % Matrix to a String Ordering with & intervening
84 %===================================================================
85 function STR = Mat2StrCustom(Matr)
86
87 R = size(Matr,1);
88 C = length(Matr{1,1});
89
90 STR = [];
91 for IndRow= 1:R
92 for IndCol = 1:C
93 STR = [STR num2str(Matr{IndRow,1}(IndCol)) '&'];
94 end
95 STR = [STR Matr{IndRow,2} '&'];
96 end
97 STR = STR(1:end-1);
98
99