Overview
Comment: | Bug: octave modifiers (,') were acting as (up,down) not (down,up) |
---|---|
Timelines: | family | ancestors | descendants | both | master |
Files: | files | file ages | folders |
SHA1: |
e6bf0dbf82776bbc4d91c55ae914c24e |
User & Date: | spiffytech@gmail.com on 2010-11-18 03:04:57 |
Other Links: | branch diff | manifest | tags |
Context
2010-11-18
| ||
03:10 | Can now set an instrument's default octave beside the instrument's score check-in: ff85cece1d user: spiffytech@gmail.com tags: master | |
03:04 | Bug: octave modifiers (,') were acting as (up,down) not (down,up) check-in: e6bf0dbf82 user: spiffytech@gmail.com tags: master | |
2010-11-17
| ||
07:45 | Only print f-tables once check-in: 7b40d5d489 user: spiffytech@gmail.com tags: master | |
Changes
Modified cfg.py from [172b01d6f6] to [2306af4935].
1 2 3 4 5 6 7 8 9 10 11 12 | #!/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" | | < | | > | < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | > > | 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 | #!/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 = 60/60 tempo = 1/bps max_duration = 1 composition = { "a": { # Movement block 'a' for reuse throughout the piece "bassline": { # Instrument 'melody' "score_line": "i1 %(time)f %(duration)f 10000 %(octave)d.%(note)s", "octave": 6, "grammars": { # Notes for this instrument to use in this piece "u": ["I,/2 z/2 I,/2 z/2 I,/2 z/2 V,/2 z/2 u u", "e"], "e": [""], }, "score": "u u u u u", }, }, } max_t = 0 # max time encountered so far. Used for movement timing progression = "a" for comp_name in progression.split(): instr_start_time = max_t for instr_name, instr in composition[comp_name].iteritems(): generated_score = generate_score(instr["score"], instr["grammars"]) # Fill in the scores by generating them based on the grammars score = parse.parse(generated_score, default_octave=instr["octave"]) # Return Node/Chord objects # Generate timestamps for the notes t = instr_start_time for note in range(len(score)): score[note].time = t score[note].duration *= tempo t += score[note].duration 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 print "f1 0 512 10 1" # print "f1 0 513 9 1 1 0 3 .33 180 5 .2 0 7 .143 180 9 .111 0" # print "f2 0 8192 10 .24 .64 .88 .76 ,96 .5 .24 .08" 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"] final_score = generate_csound_score(composition[comp_name][instr_name]["score"], composition[comp_name][instr_name]["score_line"]) for line in final_score: |
︙ | ︙ | |||
162 163 164 165 166 167 168 | if isinstance(token, parse.Chord): # Chords for note in token.chord: note = csound_note_values[note] # csound_score.append("i2 %(time)f %(duration)f 7000 %(octave)d.%(note)s %(octave)d.%(note)s 0 6" % {"time": token.time, "octave": random.choice([7,8]), "note": note, "duration": token.duration}) csound_score.append(score_line % {"time": token.time, "octave": random.choice([7,8]), "note": note, "duration": token.duration}) elif isinstance(token, parse.Note): # Individual notes note = csound_note_values[token.value] | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 | if isinstance(token, parse.Chord): # Chords for note in token.chord: note = csound_note_values[note] # csound_score.append("i2 %(time)f %(duration)f 7000 %(octave)d.%(note)s %(octave)d.%(note)s 0 6" % {"time": token.time, "octave": random.choice([7,8]), "note": note, "duration": token.duration}) csound_score.append(score_line % {"time": token.time, "octave": random.choice([7,8]), "note": note, "duration": token.duration}) elif isinstance(token, parse.Note): # Individual notes note = csound_note_values[token.value] csound_score.append(score_line % {"time": token.time, "octave": token.octave, "note": note, "duration": token.duration}) # csound_score.append("i2 %(time)f %(duration)f 7000 %(octave)d.%(note)s %(octave)d.%(note)s 0 6" % {"time": token.time, "octave": random.choice([8,9]), "note": note, "duration": token.duration}) return csound_score if __name__ == "__main__": main() |
Modified parse.py from [3a88b8ab43] to [40393160ad].
︙ | ︙ | |||
22 23 24 25 26 27 28 | class Rest(): def __init__(self, duration=.25): self.duration = duration def __repr__(self): return "Rest node %s" % self.duration | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | class Rest(): def __init__(self, duration=.25): self.duration = duration def __repr__(self): return "Rest node %s" % self.duration def parse(score, default_octave=8): # Tokenize (lex) tokens = ( "NOTE_LENGTH", "BASENOTE", "ACCIDENTAL", "REST", "OCTAVE", |
︙ | ︙ | |||
126 127 128 129 130 131 132 | p[2].accidental = p[1] p[0] = p[2] def p_octave(p): '''pitch : pitch OCTAVE ''' count = len(p[2]) | | > | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | p[2].accidental = p[1] p[0] = p[2] def p_octave(p): '''pitch : pitch OCTAVE ''' count = len(p[2]) increment_or_decrement = 1 if p[2][0] == "'" else -1 print "octave=", default_octave octave = default_octave + (count * increment_or_decrement) p[1].octave = octave p[0] = p[1] def p_pitch(p): '''pitch : BASENOTE ''' p[0] = Note(p[1]) |
︙ | ︙ |
Modified test.orc from [a26a1f1a08] to [ca3bb46446].
|
| > > > > > > > | > | | | > > > | | > > | > > | > > > | > > > > > > > > | > | | > | > > | | 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 | ; ************************************************************************ ; ACCCI: 40_03_1.ORC ; synthesis: Waveshaping(40) ; Waveshaper Using Ring Modulation(03) ; source: Dodge (p.145, 1985) ; coded: jpg 8/93 sr = 44100 kr = 441 ksmps= 100 nchnls =2 instr 1; ***************************************************************** idur = p3 iamp = p4 ifq = cpspch(p5) a1 oscili iamp, 1/idur, 1 ; envelope a2 oscili a1, ifq, 1 ; sinus of ring modulation a3 linseg 1, .04, 0, idur-.04, 0 ; very short envelope a4 oscili a3, ifq*.7071, 1 ; sinus for waveshaper ; inline code for transfer function: ; f(x) = 1 + .841x - .707x**2 - .595x**3 + .5x**4 + .42x**5 - ; .354x**6 - .279x**7 + .25x**8 + .21x**9 a5 = a4*a4 a6 = a5*a4 a7 = a5*a5 a8 = a7*a4 a9 = a6*a6 a10 = a9*a4 a11 = a10*a4 a12 = a11*a4 ; This is the polynomial representation of the transfer function a13=1+.841*a4-.707*a5-.595*a6+.5*a7+.42*a8-.354*a9-.297*a10+.25*a11+.21*a12 a14 = a13*a2 ; ring modulation outs a14,a14 endin |
Modified test.sco from [241ac8cf68] to [c2061b1574].
|
| < | > | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 | octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 f1 0 512 10 1 i1 0.000000 0.500000 10000 5.09 i1 1.000000 0.500000 10000 5.09 i1 2.000000 0.500000 10000 5.09 i1 3.000000 0.500000 10000 5.04 i1 4.000000 0.500000 10000 5.09 i1 5.000000 0.500000 10000 5.09 i1 6.000000 0.500000 10000 5.09 i1 7.000000 0.500000 10000 5.04 i1 8.000000 0.500000 10000 5.09 i1 9.000000 0.500000 10000 5.09 i1 10.000000 0.500000 10000 5.09 i1 11.000000 0.500000 10000 5.04 i1 12.000000 0.500000 10000 5.09 i1 13.000000 0.500000 10000 5.09 i1 14.000000 0.500000 10000 5.09 i1 15.000000 0.500000 10000 5.04 |
Modified todo.org from [109f37c970] to [f88a59ddf7].
|
| | | > | > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * Features [2/9] - [X] Top-down composition - [ ] Coordinate the melody and rhythm - [ ] Set maximum song length of movement - [ ] Set minimum song length of movement - [ ] Get all tracks to end at the same time - [ ] Need to support all chord types - [X] Doesn't handle rest notes - [ ] Handle full ABC BNF (yeah, right...) - [ ] Set instrument octave in score file * 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 [1/3] - [ ] Chords should be composed of Notes, not ordinary arrays - [ ] Generate score with proper generation tools - [X] Store csound score lines with instruments |