) band = band.tanh() # hmm! band *= builder[band_name + "postgain"].db_to_amplitude() compressors.extend(band) assert len(compressors) == state["channel_count"] * (len(frequencies) + 1) source = ugens.Mix.multichannel(compressors, state["channel_count"]) assert len(source) == state["channel_count"] source *= builder[band_name + "postgain"].db_to_amplitude() source = ugens.Limiter.ar(source=source, duration=builder["limiter_lookahead"]) return source factory = (synthdefs.SynthDefFactory( channel_count=project_settings["server_options"] ["output_bus_channel_count"], pregain=0, postgain=0, limiter_lookahead=0.01, ).with_initial_state( frequencies=mel_frequencies, default_threshold_low=-16, default_threshold_high=-32, default_slope_above=0.75, ).with_parameter_block(parameter_block).with_input().with_signal_block( signal_block).with_output(replacing=True)) compressor_synthdef = factory.build(name="compressor") __all__ = ["compressor_synthdef"]
fade_out_duration = builder["fade_out_duration"] sustain_duration = ( builder["duration"] - builder["fade_in_duration"] - builder["fade_out_duration"] ) envelope = synthdefs.Envelope( amplitudes=[0, 1, 1, 0], durations=[fade_in_duration, sustain_duration, fade_out_duration], curves=[builder["fade_in_curve"], builder["fade_out_curve"]], ).kr(done_action=DoneAction.FREE_SYNTH) return source * envelope * builder["gain"].db_to_amplitude() factory = ( synthdefs.SynthDefFactory( buffer_id=0, channel_count=project_settings["server_options"]["output_bus_channel_count"], duration=0, fade_in_duration=0, fade_in_curve=-4, fade_out_duration=0, fade_out_curve=-4, gain=0, ) .with_signal_block(signal_block) .with_output() ) player_synthdef = factory.build(name="player") __all__ = ["player_synthdef"]
from supriya import synthdefs, ugens from .. import project_settings def signal_block(builder, source, state): source *= ugens.Line.kr(duration=0.1) # protect against clicks sign = builder["sign"] frequency = ugens.LFNoise2.kr(frequency=0.01).scale(-1, 1, 100, 1000) * sign source = ugens.FreqShift.ar(source=source, frequency=frequency, phase=ugens.LFNoise2.kr(frequency=0.01)) return source factory = (synthdefs.SynthDefFactory( channel_count=project_settings["server_options"] ["output_bus_channel_count"], sign=1, ).with_input().with_signal_block(signal_block).with_rand_id()) freqshift_synthdef = factory.with_gate().with_output( crossfaded=True).build("freqshift") windowed_freqshift_synthdef = factory.with_output( crossfaded=True, leveled=True, windowed=True).build(name="windowed_freqshift") __all__ = ["freqshift_synthdef", "windowed_freqshift_synthdef"]
return source def feedback_loop(builder, source, state): source = ugens.HPF.ar(source=source, frequency=1000) source *= ugens.LFNoise1.kr(frequency=0.05).squared().s_curve() source *= -0.99 return source factory = ( synthdefs.SynthDefFactory( channel_count=project_settings["server_options"]["output_bus_channel_count"], gain=0, ) .with_input() .with_signal_block(signal_block_pre) .with_signal_block(signal_block) .with_signal_block(signal_block_post) .with_feedback_loop(feedback_loop) .with_rand_id() ) allpass_synthdef = factory.with_output(crossfaded=True).build(name="allpass") windowed_allpass_synthdef = factory.with_output( crossfaded=True, leveled=True, windowed=True ).build(name="windowed_allpass") __all__ = ["allpass_synthdef", "windowed_allpass_synthdef"]
just_under_nyquist = (ugens.SampleRate.ir() / 2) * 0.99 start_frequency = builder["start_frequency"].clip(100, just_under_nyquist) stop_frequency = builder["stop_frequency"].clip(100, just_under_nyquist) frequency = state["line"].scale( input_minimum=0, input_maximum=1, output_minimum=start_frequency, output_maximum=stop_frequency, exponential=True, ) source = ugens.BPF.ar(source=source, frequency=frequency, reciprocal_of_q=0.25) source *= builder["gain"].db_to_amplitude() return source factory = (synthdefs.SynthDefFactory( channel_count=project_settings["server_options"] ["output_bus_channel_count"], gain=0, start_frequency=15000, stop_frequency=100, ).with_input().with_output( crossfaded=True, leveled=True, windowed=True).with_rand_id().with_signal_block(signal_block)) windowed_bpf_sweep_synthdef = factory.build(name="windowed_bpf_sweep") __all__ = ["windowed_bpf_sweep_synthdef"]
from .. import project_settings def signal_block(builder, source, state): source = ugens.PlayBuf.ar( channel_count=1, buffer_id=builder["buffer_id"], done_action=DoneAction.FREE_SYNTH, rate=builder["rate"] * ugens.BufRateScale.kr(buffer_id=builder["buffer_id"]), ) source = ugens.PanAz.ar(source=source, channel_count=state["channel_count"], position=builder["pan"]) return source * builder["gain"].db_to_amplitude() factory = (synthdefs.SynthDefFactory( buffer_id=0, channel_count=project_settings["server_options"] ["output_bus_channel_count"], gain=0, pan=0, rate=1, ).with_signal_block(signal_block).with_rand_id().with_output()) one_shot_player_synthdef = factory.build(name="one_shot_player") __all__ = ["one_shot_player_synthdef"]
) if len(source) != state["channel_count"]: source = ugens.Mix.multichannel(source, state["channel_count"]) source *= builder["gain"].db_to_amplitude() source *= state["buffer_window"] if iterations > 1: source /= iterations return source factory = ( synthdefs.SynthDefFactory( buffer_id=0, channel_count=project_settings["server_options"]["output_bus_channel_count"], direction=1, gain=0, overlaps=32, rate=1, transpose=0, ) .with_signal_block(signal_block) .with_rand_id() .with_output() ) warp_buffer_player_synthdef = factory.build(name="warp") warp_buffer_player_factory = factory __all__ = ["warp_buffer_player_factory", "warp_buffer_player_synthdef"]
source *= ugens.LFNoise1.kr(frequency=0.05).squared().s_curve() source = ugens.FreqShift.ar(source=source, frequency=ugens.Rand.ir(-1, 1)) source = ugens.DelayC.ar( source=source, delay_time=ugens.LFNoise1.kr(frequency=0.05).scale(-1, 1, 0.1, 0.2), maximum_delay_time=0.2, ) return source factory = (synthdefs.SynthDefFactory( channel_count=project_settings["server_options"] ["output_bus_channel_count"], gain=0, pitch_dispersion=0, pitch_shift=0.0, time_dispersion=0, window_size=0.5, ).with_input().with_signal_block(signal_block_pre).with_signal_block( signal_block).with_signal_block(signal_block_post).with_feedback_loop( feedback_loop).with_rand_id()) windowed_pitchshift_synthdef = factory.with_output( crossfaded=True, leveled=True, windowed=True).build(name="windowed_pitchshift") pitchshift_synthdef = (factory.with_gate().with_output(crossfaded=True)).build( name="pitchshift") __all__ = ["pitchshift_synthdef", "windowed_pitchshift_synthdef"]
def signal_block(builder, source, state): line = state["line"] lfo_frequency = line.scale(0, 1, ugens.ExpRand.ir(1, 20), ugens.ExpRand.ir(1, 20), exponential=True) lfo = ugens.LFPar.kr(frequency=lfo_frequency) frequency = lfo.scale( -1, 1, ugens.Rand.ir(500, ugens.SampleRate.ir() / 2), ugens.SampleRate.ir() * 0.5, ) source = ugens.LPF.ar(source=source, frequency=frequency) return source factory = (synthdefs.SynthDefFactory( channel_count=project_settings["server_options"] ["output_bus_channel_count"]).with_input().with_signal_block( signal_block).with_output(crossfaded=True, leveled=True, windowed=True).with_rand_id()) lp_flicker_synthdef = factory.build(name="lp_flicker") __all__ = ["lp_flicker_synthdef"]
source = ugens.DecodeB2.ar(channel_count=state["channel_count"], w=source[0], x=source[1], y=source[2]) hp_frequency = state["line"].clip(0, 0.5) * 2 hp_frequency = hp_frequency.scale(0, 1, ugens.SampleRate.ir() * 0.45, 20, exponential=True) lp_frequency = state["line"].clip(0.5, 1).scale(0.5, 1.0, 0, 1) lp_frequency = lp_frequency.scale(0, 1, ugens.SampleRate.ir() * 0.45, 20) source = ugens.BHiPass.ar(source=source, frequency=hp_frequency, reciprocal_of_q=10) source = ugens.BLowPass.ar(source=source, frequency=lp_frequency, reciprocal_of_q=10) source *= builder["gain"].db_to_amplitude() return source factory = (synthdefs.SynthDefFactory( channel_count=2, gain=0).with_signal_block(signal_block).with_rand_id().with_output( crossfaded=True, leveled=True, windowed=True)) noise_wash_synthdef = factory.build(name="noise_wash") __all__ = ["noise_wash_synthdef"]