コード例 #1
0
ファイル: test.py プロジェクト: diegov/python-pdgen
#!/usr/bin/env python3

from pdgen import PdPatch, RenderVisitor

patch = PdPatch()

def get_pan(pan_position):
    subp = patch.subpatch('pan')

    loadbang = subp.obj('loadbang')
    msg = subp.msg(pan_position)
    loadbang[0].to(msg[0])

    inlet = subp.obj('inlet~')
    
    pan = subp.obj('pan~')
    msg[0].to(pan[1])
    inlet[0].to(pan[0])

    # TODO: Force position!
    outletl = subp.obj('outlet~')
    outletr = subp.obj('outlet~')

    pan[0].to(outletl[0])
    pan[1].to(outletr[0])

    return subp

def get_modulator(carrier_freq, modulator_freq, width):
    subp = patch.subpatch('modulator')
コード例 #2
0
ファイル: testb.py プロジェクト: diegov/python-pdgen
#!/usr/bin/env python3

import sys
from pdgen import PdPatch, RenderVisitor, validation

validation.add_externals_path(sys.argv[1])

patch = PdPatch(validate=True)


def get_pan(pan_position):
    subp = patch.subpatch('pan')

    loadbang = subp.obj('loadbang')
    msg = subp.msg(pan_position)
    loadbang[0].to(msg[0])

    inlet = subp.obj('inlet~')
    
    pan = subp.obj('pan~')
    msg[0].to(pan[1])
    inlet[0].to(pan[0])

    # TODO: Force position!
    outletl = subp.obj('outlet~')
    outletr = subp.obj('outlet~')

    pan[0].to(outletl[0])
    pan[1].to(outletr[0])

    return subp
コード例 #3
0
ファイル: test3.py プロジェクト: diegov/python-pdgen
from pdgen import PdPatch, RenderVisitor
from utils import get_sequence, get_portamento

import math

patch = PdPatch()

dac = patch.obj("dac~")

freqs = [200, 210, 250, 289, 295]

min_freq = min(freqs)

hip = patch.obj("hip~", min_freq * 0.9)

base_ratios = [f / min_freq for f in freqs]
seq_ratios = [1.0, 1.025, 1.5, 1.08, 1.55, 1.125, 1.66, 1.33]

am_mod = None
for i, freq in enumerate(freqs):
    base_ratio = base_ratios[i]
    seq_freqs = [freq * ratio * base_ratio for ratio in seq_ratios]
    seq = get_sequence(patch, 120, seq_freqs)

    patch.loadbang(seq[0])
    osc = patch.obj("osc~")

    portamento = get_portamento(patch, 15 * (1000 / freq))

    seq[0].to(portamento[0])
    portamento[0].to(osc[0])