# (1 - 4.99173 * z ** -1 + 10.7810 * z ** -2 - 12.8597 * z ** -3 # + 8.93092 * z ** -4 - 3.42634 * z ** -5 + .569237 * z ** -6)) gain_low = ControlStream(0) gain_high = ControlStream(0) low = filt_low(white_noise()) high = filt_high(white_noise()) low /= 2 * max(low.take(2000)) high /= 2 * max(high.take(2000)) api = sys.argv[1] if sys.argv[1:] else None # Choose API via command-line chunks.size = 1 if api == "jack" else 16 with AudioIO(api=api) as player: player.play(low * gain_low + high * gain_high) gain_low.value = 1 while True: gain_high.value = 0 sleep(1) for unused in xrange(5): # Keeps low playing sleep(0.1) gain_high.value = 0 sleep(0.4) gain_high.value = 1 gain_low.value = 0 sleep(1) for unused in xrange(5): # Keeps high playing sleep(0.1) gain_low.value = 0 sleep(0.4)
with AudioIO() as player: first_coeffs = formants[vowels[0]] # These are signals to be changed during the synthesis f1 = ControlStream(first_coeffs[0] * Hz) f2 = ControlStream(first_coeffs[1] * Hz) gain = ControlStream(0) # For fading in # Creates the playing signal filt = CascadeFilter([ resonator.z_exp(inertia_filter(f1).skip(inertia_dur), 400 * Hz), resonator.z_exp(inertia_filter(f2).skip(inertia_dur), 2000 * Hz), ]) sig = filt((saw_table)(100 * Hz)) * inertia_filter(gain) th = player.play(sig) for vowel in vowels: coeffs = formants[vowel] print("Now playing: ", vowel) f1.value = coeffs[0] * Hz f2.value = coeffs[1] * Hz gain.value = 1 # Fade in the first vowel, changes nothing afterwards sleep(2) # Fade out gain.value = 0 sleep(inertia_dur / s + 1) # Divide by s because here it's already # expecting a value in seconds, and we don't # want ot give a value in a time-squaed unit # like s ** 2
with AudioIO() as player: first_coeffs = formants[vowels[0]] # These are signals to be changed during the synthesis f1 = ControlStream(first_coeffs[0] * Hz) f2 = ControlStream(first_coeffs[1] * Hz) gain = ControlStream(0) # For fading in # Creates the playing signal filt = CascadeFilter([ resonator.z_exp(inertia_filter(f1).skip(inertia_dur), 400 * Hz), resonator.z_exp(inertia_filter(f2).skip(inertia_dur), 2000 * Hz), ]) sig = filt((saw_table)(100 * Hz)) * inertia_filter(gain) th = player.play(sig) for vowel in vowels: coeffs = formants[vowel] print("Now playing: ", vowel) f1.value = coeffs[0] * Hz f2.value = coeffs[1] * Hz gain.value = 1 # Fade in the first vowel, changes nothing afterwards sleep(2) # Fade out gain.value = 0 sleep(inertia_dur / s + .2) # Divide by s because here it's already # expecting a value in seconds, and we don't # want ot give a value in a time-squaed unit # like s ** 2
"ɒ": [700, 760], "ʌ": [600, 1170], "ɔ": [500, 700], "ɤ": [460, 1310], "o": [360, 640], "ɯ": [300, 1390], "u": [250, 595], } inertia_filter = maverage(rint(.5 * s)) with AudioIO() as player: f1, f2 = ControlStream(0), ControlStream(pi) gain = ControlStream(0) filt = CascadeFilter([ resonator.z_exp(inertia_filter(f1), 400 * Hz), resonator.z_exp(inertia_filter(f2), 2000 * Hz), ]) sig = filt((saw_table)(100 * Hz)) * inertia_filter(gain) player.play(sig) vowels = "aɛiɒu" for vowel in vowels: coeffs = formants[vowel] print ("Now playing: ", vowel) f1.value = coeffs[0] * Hz f2.value = coeffs[1] * Hz gain.value = 1 sleep(2)
"ɒ": [700, 760], "ʌ": [600, 1170], "ɔ": [500, 700], "ɤ": [460, 1310], "o": [360, 640], "ɯ": [300, 1390], "u": [250, 595], } inertia_filter = maverage(rint(.5 * s)) with AudioIO() as player: f1, f2 = ControlStream(0), ControlStream(pi) gain = ControlStream(0) filt = CascadeFilter([ resonator.z_exp(inertia_filter(f1), 400 * Hz), resonator.z_exp(inertia_filter(f2), 2000 * Hz), ]) sig = filt((saw_table)(100 * Hz)) * inertia_filter(gain) player.play(sig) vowels = "aɛiɒu" for vowel in vowels: coeffs = formants[vowel] print("Now playing: ", vowel) f1.value = coeffs[0] * Hz f2.value = coeffs[1] * Hz gain.value = 1 sleep(2)
# (1 - 4.99173 * z ** -1 + 10.7810 * z ** -2 - 12.8597 * z ** -3 # + 8.93092 * z ** -4 - 3.42634 * z ** -5 + .569237 * z ** -6)) gain_low = ControlStream(0) gain_high = ControlStream(0) low = filt_low(white_noise()) high = filt_high(white_noise()) low /= 2 * max(low.take(2000)) high /= 2 * max(high.take(2000)) api = sys.argv[1] if sys.argv[1:] else None # Choose API via command-line chunks.size = 1 if api == "jack" else 16 with AudioIO(api=api) as player: player.play(low * gain_low + high * gain_high) gain_low.value = 1 while True: gain_high.value = 0 sleep(1) for unused in xrange(5): # Keeps low playing sleep(.1) gain_high.value = 0 sleep(.4) gain_high.value = 1 gain_low.value = 0 sleep(1) for unused in xrange(5): # Keeps high playing sleep(.1) gain_low.value = 0 sleep(.4)