y=source[2],
        )
    if len(source) != state['channel_count']:
        source = ugentools.Mix.multichannel(source, state['channel_count'])
    source *= builder['gain'].db_to_amplitude()
    source *= state['buffer_window']
    if iterations > 1:
        source /= iterations
    return source


warp_buffer_player_factory = synthdeftools.SynthDefFactory(
    buffer_id=0,
    channel_count=2,
    direction=1,
    gain=0,
    overlaps=32,
    rate=1,
    transpose=0,
    ) \
    .with_signal_block(signal_block) \
    .with_rand_id() \
    .with_output()

warp_buffer_player = warp_buffer_player_factory.build(name='warp')

__all__ = [
    'warp_buffer_player',
    'warp_buffer_player_factory',
]

def signal_block(builder, source, state):
    source *= ugentools.Line.kr(duration=0.1)  # protect against clicks
    sign = builder['sign']
    frequency = ugentools.LFNoise2.kr(frequency=0.01).scale(-1, 1, 100,
                                                            1000) * sign
    source = ugentools.FreqShift.ar(
        source=source,
        frequency=frequency,
        phase=ugentools.LFNoise2.kr(frequency=0.01),
    )
    return source


factory = synthdeftools.SynthDefFactory(channel_count=2, sign=1)
factory = factory.with_input()
factory = factory.with_signal_block(signal_block)

nrt_freqshift_factory = factory \
    .with_output(crossfaded=True, leveled=True, windowed=True) \
    .with_rand_id()

rt_freqshift_factory = factory \
    .with_gate() \
    .with_output(crossfaded=True) \
    .with_silence_detection()

nrt_freqshift = nrt_freqshift_factory.build(name='freqshift')
rt_freqshift = rt_freqshift_factory.build(name='freqshift')
Exemple #3
0
    return source


def feedback_loop(builder, source, state):
    #source = synthdeftools.UGenArray((source[-1],) + source[:-1])
    source = ugentools.HPF.ar(
        source=source,
        frequency=1000,
    )
    source *= ugentools.LFNoise1.kr(frequency=0.05).squared().s_curve()
    source *= -0.99
    return source


factory = synthdeftools.SynthDefFactory(
    channel_count=2,
    gain=0,
)
factory = factory.with_input()
factory = factory.with_signal_block(signal_block_pre)
factory = factory.with_signal_block(signal_block)
factory = factory.with_signal_block(signal_block_post)
factory = factory.with_feedback_loop(feedback_loop)

nrt_allpass_factory = factory \
    .with_output(crossfaded=True, leveled=True, windowed=True) \
    .with_rand_id()

rt_allpass_factory = factory \
    .with_gate() \
    .with_output(crossfaded=True) \
    .with_silence_detection()
Exemple #4
0
    source = ugentools.LeakDC.ar(source=source)
    source *= builder['gain'].db_to_amplitude()
    source = ugentools.Limiter.ar(
        duration=ugentools.Rand.ir(0.005, 0.015),
        source=source,
        )
    return source


def feedback_loop(builder, source, state):
    return source * ugentools.DC.kr(-12).db_to_amplitude() * -1


factory = synthdeftools.SynthDefFactory(
    channel_count=2,
    frequency=1,
    gain=0,
    )
factory = factory.with_input()
factory = factory.with_signal_block(signal_block_pre)
factory = factory.with_signal_block(signal_block)
factory = factory.with_signal_block(signal_block_post)
factory = factory.with_feedback_loop(feedback_loop)

nrt_chorus_factory = factory \
    .with_output(crossfaded=True, leveled=True, windowed=True) \
    .with_rand_id()

rt_chorus_factory = factory \
    .with_gate() \
    .with_output(crossfaded=True) \
Exemple #5
0
def signal_block(builder, source, state):
    iterations = int(state.get('iterations', 4))
    source = ugentools.Dust2.ar(density=[builder['density']] * iterations, )
    source /= builder['density'].square_root()
    if state['channel_count'] > 1:
        position = ugentools.LFNoise1.kr(frequency=[0.5] * iterations, ) * 0.5
        if state['channel_count'] > 2:
            source = ugentools.PanAz.ar(
                channel_count=state['channel_count'],
                position=position,
                source=source,
            )
        else:
            source = ugentools.Pan2.ar(
                position=position,
                source=source,
            )
    source = ugentools.Mix.multichannel(source, state['channel_count'])
    source *= builder['gain'].db_to_amplitude()
    source /= iterations
    return source


factory = synthdeftools.SynthDefFactory(density=10, gain=0)
factory = factory.with_signal_block(signal_block)
factory = factory.with_output(windowed=True)

nrt_dust = factory.with_rand_id().build(name='dust')

__all__ = ['nrt_dust']
    source = ugentools.FreqShift.ar(
        source=source,
        frequency=ugentools.Rand.ir(-1, 1),
    )
    source = ugentools.DelayC.ar(
        source=source,
        delay_time=ugentools.LFNoise1.kr(frequency=0.05, ).scale(
            -1, 1, 0.1, 0.2),
        maximum_delay_time=0.2,
    )
    return source


factory = synthdeftools.SynthDefFactory(
    channel_count=2,
    damping=0.9,
    gain=0,
    room_size=0.5,
)
factory = factory.with_input()
factory = factory.with_signal_block(signal_block_pre)
factory = factory.with_signal_block(signal_block)
factory = factory.with_signal_block(signal_block_post)
factory = factory.with_feedback_loop(feedback_loop)

nrt_freeverb_factory = factory \
    .with_output(crossfaded=True, leveled=True, windowed=True) \
    .with_rand_id()

rt_freeverb_factory = factory \
    .with_gate() \
    .with_output(crossfaded=True) \
        output_minimum=start_frequency,
        output_maximum=stop_frequency,
        exponential=True,
    )
    source = ugentools.BPF.ar(
        source=source,
        frequency=frequency,
        reciprocal_of_q=0.25,
    )
    source *= builder['gain'].db_to_amplitude()
    return source


factory = synthdeftools.SynthDefFactory(
    channel_count=2,
    gain=0,
    start_frequency=15000,
    stop_frequency=100,
)
factory = factory.with_input()
factory = factory.with_signal_block(signal_block)

nrt_bpf_sweep_factory = factory \
    .with_output(crossfaded=True, leveled=True, windowed=True) \
    .with_rand_id()

nrt_bpf_sweep = nrt_bpf_sweep_factory.build(name='bpf_sweep')

__all__ = (
    'nrt_bpf_sweep',
    'nrt_bpf_sweep_factory',
)
Exemple #8
0
        source=source,
        frequency=ugentools.Rand.ir(-1, 1),
    )
    source = ugentools.DelayC.ar(
        source=source,
        delay_time=ugentools.LFNoise1.kr(frequency=0.05, ).scale(
            -1, 1, 0.1, 0.2),
        maximum_delay_time=0.2,
    )
    return source


factory = synthdeftools.SynthDefFactory(
    channel_count=2,
    gain=0,
    pitch_dispersion=0,
    pitch_shift=0.,
    time_dispersion=0,
    window_size=0.5,
)
factory = factory.with_input()
factory = factory.with_signal_block(signal_block_pre)
factory = factory.with_signal_block(signal_block)
factory = factory.with_signal_block(signal_block_post)
factory = factory.with_feedback_loop(feedback_loop)

nrt_pitchshift_factory = factory \
    .with_output(crossfaded=True, leveled=True, windowed=True) \
    .with_rand_id()

rt_pitchshift_factory = factory \
    .with_gate() \
Exemple #9
0
def signal_block_post(builder, source, state):
    source = ugentools.LeakDC.ar(source=source)
    source *= builder['gain'].db_to_amplitude()
    source = ugentools.Limiter.ar(
        duration=ugentools.Rand.ir(0.005, 0.015),
        source=source,
    )
    return source


factory = synthdeftools.SynthDefFactory(
    channel_count=2,
    decay_scale=1,
    frequency_offset=0,
    frequency_scale=1,
    gain=0,
    frequency_minimum=20,
    frequency_maximum=1000,
)
factory = factory.with_input()
factory = factory.with_signal_block(signal_block_pre)
factory = factory.with_signal_block(signal_block)
factory = factory.with_signal_block(signal_block_post)

nrt_klank_random_factory = factory \
    .with_output(crossfaded=True, leveled=True, windowed=True) \
    .with_rand_id()
nrt_klank_random = nrt_klank_random_factory.build(name='klank_random')

__all__ = (
Exemple #10
0
        band *= builder[band_name + 'postgain'].db_to_amplitude()
        compressors.extend(band)
    assert len(compressors) == state['channel_count'] * (len(frequencies) + 1)
    source = ugentools.Mix.multichannel(compressors, state['channel_count'])
    assert len(source) == state['channel_count']
    source *= builder[band_name + 'postgain'].db_to_amplitude()
    source = ugentools.Limiter.ar(
        source=source,
        duration=builder['limiter_lookahead'],
    )
    return source


factory = synthdeftools.SynthDefFactory(
    channel_count=2,
    pregain=0,
    postgain=0,
    limiter_lookahead=0.01,
)
factory = factory.with_initial_state(
    frequencies=mel_frequencies,
    default_threshold_low=-16,
    default_threshold_high=-32,
    default_slope_above=0.75,
)
factory = factory.with_parameter_block(parameter_block)
factory = factory.with_input()
factory = factory.with_signal_block(signal_block)
factory = factory.with_output(replacing=True)

multiband_compressor_factory = factory
multiband_compressor = factory.build(name='multiband-compressor')
Exemple #11
0
        0,
        1,
        ugentools.ExpRand.ir(1, 20),
        ugentools.ExpRand.ir(1, 20),
        exponential=True,
    )
    lfo = ugentools.LFPar.kr(frequency=lfo_frequency)
    frequency = lfo.scale(
        -1,
        1,
        ugentools.Rand.ir(10000,
                          ugentools.SampleRate.ir() * 0.5),
        ugentools.SampleRate.ir() * 0.5,
    )
    source = ugentools.LPF.ar(
        source=source,
        frequency=frequency,
    )
    return source


factory = synthdeftools.SynthDefFactory(channel_count=2) \
    .with_input() \
    .with_signal_block(signal_block) \
    .with_output(crossfaded=True, leveled=True, windowed=True) \
    .with_rand_id()

lp_flicker = factory.build(name='lp_flicker')

__all__ = ('lp_flicker', )