1

I have already drawn a block diagram, but I would like to add some special symbols/figures such as a markov model, some dashed lines, list of characters in a specific place, and the waveform as shown in the picture below.

enter image description here

Here also goes the original picture from which I got my inspiration from. I would like to have a proportional size of the new elements as the original one (they are not scaled since I did not know how to do so) Thanks in advance in any help can be given! enter image description here

My code so far:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,arrows,calc,positioning,shapes, shadows}
\usetikzlibrary{tikzmark,calc,decorations.pathreplacing}

\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}[node distance=1.5cm]

\node (speech) {Speech};
\node [block, right of=speech, xshift=1.2cm] (feat) {Feature extraction}; 
\node [block, right of=feat,  xshift=3cm] (dec) {Decoder};
\node [block, below of=dec, xshift=2.2cm, yshift=-0.5cm] (LM) {Language model}; 
\node at (LM.north) [above, text width=3cm, align=center] {Sentence level matcher};
\node [block, left of=LM, xshift=-2.2cm] (lex) {Lexicon}; 
\node at (lex.north) [above, text width=3cm, align=center] {Word-level matcher};
\coordinate (RSmid) at ($(LM.north east)!0.5!(lex.north west)$);
\coordinate (RSmid2) at ($(LM.south east)!0.5!(lex.south west)$);
\node [block, above of=dec, yshift=0.5cm] (acous) {Acoustic Model};
\node [right of= dec, xshift=3.1cm](txt) {Text};

\path [l] (feat) -- (dec);
\path [l] (lex) -| ([xshift=-1cm]dec);
\draw (acous) edge [auto=left] node {Phone-matcher level} (dec);
\path [l] (LM) -| ([xshift=1cm]dec);
\path [l] (dec) -- (txt);
\path [l] (speech.east) -- (feat);
\end{tikzpicture}
\end{figure}

\end{document}

1 Answers1

2

Unfortunately, in your otherwise nice MWE the definitions of block and l were missing, so I had to guess them. In what follows, I present two ways of placing these things: scopes and multipart nodes.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,arrows,calc,positioning,shapes, shadows}
\usetikzlibrary{tikzmark,calc,decorations.pathreplacing,shapes.multipart}
\tikzset{block/.style={draw},
l/.style={draw,-}} % <- I made this up
\tikzset{boxed/.style={path picture={
\coordinate (ll) at (path picture bounding box.south west);
\coordinate (ur) at (path picture bounding box.north east);
},% inspired by https://tex.stackexchange.com/a/423952/121799
}}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}[node distance=1.5cm,font=\sffamily]
\node (speech) {Speech};
\node [block, right of=speech, xshift=1.2cm] (feat) {Feature extraction}; 
\node [block, right of=feat,  xshift=3cm] (dec) {Decoder};
\node [block, below of=dec, xshift=2.2cm, yshift=-0.5cm] (LM) {Language model}; 
\node at (LM.north) [above, text width=3cm, align=center] {Sentence level matcher};
\node [block, left of=LM, xshift=-2.2cm] (lex) {Lexicon}; 
\node at (lex.north) [above, text width=3cm, align=center] {Word-level\\ matcher};
\coordinate (RSmid) at ($(LM.north east)!0.5!(lex.north west)$);
\coordinate (RSmid2) at ($(LM.south east)!0.5!(lex.south west)$);
\node [block, above of=dec, yshift=0.5cm] (acous) {Acoustic Model};
\node [right of= dec, xshift=3.1cm](txt) {Text};
\path [l] (feat) -- (dec);
\path [l] (lex) -| ([xshift=-1cm]dec);
\draw (acous) edge [auto=left] node {Phone-matcher level} (dec);
\path [l] (LM) -| ([xshift=1cm]dec);
\path [l] (dec) -- (txt);
\path [l] (speech.east) -- (feat);
% first example: move a scope to a node
\begin{scope}[shift=(acous)]
\foreach \X [count=\Y] in {-1,0,1}
{
\node[circle,draw,minimum width=0.6cm] (c\Y) at (\X,1){};
\draw[-latex] (c\Y.north west) to[out=120,in=60,looseness=3]  (c\Y.north east);
}
\draw (1.5,0.5)-- ++(0.2,0) -- ++(0,1.1) coordinate[midway,right]
(x1) -- ++(-0.2,0) ;
\draw[-latex] (x1) -- ++(0.2,0) node[right] {/b/};
\end{scope}
% second example: use multipart nodes
\node[left=0.5cm of lex,rectangle split,rectangle split parts=6,rectangle split
part align=left] (lexr) 
{/b/
\nodepart{two}
/d/
\nodepart{three}
.
\nodepart{four}
.
\nodepart{five}
.
\nodepart{six}
/ch/
};
\draw (lexr.north east) -- +(-0.2,0)  (lexr.south east) -- +(-0.2,0)
(lexr.north east) -- (lexr.south east) coordinate[midway] (x2);
\draw[-latex] (x2) -- ++(0.2,0);
%
\node[right=0.5cm of LM,rectangle split,rectangle split parts=6,rectangle split
part align=left] (LMr) 
{/m o/
\nodepart{two}
/t o/
\nodepart{three}
.
\nodepart{four}
.
\nodepart{five}
.
\nodepart{six}
/ch/
};
\draw (LMr.north west) -- +(0.2,0)  (LMr.south west) -- +(0.2,0)
(LMr.north west) -- (LMr.south west) coordinate[midway] (x3);
\draw[-latex] (x3) -- ++(-0.2,0);
%
\begin{scope}[shift=(speech)]
\draw[boxed] plot[variable=\x,samples=100,domain=-1:1]
({\x},{1.3+sin(deg(\x)*(\x-2)*5)*cos(deg(2*\x))}); 
\end{scope}
\draw (ur|-speech.south) -- ++(0,0.2) (ll|-speech.south) -- ++(0,0.2)
(ur|-speech.south) -- (ll|-speech.south) coordinate[midway] (x4);
\draw[-latex] (x4) -- ++(0,-0.2);
%
\end{tikzpicture}
\end{figure}
\end{document}

enter image description here

I marked the positions in which I made changes or added stuff. Please let me know if you have questions.

  • Hey marmot I just simply owe you one! you answer my last two question! I am sorry for the missing information, it may happended when I copied/paste the code. Anyway, the code perfectly worked for me and the solution is clear! have a nice day ;) – little_mice Apr 24 '18 at 05:14