示例#1
0
import dlal

import argparse

parser = argparse.ArgumentParser()
parser.add_argument('subject')
parser.add_argument('--command')
parser.add_argument('--runs', type=int, default=100)
args = parser.parse_args()

audio = dlal.Audio()
dlal.driver_set(audio)
subject = eval(args.subject)
if args.command: exec('subject.'+args.command)
tape = dlal.Tape()

subject.connect(tape)

energy = 0
for i in range(args.runs):
    audio.run()
    x = tape.read()
    energy += sum(i*i for i in x)
print(energy)
示例#2
0
import dlal

import midi as mid

import math
import threading
import time

audio = dlal.Audio()
dlal.driver_set(audio)
comm = dlal.Comm()
midi = dlal.Midi()
train = dlal.Train()
iir = dlal.Iir()
buf = dlal.Buf()
tape = dlal.Tape(1 << 17)

dlal.connect(
    midi,
    train,
    [buf, '<+', iir],
    [audio, tape],
)

iir.pole_pairs_bandpass(0, 0.1)


def sweep():
    low_freq = 440
    sweep_speed = 0.02
    sweep.w = low_freq
示例#3
0
#===== imports =====#
import dlal

import random
import re
import time

#===== system =====#
audio = dlal.Audio(driver=True)
comm = dlal.Comm()
synth = dlal.subsystem.SpeechSynth()
tape = dlal.Tape(44100 * 5)

dlal.connect(
    synth,
    [audio, tape],
)

phonetizer = dlal.speech.Phonetizer(synth.synthesize)


#===== main =====#
def say_code(code):
    phonetizer.say_code(code)


def say(code_string):
    phonetizer.say_code_string(code_string)


def say_all():