Пример #1
0
rhythms = Itemstream("q q. e. s. h e+q 32",
                     tempo=120,
                     notetype=notetypes.rhythm)

pitches = Itemstream("c5 d e f g a b", notetype=notetypes.pitch)

g = Generator(streams=[
    (keys.instrument, 1),
    (keys.rhythm, rhythms),
    (keys.duration, .1),
    (keys.amplitude, 1),
    (keys.frequency, pitches),
],
              note_limit=(len(pitches.values) * 4),
              gen_lines=[';sine', 'f 1 0 16384 10 1'])

g.generate_notes()
print('rhythms in sequence')
csound_utils.play_csound("sine.orc", g, silent=True)

g.streams[keys.rhythm].streammode = streammodes.heap
g.generate_notes()
print('rhythms in heap')
csound_utils.play_csound("sine.orc", g, silent=True)

g.streams[keys.rhythm].streammode = streammodes.random
g.generate_notes()
print('rhythms in random')
csound_utils.play_csound("sine.orc", g, silent=True)
    ],[]),
    streammode=streammodes.heap,
    notetype=notetypes.pitch
)

g = Generator(
    streams=[
        (keys.instrument, 1),
        (keys.rhythm, rhythms),
        (keys.duration, Itemstream([.1])),
        (keys.amplitude, 1),
        (keys.frequency, pitches)
    ],
    pfields=None,
    gen_lines=[';sine',
               'f 1 0 16384 10 1']
)
g.time_limit=120

g2 = copy.deepcopy(g)
g2.streams[keys.rhythm] = Itemstream(['e'],'sequence', tempo=120, notetype=notetypes.rhythm)
g2.streams[keys.frequency] = Itemstream([['c5','d','e'],'g3']*4+['f5','c3']*4+[['c5','d','e'],'g3']*4+['g5','d3']*4,notetype=notetypes.pitch)
g2.streams[keys.amplitude] = Itemstream([.5])
g.add_generator(g2)

g3 = copy.deepcopy(g2)
g.add_generator(g3)
g.generate_notes()

csound_utils.play_csound("sine.orc", g)
Пример #3
0
from thuja.itemstream import notetypes
from thuja.itemstream import Itemstream
from thuja.generator import Generator
from thuja.generator import keys
from thuja import csound_utils

rhythms = Itemstream("q",
                     tempo=120,
                     notetype=notetypes.rhythm)

pitches = Itemstream("c5 d e f g a b",
                     notetype=notetypes.pitch)

g = Generator(
    streams=[
        (keys.instrument, 1),
        (keys.rhythm, rhythms),
        (keys.duration, .1),
        (keys.amplitude, 1),
        (keys.frequency, pitches),
    ],
    note_limit=(len(pitches.values)*4),
    gen_lines=[';sine', 'f 1 0 16384 10 1']
)

g.generate_notes()
score_string = g.generate_score_string()
print(score_string)
csound_utils.play_csound("sine.orc", g, silent=True)
Пример #4
0
    ['c3', 'e', ['c', 'e', 'g'], 'c4', 'e', ['c', 'e', 'g']],
    [['c', 'e', 'g'], ['c', 'e', 'g'], ['c', 'd', 'e'], ['e', 'f', 'g']],
], []),
                     streammode=streammodes.heap,
                     notetype=notetypes.pitch)

g = Generator(streams=[(keys.instrument, 1), (keys.rhythm, rhythms),
                       (keys.duration, Itemstream([.1])), (keys.amplitude, 1),
                       (keys.frequency, pitches)],
              pfields=None,
              gen_lines=[';sine', 'f 1 0 16384 10 1'])
g.time_limit = 120

g2 = copy.deepcopy(g)
g2.streams[keys.rhythm] = Itemstream(['e'],
                                     'sequence',
                                     tempo=120,
                                     notetype=notetypes.rhythm)
g2.streams[keys.frequency] = Itemstream(
    [['c5', 'd', 'e'], 'g3'] * 4 + ['f5', 'c3'] * 4 +
    [['c5', 'd', 'e'], 'g3'] * 4 + ['g5', 'd3'] * 4,
    notetype=notetypes.pitch)
g2.streams[keys.amplitude] = Itemstream([.5])
g.add_generator(g2)

g3 = copy.deepcopy(g2)
g.add_generator(g3)
g.generate_notes()

csound_utils.play_csound("sine.orc", g)