• トップページ
  • project
    • 全ての作品
    • 全てのタグ
  • blog
    • 全ての記事
    • 全てのタグ
  • tag
    • 全てのタグ
    • 全ての作品タグ
    • 全ての記事タグ
  • about
    • p進大好きサークル photo

      p進大好きサークル

      p進大好きサークルのHPです。

    • もっと読む
    • Twitter
    • pixiv
    • 巨大数Wiki

機能和声の実装 - 階名

2020/01/24

トップページ 前の記事 親記事 次の記事

twitter pixiv yukicoder お題箱 マシュマロ

数式での翻訳

\(\{I,V\}\)を記号とする文字列の集合 \[ \textrm{KaiMei} = \{\textrm{I},\textrm{II},\textrm{III},\textrm{IV},\textrm{V},\textrm{VI},\textrm{VII}\} \] に属する文字列を階名と呼びます。完全に公理的集合論で定義をしたい場合は、幹音の記事において導入した規則で英語のアルファベットを自然数にコードすることで、\(\mathbb{N}\)を記号の集合とする文字列の集合に翻訳して下さい。 全単射 \[ \begin{align} \textrm{KaiMei} &\to \mathbb{Z}/7 \mathbb{Z} \\
\textrm{I} & \mapsto 0 \\
\textrm{II} & \mapsto 1 \\
\textrm{III} & \mapsto 2 \\
\textrm{IV} & \mapsto 3 \\
\textrm{V} & \mapsto 4 \\
\textrm{VI} & \mapsto 5 \\
\textrm{VII} & \mapsto 6 \end{align} \] により\(\textrm{KaiMei}\)を\(\mathbb{Z}/7 \mathbb{Z}\)と同一視します。\(\textrm{I}\)に対応する\(\mathbb{Z}/7 \mathbb{Z}\)の元は\(1\)ではなく\(0\)であることに注意しましょう。

階名単体ではさほど用途がないのですが、例えば次の音階の記事で導入する音階という概念と組み合わせて使われます。具体的には、音階と階名の組をピッチクラスへ翻訳する単射な写像を定義していきます。そうすることで、音階を固定するごとに\(7\)種類のピッチクラスが階名により番号付けられるわけです。ただしこの番号付けと\(\mathbb{Z}/7 \mathbb{Z}\)に備わっている環構造は特筆すべき整合性を持たないため、\(\textrm{KaiMei}\)に誘導される環構造にはあまり意味がありません。それでも階名\(n\)の次の階名を表すのに\(n+1\)と書けることは便利であるため、\(\{0,1,2,3,4,5,6\}\)ではなく\(\mathbb{Z}/7 \mathbb{Z}\)との同一視を行います。例えば\(\textrm{III} + 2 = \textrm{V}\)や\(\textrm{VI} + 3 = \textrm{II}\)といった等式が成り立ちます。

C++での宣言

階名のクラスおよび関係する関数たちを以下のように宣言します。


class KaiMei :
  public Mod<7>
{

  string m_s;

public:
  KaiMei( const int& n ) noexcept;

  inline const string& Display() const noexcept;

  static inline const KaiMei& I() noexcept;
  static inline const KaiMei& II() noexcept;
  static inline const KaiMei& III() noexcept;
  static inline const KaiMei& IV() noexcept;
  static inline const KaiMei& V() noexcept;
  static inline const KaiMei& VI() noexcept;
  static inline const KaiMei& VII() noexcept;

private:
  static string SymbolTable( const int& n ) noexcept;

};

const KaiMei& operator+( const KaiMei& n1 , const int& n2 ) noexcept;


C++での定義

実際の実装例についてはこちらをご覧下さい。実装においては以下の仕様を要請します。

  • inline KaiMei::KaiMei( const int& n ) noexceptはメンバ初期化子リストMod<7>( n ) , m_s( SymbolTable( n ) )で定める。
  • inline string KaiMei::Display() const noexceptはreturn m_sと定める。
  • static inline const KaiMei& KaiMei::I() noexcept~static inline const KaiMei& KaiMei::VII() noexceptはそれぞれ\(i+1\)のアラビア数字表記が関数名とメタに等しいような唯一の\(i \in \{0,1,2,3,4,5,6\}\)を用いてconst KaiMei nをKaiMei( i )と定め、return nと定める。
  • static string KaiMei::SymbolTable( const int& n ) noexceptはn < 7の時にconst string sを"I" , "II" , "III" , "IV" , "V" , "VI" , "VII"のn+1番目と定め、return sと定める。
  • const KaiMei& operator+( const KaiMei& n1 , const int& n2 ) noexceptはconst Mod<7> nをMod<7>( n1.Represent() + n2 )で定め、KaiMei::I()~KaiMei::VII()のn.Represent()+1番目の戻り値を返す。
トップページ 前の記事 親記事 次の記事

twitter pixiv yukicoder お題箱 マシュマロ