def __init__(self): # Register 0 ($4008) self.control_flag: bool = False self.linear_ctr_reload_value: int = 0 # Register 2 ($400A) self.timer_low: int = 0 # Register 3 ($400B) self.timer_high: int = 0 self.length_ctr_load: int = 0 self._length_ctr: int = 0 self._linear_ctr: int = 0 self._linear_ctr_reload_flag: bool = False # --- Using LFO gives a full triangle wave --- self.output = pyo.LFO(freq=0, sharp=1, type=3, mul=0) # --- Or we can create a half-triangle using a linear table --- # seq = [(0, 1.), (31, 0.), (32, 0.), (63, 1.)] # self.linear_table = pyo.LinTable(seq, 64) # self.output = pyo.Osc(self.linear_table, freq=0, interp=0, mul=0) self.volume: float = 1.
def __init__(self, **args): pyo.EventInstrument.__init__(self, **args) self.osc = pyo.LFO(freq=self.freq, sharp=1, type=2, mul=self.env) self.mixer = pyo.Mixer() self.mixer.addInput(0, self.osc) self.mixer.setAmp(0, 0, 0.5) self.mixer.setAmp(0, 1, 0.5) self.mixer.out()
def __init__(self): self.fader = pyo.Fader(fadein=0.5, fadeout=0.5) self.lfoo0 = pyo.LFO(freq=0.01, mul=1, type=3) self.lfoo1 = pyo.Sine(freq=0.02, mul=1) self.lfo = pyo.Sine(freq=self.lfoo0 + self.lfoo1, mul=1) self.generator = pyo.SineLoop(freq=100, feedback=0.015 + ((1 + self.lfo) * 0.025), mul=[self.fader, 0, 0]) self.generator.stop() self.stop() self._mul = self.max_vol self._mul_setter = pyo.Trig()
def __init__(self, sequence, amp=1, pan=0.5): BaseSynth.__init__(self, sequence, amp, pan) self.env = pyo.CosTable([(0,0.0000),(953,1.0000),(5737,0.7254),(8192,0.0000)]) self.env_reader = pyo.TrigEnv(self.trig, self.env, dur=pyo.Max(self.dur, comp=0.3125)) self.osc = pyo.LFO(type=2, freq=pyo.Noise(add=1, mul=0.3*self.freq), mul=0.5*self.env_reader) self.pre_filter = pyo.Biquad(self.osc, freq=191) self.disto_env = pyo.CosTable([(0,0.0000),(2118,0.2694),(8192,0.0000)]) self.disto_env_reader = pyo.TrigEnv(self.trig, self.disto_env, dur=self.dur, add=0.7) self.disto = pyo.Disto(self.pre_filter, drive=self.disto_env_reader, mul=0.3) self.freq_env = pyo.CosTable([(0,0.0000),(1553,0.4767),(8192,0.0000)]) self.freq_env_reader = pyo.TrigEnv(self.trig, self.freq_env, dur=self.dur, add=1000, mul=200) self.res_filter = pyo.Biquad(pyo.BrownNoise(mul=self.env_reader), q=6, freq=self.freq_env_reader, mul=0.9, type=2) self.panner = pyo.Pan(self.disto+self.res_filter, mul=self.master_amp, pan=self.master_pan) self.last_audio_object = self.panner
def __init__(self, sequence, amp=1, pan=0.5): BaseSynth.__init__(self, sequence, amp, pan) self.formant = [235,459,1105,2735,4115] self.env = pyo.CosTable([(0,0.0000),(1200,0.9793),(7062,0.7772),(8000,0.0000)]) self.env_reader = pyo.TrigEnv(self.trig, self.env, dur=self.dur) self.source = pyo.LFO(freq=self.freq,mul=self.env_reader) self.eq = pyo.EQ(self.source ,freq=[self.freq], boost=20) self.ffilter = pyo.SVF(self.eq, type=0.5, freq=self.formant, q=10, mul=0.1) self.trans_env = pyo.CosTable([(0,0.0000),(388,0.3731),(2630,0.0518),(7821,0.0000),(8000,0.0000)]) self.trans_env_reader = pyo.TrigEnv(self.trig, self.trans_env, dur=0.25) self.trans = pyo.Noise(mul=self.trans_env_reader) self.trans_filter = pyo.Biquad(self.trans, freq=400) self.trans_resonator = pyo.Biquad(self.trans_filter, q=31, freq=self.freq*2, mul=0.2) self.panner = pyo.Pan(pyo.Compress((self.ffilter+self.trans_resonator).mix(0), mul=self.master_amp,), pan=self.master_pan) self.last_audio_object = self.panner
def build(self): self.pitch = self.pheno.phrases.get(self.data.phrase_id).pitch self.noise = pyo.LFO(self.pitch, type=self.data.type)
trigs = [] trigs.append(pyo.Metro(dur)) trigs.append(pyo.SDelay(trigs[0], delay=delay1)) trigFuncs = [] for i in range(len(trigs)): trigFuncs.append(pyo.TrigFunc(trigs[i], trighandler, arg=i)) freq = pyo.Sig(400) on = pyo.Sig(0) e = pyo.MidiAdsr(on, attack=0.001, decay=0.005, sustain=0.70, release=0.010) hifreq = srate b1 = pyo.LFO(freq=freq, mul=e) v = pyo.Biquad(input=b1, freq=1000, q=2, type=2).out() # #f1.ctrl() #f2.ctrl() #f3.ctrl() b1.ctrl() e.ctrl() v.ctrl() trigs[0].play() s.gui(locals())
import pyo import sys import wx def bienvenida(): print("Generador de Señales - Experiencia Virtual\n") print("Amplitude -> varia la aimplitud, en dB") print("\nfreq -> varia la frecuencia, en Hz") print("Sharp -> cambia la suavidad de la onda") print("Tipos de señales \n 0 default"+\ " \n 1 Saw Down"+ \ " \n 2 Onda Cuadrada"+\ " \n 3 Onda Triangular"+\ " \n 4 Pulsante \n 5 Pulsante Bipolar"+\ " \n 6 Aleatoria \n 7 Modulada\n") print("mul -> es un facto de amplitudd") bienvenida() s = pyo.Server(nchnls=2).boot() actual = pyo.LFO().out(chnl = [0, 1]) actual.ctrl() s.amp = 1 scc = pyo.Scope(actual,wintitle= "Osciloscopio / Generador de Señales") sp = pyo.Spectrum(actual,wintitle = "FFT / Generador de Señales") s.gui(locals()) s.stop() sys.exit()