3

I want to draw a diagram like below, but I don't know how to draw an arrow that from one block to two blocks, like the one to source1/source2 and how to draw an arrow from two blocks to one block, like the one from source1/source2. Could someone help me please! enter image description here

This is what I can do to my best:

\tikzstyle{rect} = [draw, rectangle, minimum height = 4em, text width = 6em, text centered]
\tikzstyle{line} = [draw, -latex']

\begin{figure}
    \begin{center}
        \begin{tikzpicture}[node distance = 3cm, auto]
        \node[rect](signal) {Signal};
        \node[rect, right of=signal](STFT) {STFT};
        \node[rect, right of=STFT](sep) {DNN/RNN};
        \node[rect, right of=sep](speech) {$Source_1$};
        \node[rect, below of=speech](music) {$Source_2$};
        \node[rect, below of=sep](mask) {Time Frequencey Masking};
        \node[rect, left of=mask](ISTFT) {ISTFT};
        \node[rect, left of=ISTFT](eval) {Evaluation};

        \path[line] (signal) -- (STFT);
        \path[line] (STFT) -- (sep);
        \path[line] (sep) -- (speech);
        \path[line] (sep) -- (music);
        \path[line] (mask) -- (ISTFT);
        \path[line] (ISTFT) -- (eval);
        \end{tikzpicture}
    \end{center}
\end{figure}
  • Please show us a partial solution you have tried. – Matsmath Jun 2 '16 at 2:45
  • Welcome! If you provide the code for the diagram without the problematic arrows, somebody will be happy to show you how to do the arrows. It isn't really fair to expect people to draw the whole thing from scratch. There are a lot of questions about drawing this kind of diagram, though, so it is puzzling that you've not found anything to help already. – cfr Jun 2 '16 at 2:46
  • 2
    Personally, I don't think the diagram is very clear as it is drawn at all. Why is there an arrow from nowhere to Time Frequency Masking? That doesn't make sense to me. But maybe this is standard notation and nothingness has special symbolic value here. – cfr Jun 2 '16 at 2:51
5

Something like this:

enter image description here

Code:

\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{arrows, chains, fit, positioning, scopes}

\begin{document}
    \begin{tikzpicture}[
            > = angle 90,
node distance = 6mm and 8mm,
   box/.style = {draw, minimum height=10mm, minimum width=27mm,
                 align=center, join=by ->, on chain}, 
         font = \sffamily
                    ] 
{ [start chain = A going right]
\node[on chain] {Signal};
\node[box]      {STFT/log-mel};
\node[box]      {DNN/RNN};
}
{ [start chain = B going left]
\node[box,below=of A-3]      
                {Time Frequency\\ Masking};
\node[box]      {ISTFT};
\node[box]      {Evaluation};             
} 
\node (s1)  [right=of A-3.north east] {Source\textsubscript{1}};
\node (s2)  [right=of A-3.south east] {Source\textsubscript{2}};
% 
\node[draw, dotted, inner sep = 5mm, xshift=1mm, fit=(A-3) (B-1) (s1)] {};
\draw (A-3.east) -- ++ (4mm,0) coordinate (s0);
\draw[->] (s0)  |- (s1);
\draw[->] (s0)  |- (s2);
\draw[->] (A-3 -| s1.east) -- + (4mm,0) |- (B-1);  
    \end{tikzpicture}
\end{document}

Nodes position is determined by use of library chains and scope. Formed are two chains: A and B. Arrows between nodes in chains are drawn by option join=by -> in box style. Arrows, which connect chain A with nodes "Source_1" and "Source_2" are drawn separately. Syntax |- is used in drawing perpendicular lines.

Edit: I notice a spelling error, which is now corrected. It correction I exploit also for slightly changes drawings (all nodes are now the same size).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.