|
1 | | - |
2 | | -<!-- |
| 1 | +<!-- |
3 | 2 | * @author Benjamin Frahm |
4 | 3 | * @reviewer Malte Richert |
5 | | - --> |
| 4 | + --> |
6 | 5 |
|
7 | 6 | # Music |
8 | 7 |
|
9 | | -This package deals with generating music, adding the text that was generated in the text component at the correct positions and persisting it in a midi file. |
| 8 | +This package deals with generating music, adding the text that was generated in the text component at the correct positions and persisting it in a midi file. |
10 | 9 | The generation is divided into 3 steps: |
11 | 10 |
|
12 | 11 | ## 1. Template and text selection |
| 12 | + |
13 | 13 | In the first step a structure-template is selected from the genre's structure-templates (stored in yml-file). |
14 | 14 | The structure is then passed to the TextGeneration component, where fitting texts are selected. |
15 | 15 | Thereafter, some set-up work is done, like determining the number of midi tracks needed, calculating the length of the whole song, setting the tempo, etc. |
| 16 | + |
16 | 17 | ## 2. Part-filling |
| 18 | + |
17 | 19 | After the structure and the texts have been selected, the actual music generation starts. |
18 | 20 | This is done by iterating over the parts of the structure (intro, chorus, verse, etc.) and generating the notes that are to be played by the instruments specified in the part. |
19 | 21 | The different instruments are treated as follows: |
20 | | -- Chords: play the chord progression of the part in the right hand, play root note of the current chord in the left hand. |
21 | | -- Bass: play a bass line that contains transitions between the chords of the part's progression |
22 | | -- Drum: play a drumbeat selected from the drumBeat-templates |
23 | | -- Melody: Every part has a 4- or 12-bar theme, which is then varied and applied in slightly different versions |
| 22 | + |
| 23 | +- Chords: play the chord progression of the part in the right hand, play root note of the current chord in the left hand. |
| 24 | +- Bass: play a bass line that contains transitions between the chords of the part's progression |
| 25 | +- Drum: play a drumbeat selected from the drumBeat-templates |
| 26 | +- Melody: Every part has a 4- or 12-bar theme, which is then varied and applied in slightly different versions |
24 | 27 |
|
25 | 28 | Since some parts of the music are being reused (equal parts) or varied (theme variations), the music is not directly written as midi, but abstracted and stored as instances of the MidiPlayable class. |
26 | 29 |
|
27 | 30 | The specific midi instrument number to be associated with the abstract instruments (like chords, bass, etc.) is specified in a config file (instrument_mapping.yml). |
| 31 | + |
28 | 32 | ## 3. Midi-File creation |
| 33 | + |
29 | 34 | After all MidiPlayables have been created, the conversion to actual midi begins, by iterating over the parts of the song in order, as specified in structure template, and writing the MidiPlayables' content into one Midi-Sequence-Object. |
30 | 35 | After this is done, the text is added at the required positions (indicated by "vocals" instrument in the structure). |
0 commit comments