spiffyscore

Check-in [eb81d5f9fd]
Login

Check-in [eb81d5f9fd]

Overview
Comment:Added a sampled double bass, modified the program to respond to an instrument's specified octave
Timelines: family | ancestors | descendants | both | develop
Files: files | file ages | folders
SHA1: eb81d5f9fd6c7cbcdf4db007520f37b4ad668303
User & Date: brian on 2011-11-01 18:52:19
Other Links: branch diff | manifest | tags
Context
2011-11-01
18:54
Imported the todo list from MUS306 check-in: 072fa6ad30 user: brian tags: develop
18:52
Added a sampled double bass, modified the program to respond to an instrument's specified octave check-in: eb81d5f9fd user: brian tags: develop
2011-10-20
20:01
Program no longer cuts out a note from the score each time it adds a new phrase to the score check-in: 2ae36c6e68 user: brian tags: develop
Changes

Modified cfg.orc from [8f705f0ccb] to [e60884eb39].

1
2
3





































4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
sr=44100
ksmps=20
nchnls=1






































instr 1
    asound pluck   p4, cpspch(p5), cpspch(p6), p7, p8 p9 p10
    out asound
endin

instr 2
    kenv linen p4, .1, p3, .2; envelope
    asound oscili kenv, cpspch(p5), p6; oscillator
    out asound
endin

instr 3
    asound foscili p4, cpspch(p5), 5, 2, 3, p9
    out asound
endin

instr 4
    aFMinst foscili p4, cpspch(p5), p6, p7, p8, p9
endin



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>












<
<
<
<
<



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
sr=44100
ksmps=20
nchnls=1

gifn ftgen 105, 0, 524288, -1,  "samples/bass/1.05.wav", 0, 0, 1 ; Middle C
gifn ftgen 106, 0, 524288, -1,  "samples/bass/1.06.wav", 0, 0, 1 ; Middle C
gifn ftgen 107, 0, 524288, -1,  "samples/bass/1.07.wav", 0, 0, 1 ; Middle C
gifn ftgen 108, 0, 524288, -1,  "samples/bass/1.08.wav", 0, 0, 1 ; Middle C
gifn ftgen 109, 0, 524288, -1,  "samples/bass/1.09.wav", 0, 0, 1 ; Middle C
gifn ftgen 110, 0, 524288, -1,  "samples/bass/1.10.wav", 0, 0, 1 ; Middle C
gifn ftgen 111, 0, 524288, -1,  "samples/bass/1.11.wav", 0, 0, 1 ; Middle C
gifn ftgen 200, 0, 524288, -1,  "samples/bass/2.01.wav", 0, 0, 1 ; Middle C
gifn ftgen 201, 0, 524288, -1,  "samples/bass/2.02.wav", 0, 0, 1 ; Middle C
gifn ftgen 202, 0, 524288, -1,  "samples/bass/2.03.wav", 0, 0, 1 ; Middle C
gifn ftgen 203, 0, 524288, -1,  "samples/bass/2.04.wav", 0, 0, 1 ; Middle C
gifn ftgen 204, 0, 524288, -1,  "samples/bass/2.05.wav", 0, 0, 1 ; Middle C
gifn ftgen 206, 0, 524288, -1,  "samples/bass/2.06.wav", 0, 0, 1 ; Middle C
gifn ftgen 207, 0, 524288, -1,  "samples/bass/2.07.wav", 0, 0, 1 ; Middle C
gifn ftgen 208, 0, 524288, -1,  "samples/bass/2.08.wav", 0, 0, 1 ; Middle C
gifn ftgen 209, 0, 524288, -1,  "samples/bass/2.09.wav", 0, 0, 1 ; Middle C
gifn ftgen 210, 0, 524288, -1,  "samples/bass/2.10.wav", 0, 0, 1 ; Middle C
gifn ftgen 211, 0, 524288, -1,  "samples/bass/2.11.wav", 0, 0, 1 ; Middle C
gifn ftgen 300, 0, 524288, -1,  "samples/bass/3.00.wav", 0, 0, 1 ; Middle C
gifn ftgen 301, 0, 524288, -1,  "samples/bass/3.01.wav", 0, 0, 1 ; Middle C
gifn ftgen 302, 0, 524288, -1,  "samples/bass/3.02.wav", 0, 0, 1 ; Middle C
gifn ftgen 303, 0, 524288, -1,  "samples/bass/3.03.wav", 0, 0, 1 ; Middle C
gifn ftgen 304, 0, 524288, -1,  "samples/bass/3.04.wav", 0, 0, 1 ; Middle C
gifn ftgen 305, 0, 524288, -1,  "samples/bass/3.05.wav", 0, 0, 1 ; Middle C
gifn ftgen 306, 0, 524288, -1,  "samples/bass/3.06.wav", 0, 0, 1 ; Middle C
gifn ftgen 307, 0, 524288, -1,  "samples/bass/3.07.wav", 0, 0, 1 ; Middle C
gifn ftgen 308, 0, 524288, -1,  "samples/bass/3.08.wav", 0, 0, 1 ; Middle C
gifn ftgen 309, 0, 524288, -1,  "samples/bass/3.09.wav", 0, 0, 1 ; Middle C
gifn ftgen 310, 0, 524288, -1,  "samples/bass/3.10.wav", 0, 0, 1 ; Middle C
gifn ftgen 311, 0, 524288, -1,  "samples/bass/3.11.wav", 0, 0, 1 ; Middle C

instr 3
    inum = p5*100
    asig loscil 1, 1, inum, 1 
    outs asig
endin

instr 1
    asound pluck   p4, cpspch(p5), cpspch(p6), p7, p8 p9 p10
    out asound
endin

instr 2
    kenv linen p4, .1, p3, .2; envelope
    asound oscili kenv, cpspch(p5), p6; oscillator
    out asound
endin






instr 4
    aFMinst foscili p4, cpspch(p5), p6, p7, p8, p9
endin

Added samples/bass/1.05.wav version [e6f01c2d0c].

cannot compute difference between binary files

Added samples/bass/1.06.wav version [589b4c9c16].

cannot compute difference between binary files

Added samples/bass/1.07.wav version [b5bd0e0b28].

cannot compute difference between binary files

Added samples/bass/1.08.wav version [4e22c8e289].

cannot compute difference between binary files

Added samples/bass/1.09.wav version [8eafba8350].

cannot compute difference between binary files

Added samples/bass/1.10.wav version [6c9d557273].

cannot compute difference between binary files

Added samples/bass/1.11.wav version [d210644e57].

cannot compute difference between binary files

Added samples/bass/2.00.wav version [df0ad67bd3].

cannot compute difference between binary files

Added samples/bass/2.01.wav version [5e4bdb6301].

cannot compute difference between binary files

Added samples/bass/2.02.wav version [2787d975d6].

cannot compute difference between binary files

Added samples/bass/2.03.wav version [6ce7982e46].

cannot compute difference between binary files

Added samples/bass/2.04.wav version [3c3feb5b24].

cannot compute difference between binary files

Added samples/bass/2.05.wav version [569b7181fc].

cannot compute difference between binary files

Added samples/bass/2.06.wav version [297d4f860f].

cannot compute difference between binary files

Added samples/bass/2.07.wav version [1ac14e3cd2].

cannot compute difference between binary files

Added samples/bass/2.08.wav version [b92037909c].

cannot compute difference between binary files

Added samples/bass/2.09.wav version [760599b161].

cannot compute difference between binary files

Added samples/bass/2.10.wav version [3b900ab89f].

cannot compute difference between binary files

Added samples/bass/2.11.wav version [bcaf91186d].

cannot compute difference between binary files

Added samples/bass/3.00.wav version [5d028b32a1].

cannot compute difference between binary files

Added samples/bass/3.01.wav version [9d6dded4d3].

cannot compute difference between binary files

Added samples/bass/3.02.wav version [78dab72fb7].

cannot compute difference between binary files

Added samples/bass/3.03.wav version [9476ff14fb].

cannot compute difference between binary files

Added samples/bass/3.04.wav version [0822a77edf].

cannot compute difference between binary files

Added samples/bass/3.05.wav version [dc233966b5].

cannot compute difference between binary files

Added samples/bass/3.06.wav version [c254ae3482].

cannot compute difference between binary files

Added samples/bass/3.07-old1.wav version [7e77a9e339].

cannot compute difference between binary files

Added samples/bass/3.07.wav version [23ec2fdb73].

cannot compute difference between binary files

Added samples/bass/3.08.wav version [c799d64faf].

cannot compute difference between binary files

Added samples/bass/3.09.wav version [cedce4e5ea].

cannot compute difference between binary files

Added samples/bass/3.10.wav version [bbc1ef4a09].

cannot compute difference between binary files

Added samples/bass/3.11.wav version [f679f5a61b].

cannot compute difference between binary files

Added samples/bass/Bass.arco.mf.sulE.C2B2.aiff version [b705aee00e].

cannot compute difference between binary files

Added samples/bass/Bass.arco.mf.sulE.C3D3.aiff version [17eacace3a].

cannot compute difference between binary files

Added samples/bass/Bass.arco.mf.sulG.C3B3.aiff version [8b429011eb].

cannot compute difference between binary files

Added samples/bass/Bass.arco.mf.sulG.G2B2.aiff version [8c3a1d88c6].

cannot compute difference between binary files

Added samples/bass/test.orc version [2795c8cc70].

































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
sr=44100
ksmps=20
nchnls=2

gifn ftgen 105, 0, 524288, -1,  "8.05.wav", 0, 0, 1 ; Middle C
gifn ftgen 106, 0, 524288, -1,  "8.06.wav", 0, 0, 1 ; Middle C
gifn ftgen 107, 0, 524288, -1,  "8.07.wav", 0, 0, 1 ; Middle C
gifn ftgen 108, 0, 524288, -1,  "8.08.wav", 0, 0, 1 ; Middle C
gifn ftgen 109, 0, 524288, -1,  "8.09.wav", 0, 0, 1 ; Middle C
gifn ftgen 110, 0, 524288, -1,  "8.10.wav", 0, 0, 1 ; Middle C
gifn ftgen 111, 0, 524288, -1,  "8.18.wav", 0, 0, 1 ; Middle C

instr 1
;    if p5=8.05 then
;        asig diskin "8.05.wav"
;    elseif p5=8.06 then
;        asig diskin "8.06.wav"
;    elseif p5=8.07 then
;        asig diskin "8.07.wav"
;    elseif p5=8.08 then
;        asig diskin "8.08.wav"
;    elseif p5=8.09 then
;        asig diskin "8.09.wav"
;    elseif p5=8.11 then
;        asig diskin "8.10.wav"
;    elseif p5=8.11 then
;        asig diskin "8.18.wav"
;    endif
    inum = p5*100
    asig loscil 1, 1, inum, 1 
    outs asig, asig
endin

Added samples/bass/test.sco version [f5f91e8863].















>
>
>
>
>
>
>
1
2
3
4
5
6
7
f1 0 512 10 1
f2 0 8192 10 .24 .64 .88 .76 .06 .5 .34 .08
f3 0 1025 10 1
t 0 100
    
i1 0.000000 0.50000 7000 1.05
i1 0.500000 1.0000 7000 1.11

Added samples/bass/test.wav version [550291acb7].

cannot compute difference between binary files

Renamed and modified cfg.py [3a0a8776ca] to spiffyscore.py [791db3d131].

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
        "sync_test": {
            "body": {
                "lead_instr": {  # Instrument 'melody'
                    "score_line": "i1 %(time)f %(duration)f 7000 %(octave)d.%(note)s %(octave)d.%(note)s 0 6",
                    "octave": 8,
                    "duration": 30,
                    "grammars": {  # Notes for this instrument to use in this piece
                        "u": ["D/4 D/4 D/4 D/4 (v)"],
                        "v": ["C/4 C/4 C/4 C/4 (u)"],

                    },
                },
                "follow_instr": {  # Instrument 'melody'
                    "score_line": "i2 %(time)f %(duration)f 7000 %(octave)d.%(note)s 1",
                    "sync": "lead_instr",
                    "octave": 8,
                    "duration": 30,
                    "grammars": {  # Notes for this instrument to use in this piece
                        "u": ["D/4 D/4 D/4 D/4 (u)"],
                        "v": ["C/4 C/4 C/4 C/4 (v)"],

                    },
                },
            },
        },
    }
    print '''f1 0 512 10 1
f2 0 8192 10 .24 .64 .88 .76 .06 .5 .34 .08







|
|
>



|
|
|


|
|
>







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
        "sync_test": {
            "body": {
                "lead_instr": {  # Instrument 'melody'
                    "score_line": "i1 %(time)f %(duration)f 7000 %(octave)d.%(note)s %(octave)d.%(note)s 0 6",
                    "octave": 8,
                    "duration": 30,
                    "grammars": {  # Notes for this instrument to use in this piece
                        "u": ["A/4, B/4, C/4 D/4 (u)", "D/4' D/4' D/4' D/4' (v)"],
                        "v": ["C/4 C/4 C/4 C/4 (w)"],
                        "w": ["E/4 F/4 E/4 F/4 (u)"],
                    },
                },
                "follow_instr": {  # Instrument 'melody'
                    "score_line": "i3 %(time)f %(duration)f 7000 %(octave)d.%(note)s",
#                    "sync": "lead_instr",
                    "octave": 2,
                    "duration": 30,
                    "grammars": {  # Notes for this instrument to use in this piece
                        "u": ["E F G E (u)"],
                        "v": ["G A A A (e)"],
                        "e": ["B' A' G' A' (v)"],
                    },
                },
            },
        },
    }
    print '''f1 0 512 10 1
f2 0 8192 10 .24 .64 .88 .76 .06 .5 .34 .08
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
            except KeyError:
                pass


def render_instr(instr, syncs, max_time):
    for g in instr["grammars"]:
        for i in range(len(instr["grammars"][g])):
            instr["grammars"][g][i] = parse.parse(instr["grammars"][g][i])

    score= []
    try:
        score, syncs = choose_phrase(instr, syncs, 0, max_time, None)

        while True:
            score_index_to_replace = None







|







171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
            except KeyError:
                pass


def render_instr(instr, syncs, max_time):
    for g in instr["grammars"]:
        for i in range(len(instr["grammars"][g])):
            instr["grammars"][g][i] = parse.parse(instr["grammars"][g][i], default_octave=instr["octave"])

    score= []
    try:
        score, syncs = choose_phrase(instr, syncs, 0, max_time, None)

        while True:
            score_index_to_replace = None

Deleted test.sco version [e27e42951e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
f1 0 512 10 1
f2 0 8192 10 .24 .64 .88 .76 .06 .5 .34 .08
f3 0 1025 10 1
t 0 100
    
; Section fm_test
; Subsection intro
;Instrument melody
i2 0.000000 1.000000 7000 8.04 2 6 5 1
i2 1.000000 1.000000 7000 8.04 2 6 5 1
i2 2.000000 1.000000 7000 8.05 2 6 5 1
i2 3.000000 1.000000 7000 8.05 2 6 5 1
i2 4.000000 0.500000 7000 8.07 2 6 5 1
i2 4.500000 0.500000 7000 8.07 2 6 5 1
i2 5.000000 3.000000 7000 8.07 2 6 5 1
; Subsection body
; Subsection outro
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































Deleted todo.org version [510751b73f].

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
* Features [4/10]
- [X] Top-down composition
- [ ] Coordinate the melody and rhythm
- [X] Set maximum song length of movement per instrument
- [ ] Set minimum song length of movement per instrument
- [ ] Need to support all chord types
- [X] Doesn't handle rest notes
- [ ] Handle full ABC BNF (yeah, right, that's gonna happen...)
- [X] Set instrument octave in score file
- [ ] Output score to separate file
- [ ] Support parallel voices - ensure e.g. a certain chord progression is always
  accompanied by a certain melody
- [ ] Syncopation
- [ ] Sustain option for notes (give score notation a sustain symbol, and use it to set how long after the notes's duration to keep holding. With sustain, the next note's start time isn't done by when the current note ends. 

* Bugs [5/6]
- [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
- [X] Chords don't respect octaves
- [ ] Whole notes not held for proper duration

* Structure [1/7]    
- [ ] Chords should be composed of Notes, not ordinary arrays
- [ ] There should be a Musical_Phrase object that holds phrases (and sets of
  phrases), and allows them to nest
- [ ] Does each instrument need a score parameter if the grammars are non-terminating?
- [ ] Duration should be in beats, not seconds. This ensures movements don't
  end in the middle of a phrase.
- [ ] Generate score with proper generation tools, not this string-replace nonsense
- [X] Store csound score lines with instruments
- [ ] Upgrade from simple string substitution for the score to something
  list-based (maybe). Idea is to keep musical phrases intact in the event of a
  truncation of the score. Also, if done right, no need for retroactive length
  parsing- a measure is has a specific length, which is known at
  generation-time, thus solving the length limit problem.
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<