MuGeminorum / Mathematica-Music-Pack

This macro package simplifies the arrangement input structure in the Mathematica platform sound module, reducing the amount of code keyed in by the composer and removing a lot of repetitive code structure and functional flaws in the original synthesis on special sounds.|此宏包可简化Mathematica平台声音模块中的编曲输入结构,降低作曲者键入代码量,去除原有合成中大量重复的代码结构和特殊音效上的功能缺陷。

Home Page:https://foruda.gitee.com/images/1681966896514664617/0aa85937_10787834.png

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mathematica-Music-Pack

license CI

A macro package for simplifying composition on Mathematica

Maintenance

git clone git@gitee.com:MuGeminorum/Mathematica-Music-Pack.git

User manual

We use vectors and numbers to replace complicated SoundNote[] functions. A complete song has many sections, its format is as follow:

track1 = {
    {params of section 1},
    {notes  of section 1},

    {params of section 2},
    {notes  of section 2},

    ...

    {params of section m},
    {notes  of section m}
};

track2 = {
    {params of section 1},
    {notes  of section 1},

    {params of section 2},
    {notes  of section 2},

    ...

    {params of section n},
    {notes  of section n}
};

...

player[track1, soundfont1, track2, soundfont2, ...]

One section consists of an info part and a note part, the info part includes 4 required params(tonality, central note, transposition, tempo) and one optional param(volume number or volume change vector); While the note part contains melodies and chords. The info part follows below format rules:

Table 1: Param part format
Format
Remark
{m, c, s, t} m is 0(major) or 1(minor);
c is central note integer([0, 11]);
s is transferring(The whole piece moves up s semitones);
t is tempo(the number = a quarter note);
{m, c, s, t, v} v is volume([0, 1]);
{m, c, s, t, {vs, vt}} Volume fades from vs to vt

The central note list is as follow:

Table 2: Central note list
C C#/Db D Eb/D# E F F#/Gb G Ab/G# A Bb/A# B
0 1 2 3 4 5 6 7 8 9 10 11

The note part has melodies and chords, which consists of different kinds of notes:

Table 3: Input formats of notes
Effect Format Remark
Rest {l} l is duration;
Tone {n, l} n is note value;
Chord {{n1, n2, ...}, l} nk are chord note values;
Staccato {n, {l1, l2}} l1 is real duration, l2 is duration ratio;
Vibrato {{n1, n2}, l1, tn} tn is trill number;
Arpeggio {{n1, n2, ...}, l1, l2} l2 is duration ratio;
Tenuto {bottom note, top notes} Bottom note can be a tone or a chord, top notes consist of any above type.

With these rules, we can get a concise format of notes.

Table 4: Sound effect demos

For notes in the note part, 12-note scheme is unfriendly to us, it can be transferred into 7-note scheme once the tonality is fixed:

Table 5: The 12-note scheme(left) & 7-note scheme(right)

Please refer to the demo code Demo_BWV-1079.nb or visit our song library https://mugeminorum.github.io/Mathematica-Music-Pack for more details; Before compiling songs, please run the macro package first.

Besides, the e-piano.nb is a piano keyboard UI, you can play it as a virtual piano on Mathematica.

About

This macro package simplifies the arrangement input structure in the Mathematica platform sound module, reducing the amount of code keyed in by the composer and removing a lot of repetitive code structure and functional flaws in the original synthesis on special sounds.|此宏包可简化Mathematica平台声音模块中的编曲输入结构,降低作曲者键入代码量,去除原有合成中大量重复的代码结构和特殊音效上的功能缺陷。

https://foruda.gitee.com/images/1681966896514664617/0aa85937_10787834.png

License:Other


Languages

Language:Mathematica 100.0%