Overview
Comment: | Note duration is now counted as fraction of a whole note, as measured based on BPM |
---|---|
Timelines: | family | ancestors | descendants | both | tld |
Files: | files | file ages | folders |
SHA1: |
5a35ffdd27abbc2f09059de494e44edd |
User & Date: | spiffytech@gmail.com on 2010-11-17 06:57:32 |
Other Links: | branch diff | manifest | tags |
Context
2010-11-17
| ||
07:30 | Added support for rest notes Closed-Leaf check-in: aa88358397 user: spiffytech@gmail.com tags: tld | |
06:57 | Note duration is now counted as fraction of a whole note, as measured based on BPM check-in: 5a35ffdd27 user: spiffytech@gmail.com tags: tld | |
06:27 | TLD now accepts ordering of movements. Also, fixed bug that caused all movements and instruments to play simultaneously. check-in: db1df2f460 user: spiffytech@gmail.com tags: tld | |
Changes
Modified cfg.py from [f043e9a785] to [f7b2188978].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #!/usr/bin/env python import os import random import sys import time random.seed(time.time()) import parse def main(): key = "A" composition = { "a": { # Movement block 'a' for reuse throughout the piece "melody": { # Instrument 'melody' "csound_parameters": { "instrument": 1, }, "grammars": { # Notes for this instrument to use in this piece "u": ["I V V V I I IV u u", "I IV u u", "I VII IV u u" , "e"], | > > > > < | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #!/usr/bin/env python from __future__ import division import os import random import sys import time random.seed(time.time()) import parse def main(): key = "A" bps = 80/60 print bps tempo = 1/bps composition = { "a": { # Movement block 'a' for reuse throughout the piece "melody": { # Instrument 'melody' "csound_parameters": { "instrument": 1, }, "grammars": { # Notes for this instrument to use in this piece "u": ["I V V V I I IV u u", "I IV u u", "I VII IV u u" , "e"], "e": [""], }, "score": "u u u u u", }, "rhythm": { "csound_parameters": { "instrument": 1, }, "grammars": { "u": ['"I" "ii"/4 "ii"/4 "IV"/2 "V"2 "IV" "I" u u', '"I" "vii" "IV" u u', '"I" "v" "IV" u u', "e"], # "u": ['"i" "I" "ii" "II" "v" "V" u', "e"], "e": [""] }, "score": "u u u", }, }, "b": { "melody": { # Instrument 'melody' |
︙ | ︙ | |||
68 69 70 71 72 73 74 75 76 | generated_score = generate_score(instr["score"], instr["grammars"]) # Fill in the scores by generating them based on the grammars score = parse.parse(generated_score) # Return Node/Chord objects # Generate timestamps for the notes t = instr_start_time for note in range(len(score)): score[note].time = t t += score[note].duration max_t = t if t > max_t else max_t | > > > > < < | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | generated_score = generate_score(instr["score"], instr["grammars"]) # Fill in the scores by generating them based on the grammars score = parse.parse(generated_score) # Return Node/Chord objects # Generate timestamps for the notes t = instr_start_time for note in range(len(score)): score[note].time = t # print "Original duration:", score[note].duration score[note].duration *= tempo # print "New duration:", score[note].duration t += score[note].duration # print "t:", t max_t = t if t > max_t else max_t composition[comp_name][instr_name]["score"] = score # Must be done after all note times keyed in, else you can't coordinate melodies with the rhythm chords for comp_name in progression.split(): for instr_name, instr in composition[comp_name].iteritems(): composition[comp_name][instr_name]["score"] = transliterate_score(composition[comp_name][instr_name]["score"], key) # print "\nMovement %s instrument %s" % (comp_name, instr_name) # print composition[comp_name][instr_name]["score"] |
︙ | ︙ |
Modified test.sco from [8d380ffb70] to [a5eee77281].
1 | f1 0 256 10 1 0 3 ; sine wave function table | > | | | > | > | | | | | > | | | < | | | | | | < < < < | | | | | | | | | | < | < < | | | | | | | < < | | | | | | > > > | | | | | | > > | < | | | | | < | | | | < | | | > | | | | > | < > | > | > | | | | > > | | | | | | | | | | | | | | | | | | | | | | | | > > > | | | > > > > > > | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | 1.33333333333 f1 0 256 10 1 0 3 ; sine wave function table i2 0.000000 0.187500 7000 9.09 9.09 0 6 i2 0.187500 0.187500 7000 9.02 9.02 0 6 i2 0.375000 0.187500 7000 9.09 9.09 0 6 i2 0.562500 0.187500 7000 9.02 9.02 0 6 i2 0.750000 0.187500 7000 8.09 8.09 0 6 i2 0.937500 0.187500 7000 9.04 9.04 0 6 i2 1.125000 0.187500 7000 9.04 9.04 0 6 i2 1.312500 0.187500 7000 8.04 8.04 0 6 i2 1.500000 0.187500 7000 9.09 9.09 0 6 i2 1.687500 0.187500 7000 9.09 9.09 0 6 i2 1.875000 0.187500 7000 8.02 8.02 0 6 i2 2.062500 0.187500 7000 8.09 8.09 0 6 i2 2.250000 0.187500 7000 9.04 9.04 0 6 i2 2.437500 0.187500 7000 9.04 9.04 0 6 i2 2.625000 0.187500 7000 8.04 8.04 0 6 i2 2.812500 0.187500 7000 9.09 9.09 0 6 i2 3.000000 0.187500 7000 8.09 8.09 0 6 i2 3.187500 0.187500 7000 8.02 8.02 0 6 f1 0 256 10 1 0 3 ; sine wave function table i2 0.000000 0.375000 7000 8.11 8.11 0 6 i2 0.000000 0.375000 7000 8.04 8.04 0 6 i2 0.000000 0.375000 7000 7.08 7.08 0 6 i2 0.375000 0.375000 7000 7.06 7.06 0 6 i2 0.375000 0.375000 7000 7.09 7.09 0 6 i2 0.375000 0.375000 7000 7.01 7.01 0 6 i2 0.750000 0.375000 7000 7.04 7.04 0 6 i2 0.750000 0.375000 7000 8.09 8.09 0 6 i2 0.750000 0.375000 7000 7.11 7.11 0 6 i2 1.125000 0.375000 7000 7.11 7.11 0 6 i2 1.125000 0.375000 7000 8.04 8.04 0 6 i2 1.125000 0.375000 7000 7.08 7.08 0 6 i2 1.500000 0.187500 7000 7.01 7.01 0 6 i2 1.500000 0.187500 7000 7.06 7.06 0 6 i2 1.500000 0.187500 7000 8.09 8.09 0 6 i2 1.687500 0.187500 7000 7.01 7.01 0 6 i2 1.687500 0.187500 7000 8.06 8.06 0 6 i2 1.687500 0.187500 7000 7.09 7.09 0 6 i2 1.875000 0.375000 7000 7.04 7.04 0 6 i2 1.875000 0.375000 7000 8.09 8.09 0 6 i2 1.875000 0.375000 7000 7.11 7.11 0 6 i2 2.250000 1.500000 7000 7.06 7.06 0 6 i2 2.250000 1.500000 7000 7.09 7.09 0 6 i2 2.250000 1.500000 7000 7.01 7.01 0 6 i2 3.750000 0.375000 7000 7.04 7.04 0 6 i2 3.750000 0.375000 7000 8.09 8.09 0 6 i2 3.750000 0.375000 7000 7.11 7.11 0 6 i2 4.125000 0.375000 7000 7.11 7.11 0 6 i2 4.125000 0.375000 7000 7.04 7.04 0 6 i2 4.125000 0.375000 7000 8.08 8.08 0 6 i2 4.500000 0.375000 7000 8.11 8.11 0 6 i2 4.500000 0.375000 7000 8.04 8.04 0 6 i2 4.500000 0.375000 7000 7.08 7.08 0 6 i2 4.875000 0.187500 7000 8.01 8.01 0 6 i2 4.875000 0.187500 7000 8.06 8.06 0 6 i2 4.875000 0.187500 7000 7.09 7.09 0 6 i2 5.062500 0.187500 7000 7.01 7.01 0 6 i2 5.062500 0.187500 7000 7.06 7.06 0 6 i2 5.062500 0.187500 7000 8.09 8.09 0 6 i2 5.250000 0.375000 7000 8.04 8.04 0 6 i2 5.250000 0.375000 7000 8.09 8.09 0 6 i2 5.250000 0.375000 7000 8.11 8.11 0 6 i2 5.625000 1.500000 7000 8.06 8.06 0 6 i2 5.625000 1.500000 7000 7.09 7.09 0 6 i2 5.625000 1.500000 7000 7.01 7.01 0 6 i2 7.125000 0.375000 7000 7.04 7.04 0 6 i2 7.125000 0.375000 7000 7.09 7.09 0 6 i2 7.125000 0.375000 7000 7.11 7.11 0 6 i2 7.500000 0.375000 7000 8.11 8.11 0 6 i2 7.500000 0.375000 7000 8.04 8.04 0 6 i2 7.500000 0.375000 7000 8.08 8.08 0 6 f1 0 256 10 1 0 3 ; sine wave function table i2 7.875000 1.500000 7000 8.09 8.09 0 6 i2 9.375000 0.187500 7000 9.02 9.02 0 6 i2 9.562500 0.187500 7000 8.09 8.09 0 6 i2 9.750000 0.187500 7000 9.04 9.04 0 6 i2 9.937500 0.187500 7000 8.09 8.09 0 6 i2 10.125000 0.375000 7000 8.09 8.09 0 6 i2 10.500000 0.375000 7000 8.02 8.02 0 6 i2 10.875000 1.500000 7000 9.09 9.09 0 6 i2 12.375000 0.187500 7000 8.02 8.02 0 6 i2 12.562500 1.500000 7000 8.09 8.09 0 6 i2 14.062500 0.187500 7000 8.02 8.02 0 6 i2 14.250000 0.187500 7000 8.09 8.09 0 6 i2 14.437500 0.187500 7000 8.04 8.04 0 6 i2 14.625000 0.187500 7000 8.09 8.09 0 6 i2 14.812500 0.375000 7000 8.09 8.09 0 6 i2 15.187500 0.375000 7000 8.02 8.02 0 6 f1 0 256 10 1 0 3 ; sine wave function table i2 7.875000 0.375000 7000 7.11 7.11 0 6 i2 7.875000 0.375000 7000 7.04 7.04 0 6 i2 7.875000 0.375000 7000 8.08 8.08 0 6 i2 8.250000 0.375000 7000 7.04 7.04 0 6 i2 8.250000 0.375000 7000 8.09 8.09 0 6 i2 8.250000 0.375000 7000 8.11 8.11 0 6 i2 8.625000 1.500000 7000 7.06 7.06 0 6 i2 8.625000 1.500000 7000 8.09 8.09 0 6 i2 8.625000 1.500000 7000 8.01 8.01 0 6 i2 10.125000 0.375000 7000 7.04 7.04 0 6 i2 10.125000 0.375000 7000 7.09 7.09 0 6 i2 10.125000 0.375000 7000 7.11 7.11 0 6 i2 10.500000 0.375000 7000 7.11 7.11 0 6 i2 10.500000 0.375000 7000 8.04 8.04 0 6 i2 10.500000 0.375000 7000 7.08 7.08 0 6 i2 10.875000 0.375000 7000 7.11 7.11 0 6 i2 10.875000 0.375000 7000 8.04 8.04 0 6 i2 10.875000 0.375000 7000 7.08 7.08 0 6 i2 11.250000 0.375000 7000 7.04 7.04 0 6 i2 11.250000 0.375000 7000 7.09 7.09 0 6 i2 11.250000 0.375000 7000 8.11 8.11 0 6 i2 11.625000 1.500000 7000 7.06 7.06 0 6 i2 11.625000 1.500000 7000 8.09 8.09 0 6 i2 11.625000 1.500000 7000 7.01 7.01 0 6 i2 13.125000 0.375000 7000 8.04 8.04 0 6 i2 13.125000 0.375000 7000 8.09 8.09 0 6 i2 13.125000 0.375000 7000 7.11 7.11 0 6 i2 13.500000 0.375000 7000 8.11 8.11 0 6 i2 13.500000 0.375000 7000 8.04 8.04 0 6 i2 13.500000 0.375000 7000 8.08 8.08 0 6 i2 13.875000 0.375000 7000 8.11 8.11 0 6 i2 13.875000 0.375000 7000 7.04 7.04 0 6 i2 13.875000 0.375000 7000 7.08 7.08 0 6 i2 14.250000 0.375000 7000 8.09 8.09 0 6 i2 14.250000 0.375000 7000 7.01 7.01 0 6 i2 14.250000 0.375000 7000 7.04 7.04 0 6 i2 14.625000 0.375000 7000 8.04 8.04 0 6 i2 14.625000 0.375000 7000 7.09 7.09 0 6 i2 14.625000 0.375000 7000 8.11 8.11 0 6 i2 15.000000 0.375000 7000 8.11 8.11 0 6 i2 15.000000 0.375000 7000 7.04 7.04 0 6 i2 15.000000 0.375000 7000 7.08 7.08 0 6 i2 15.375000 0.375000 7000 8.09 8.09 0 6 i2 15.375000 0.375000 7000 7.01 7.01 0 6 i2 15.375000 0.375000 7000 8.04 8.04 0 6 i2 15.750000 0.375000 7000 7.04 7.04 0 6 i2 15.750000 0.375000 7000 8.09 8.09 0 6 i2 15.750000 0.375000 7000 7.11 7.11 0 6 |
Modified todo.org from [11f927dcbf] to [1f5e1e7f07].
1 2 3 4 5 6 7 | * Features [1/5] - [X] Top-down composition - [ ] Transition the melody between chords appropriately - [ ] Set maximum song length - [ ] Need to support all chord types - [ ] Doesn't handle rest notes | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | * Features [1/5] - [X] Top-down composition - [ ] Transition the melody between chords appropriately - [ ] Set maximum song length - [ ] Need to support all chord types - [ ] Doesn't handle rest notes * Bugs [4/5] - [X] TLD resets clock for each movement - [X] TLD doesn't accept an ordering for the movements - [X] Doesn't handle minor chords - [X] Calculated duration is absolute, not relative to BPM - [ ] Chords don't respect octaves * Structure [0/3] - [ ] Chords should be composed of Notes, not ordinary arrays - [ ] Generate score with proper generation tools - [ ] Store csound score lines with instruments |