生成尤克里里和弦图

生成尤克里里和弦图

我想为我的尤克里里琴歌本生成一个和弦备忘单。(用乳胶制作:样本和弦

但是我找到的都是针对吉他和弦的软件包,太复杂了,不适合我。

您对如何实现这一点有什么想法吗?

答案1

编辑:这是\drawukulelechord使用 TikZ 的更好的宏。

  • \drawukulelechord宏绘制了尤克里里琴弦。其强制参数是四个数字的列表(代表四根琴弦):-1(未弹奏琴弦)、0(打开琴弦)、1 及以上(此琴弦的手指位置)。可选参数可用于更改音阶(默认值:x=2exy=2ex)。

  • \defineukulelechord宏允许关联一个名称(第一个参数)和一个要使用的列表\drawukulelechord(第二个参数)。

  • \ukulelechord宏绘制一个命名的尤克里里和弦(由 预定义\defineukulelechord)。

您可以取消注释或者注释该行以% opened string明确绘制或不绘制打开的字符串。

在此处输入图片描述

\documentclass{standalone}
\usepackage{etoolbox}
\usepackage{tikz}
\newcommand\drawukulelechord[2][]{%
  \edef\chord{#2}%
  \begin{tikzpicture}[x=2ex,y=2ex,line cap=round,line width=.4pt,
    baseline=(current bounding box.center),#1]
    \draw[line width=.6pt] (1,0) -- (4,0);
    \foreach \d in {1,...,4}{\draw (1,-\d) -- (4,-\d);}
    \foreach \d[count=\p] in \chord {
      \draw (\p,0) -- (\p,-4.5);
      \ifdefstring{\d}{-1}{
        \draw (\p,.25) +(-.125,-.125) -- +(.125,.125)
        +(-.125,.125) -- +(.125,-.125);
      }{
        \ifdefstring{\d}{0}{
          \draw (\p,.25) circle(.125); % opened string
        }{
          \fill (\p,.5-1*\d) circle(.25);
        }
      }
    }
    \path[use as bounding box] (0.5,.5) rectangle (4.5,-5);
  \end{tikzpicture}%
}
\makeatletter
\newcommand\defineukulelechord[2]{%
  \csdef{@ukulelechord@#1}{\drawukulelechord{#2}}%
}
\newcommand\ukulelechord[1]{%
  \ifcsdef{@ukulelechord@#1}{%
    \csuse{@ukulelechord@#1}%
  }{%
    \GenericError{}{Undefined ukulele chord '#1'}{}{}% 
  }%
}
\makeatother

\defineukulelechord{A maj}{2,1,0,0}
\defineukulelechord{A 6}{2,1,2,0}
\defineukulelechord{G sharp maj}{5,3,4,3}
\defineukulelechord{A flat maj}{5,3,4,3}
\defineukulelechord{G sharp 6}{1,3,1,3}

\begin{document}
\begin{tabular}{rcc}
                     & maj                         & 6                        \\
  A                  & \ukulelechord{A maj}        & \ukulelechord{A 6}     \\
  G$\sharp$/A$\flat$ & \ukulelechord{G sharp maj}  & \ukulelechord{G sharp 6} \\
  Test               & \drawukulelechord{-1,0,1,2} & \drawukulelechord{2,-1,-1,-1}
\end{tabular}
\end{document}

答案2

包裹guitarchordschemes可用于此目的 – 至少在 v0.7 中。从该版本开始,它允许设置字符串编号和旋转方案。

在下面的例子中,我还使用包chords中的库leadsheets来排版和弦名称。这只是为了方便,并不是示例的必要部分。

在此处输入图片描述

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[margin=2cm]{geometry}

\usepackage{guitarchordschemes}
% the `chords' library of the leadsheets package provides the convenient
% \writechord macro; we don't any other functionality  of said package so we
% use the `chords' option:
\usepackage[chords]{leadsheets}

\usepackage{array}

% guitarchordschemes setup:
\setchordscheme{
  strings = 4 ,
  chord-frets = 5 ,
  tuning = {,,,} ,
  rotate = -90 ,
  x-unit = 1.333mm , y-unit = 2mm ,
  finger-radius = .25 ,
  line-width = .6pt ,
  restrict-bounding-box
}

\begin{document}

\begin{tabular}{l*{13}{c}}
  & ma & 6 & 7 & 9 & maj7 & mi & mi6 & mi7 & mi9 & sus2 & sus4 & aug & dim \\
  \writechord{A} &
  \chordscheme[ finger = {2/4,1/3} ] &
  \chordscheme[ finger = {2/4,1/3,2/2} ] &
  \chordscheme[ finger = {1/3} ] &
  \chordscheme[ finger = {1/3,2/1} ] &
  \chordscheme[ finger = {1/4,1/3} ] &
  \chordscheme[ finger = {2/4} ] &
  \chordscheme[ finger = {2/4,2/2} ] &
  \chordscheme &
  \chordscheme[ finger = {2/4,2/1} ] &
  \chordscheme[ finger = {2/4,4/3,5/2,2/1} ] &
  \chordscheme[ finger = {2/4,2/3} ] &
  \chordscheme[ finger = {2/4,1/3,1/2} ] &
  \chordscheme[ finger = {2/4,3/3,2/2,3/1} ] \\
  \writechord{A#}\slash\writechord{Bb} &
  \chordscheme[ finger = {3/4,2/3,1/2,1/1} ] &
  \chordscheme[ finger = {2/3,1/2,1/1} ] &
  \chordscheme[ finger = {1/4,2/3,1/2,1/1} ] &
  \chordscheme[ finger = {1/4,2/3,1/2,3/1} ] &
  \chordscheme[ finger = {3/4,2/3,1/2} ] &
  \chordscheme[ finger = {3/4,1/3,1/2,1/1} ] &
  \chordscheme[ finger = {3/4,1/3,3/2,1/1} ] &
  \chordscheme[ finger = {1/4,1/3,1/2,1/1} ] &
  \chordscheme[ finger = {3/4,1/3,1/2,3/1} ] &
  \chordscheme[ finger = {3/4,1/2,1/1} ] &
  \chordscheme[ finger = {3/4,3/3,1/2,1/1} ] &
  \chordscheme[ finger = {3/4,2/3,2/2,1/1} ] &
  \chordscheme[ finger = {1/3,1/1} ] \\
  \writechord{B} &
  \chordscheme[ finger = {4/4,3/3,2/2,2/1} ] &
  \chordscheme[ finger = {1/4,3/3,2/2,2/1} ] &
  \chordscheme[ finger = {2/4,3/3,2/2,2/1} ] &
  \chordscheme[ finger = {2/4,3/3,2/2,4/1} ] &
  \chordscheme[ finger = {4/4,3/3,2/2,1/1} ] &
  \chordscheme[ finger = {4/4,2/3,2/2,2/1} ] &
  \chordscheme[ finger = {1/4,2/3,2/2,2/1} ] &
  \chordscheme[ finger = {2/4,2/3,2/2,2/1} ] &
  \chordscheme[ finger = {4/4,2/3,2/2,4/1} ] &
  \chordscheme[ finger = {4/4,1/3,2/2,2/1} ] &
  \chordscheme[ finger = {4/4,4/3,2/2,2/1} ] &
  \chordscheme[ finger = {3/3,3/2,2/1} ] &
  \chordscheme[ finger = {1/4,2/3,1/2,2/1} ] \\
  \writechord{C} &
  \chordscheme[ finger = {3/1} ] &
  \chordscheme &
  \chordscheme[ finger = {1/1} ] &
  \chordscheme[ finger = {2/3,1/1} ] &
  \chordscheme[ finger = {2/1} ] &
  \chordscheme[ finger = {3/3,3/2,3/1} ] &
  \chordscheme[ finger = {3/3,3/2} ] &
  \chordscheme[ finger = {3/4,3/3,3/2,3/1} ] &
  \chordscheme[ finger = {5/4,3/3,3/2,5/1} ] &
  \chordscheme[ finger = {2/3,3/2,3/1} ] &
  \chordscheme[ finger = {1/2,3/1} ] &
  \chordscheme[ finger = {1/4,3/1} ] &
  \chordscheme[ finger = {2/4,3/3,2/2,3/1} ] \\
  \writechord{C#}\slash\writechord{Db} &
  \chordscheme[ finger = {1/4,1/3,1/2,4/1} ] &
  \chordscheme[ finger = {1/4,1/3,1/2,1/1} ] &
  \chordscheme[ finger = {1/4,1/3,1/2,2/1} ] &
  \chordscheme[ finger = {1/4,3/3,1/2,2/1} ] &
  \chordscheme[ finger = {1/4,1/3,1/2,3/1} ] &
  \chordscheme[ finger = {5/4,3/3,3/2,3/1} ] &
  \chordscheme[ finger = {1/4,4/3,4/2,1/1} ] &
  \chordscheme[ finger = {1/4,4/3,4/2,2/1} ] &
  \chordscheme[ finger = {1/4,3/3,4/1} ] &
  \chordscheme[ finger = {1/4,3/3,4/2,4/1} ] &
  \chordscheme[ finger = {1/4,1/3,2/2,4/1} ] &
  \chordscheme[ finger = {2/4,1/3,1/2} ] &
  \chordscheme[ finger = {1/3,1/1} ] \\
  \writechord{D} &
  \chordscheme[ finger = {2/4,2/3,2/2} ] &
  \chordscheme[ finger = {2/4,2/3,2/2,2/1} ] &
  \chordscheme[ finger = {2/4,2/3,2/2,3/1} ] &
  \chordscheme[ finger = {2/4,4/3,2/2,3/1} ] &
  \chordscheme[ finger = {2/4,2/3,2/2,4/1} ] &
  \chordscheme[ finger = {2/4,2/3,1/2} ] &
  \chordscheme[ finger = {2/4,2/3,1/2,2/1} ] &
  \chordscheme[ finger = {2/4,2/3,1/2,3/1} ] &
  \chordscheme[ finger = {2/4,4/3,1/2,5/1} ] &
  \chordscheme[ finger = {2/4,2/3} ] &
  \chordscheme[ finger = {2/3,3/2} ] &
  \chordscheme[ finger = {3/4,2/3,2/2,1/1} ] &
  \chordscheme[ finger = {1/4,2/3,1/2,2/1} ] \\
  \writechord{D#}\slash\writechord{Eb} &
  \chordscheme[ finger = {3/3,3/2,1/1} ] &
  \chordscheme[ finger = {3/4,3/3,3/2,3/1} ] &
  \chordscheme[ finger = {3/4,3/3,3/2,4/1} ] &
  \chordscheme[ finger = {1/3,1/2,1/1} ] &
  \chordscheme[ finger = {3/4,3/3,3/2,5/1} ] &
  \chordscheme[ finger = {3/4,3/3,2/2,1/1} ] &
  \chordscheme[ finger = {3/4,2/2,1/1} ] &
  \chordscheme[ finger = {3/4,1/3,2/2,1/1} ] &
  \setchordscheme{ chord-frets = 6 }\chordscheme[ finger = {3/4,5/3,2/2,6/1} ] &
  \chordscheme[ finger = {3/4,3/3,1/2,1/1} ] &
  \chordscheme[ finger = {1/4,3/3,4/2,1/1} ] &
  \chordscheme[ finger = {3/3,3/2,2/1} ] &
  \chordscheme[ finger = {2/4,3/3,2/2,3/1} ] \\
  \writechord{E} &
  \chordscheme[ finger = {4/4,4/3,4/2,2/1} ] &
  \chordscheme[ finger = {1/4,1/3,2/1} ] &
  \chordscheme[ finger = {1/4,2/3,2/1} ] &
  \chordscheme[ finger = {1/4,2/3,2/2,2/1} ] &
  \chordscheme[ finger = {1/4,3/3,2/1} ] &
  \chordscheme[ finger = {4/3,3/2,2/1} ] &
  \chordscheme[ finger = {4/4,4/3,3/2,4/1} ] &
  \chordscheme[ finger = {2/3,2/1} ] &
  \chordscheme[ finger = {4/3,2/2,2/1} ] &
  \chordscheme[ finger = {4/4,4/3,2/2,2/1} ] &
  \chordscheme[ finger = {2/4,4/3,5/2,2/1} ] &
  \chordscheme[ finger = {1/4,3/1} ] &
  \chordscheme[ finger = {2/3,2/1} ]
\end{tabular}

\end{document}

答案3

除了保罗的精彩回答之外,我建议使用lilyglyphs。我创建了一些命令(在 lilyglyphs 创建者的帮助下),使输入和弦符号变得不那么麻烦。

输出

\documentclass{article}
\usepackage{fontspec}
\usepackage{tikz}
\usepackage{lilyglyphs}
\usepackage{xspace}

\newcommand{\tinysharpx}[1][0.10ex]{\hspace*{#1}\sharp[scale=.65,raise=.1]\hspace*{#1}}
\newcommand{\tinyflatx}[1][0.10ex]{\hspace*{#1}\flat[scale=.6,raise=.1]\hspace*{#1}}
\newcommand{\flatx}[1][0.18ex]{\hspace*{#1}\flat\hspace*{#1}}
\newcommand{\sharpx}[1][0.18ex]{\hspace*{#1}\sharp\hspace*{#1}}

\newcommand\bigchord[4]{\(\text{#1}^{#2}\mkern-3mu\relax(\mathop{}\limits\mkern-3mu\relax{}^{#3}_{#4})\)}
\newcommand\chord[2]{\(\text{#1}^{#2}\)}

\newcommand{\aflat}{A\(\flatx\)\xspace}
\newcommand{\bflat}{B\(\flatx\)\xspace}
\newcommand{\cflat}{C\(\flatx\)\xspace}
\newcommand{\dflat}{D\(\flatx\)\xspace}
\newcommand{\eflat}{E\(\flatx\)\xspace}
\newcommand{\fflat}{F\(\flatx\)\xspace}
\newcommand{\gflat}{G\(\flatx\)\xspace}

\newcommand{\aflatm}{A\(\flatx\)m\xspace}
\newcommand{\bflatm}{B\(\flatx\)m\xspace}
\newcommand{\cflatm}{C\(\flatx\)m\xspace}
\newcommand{\dflatm}{D\(\flatx\)m\xspace}
\newcommand{\eflatm}{E\(\flatx\)m\xspace}
\newcommand{\fflatm}{F\(\flatx\)m\xspace}
\newcommand{\gflatm}{G\(\flatx\)m\xspace}

\newcommand{\aiss}{A\(\sharpx\)\xspace}
\newcommand{\biss}{B\(\sharpx\)\xspace}
\newcommand{\ciss}{C\(\sharpx\)\xspace}
\newcommand{\diss}{D\(\sharpx\)\xspace}
\newcommand{\eiss}{E\(\sharpx\)\xspace}
\newcommand{\fiss}{F\(\sharpx\)\xspace}
\newcommand{\giss}{G\(\sharpx\)\xspace}

\newcommand{\aissm}{A\(\sharpx\)m\xspace}
\newcommand{\bissm}{B\(\sharpx\)m\xspace}
\newcommand{\cissm}{C\(\sharpx\)m\xspace}
\newcommand{\dissm}{D\(\sharpx\)m\xspace}
\newcommand{\eissm}{E\(\sharpx\)m\xspace}
\newcommand{\fissm}{F\(\sharpx\)m\xspace}
\newcommand{\gissm}{G\(\sharpx\)m\xspace}

\newcommand\ukulelechord[2][]{%
  \begin{tikzpicture}[x=3mm,y=3mm,line cap=round,line width=.4pt,
    baseline=(current bounding box.center),#1]
    \draw[line width=.6pt] (1,0) -- (4,0);
    \foreach \d in {1,...,4}{\draw (1,-\d) -- (4,-\d);}
    \foreach \d[count=\p] in {#2}{
      \draw (\p,0) -- (\p,-4.5);
      \ifnum\d>0 \fill (\p,.5-1*\d) circle(.8mm); \fi
    }
    \path[use as bounding box] (0.5,.3) rectangle (4.5,-5);
  \end{tikzpicture}%
}
\begin{document}
\begin{tabular}{rcc}
  &maj& 6 \\
  A & \ukulelechord{2,1,0,0} & \ukulelechord{2,1,2,0} \\
  \giss/\aflat & \ukulelechord{5,3,4,5} & \ukulelechord{1,3,1,3} \\
\end{tabular}
\end{document}

相关内容