예제 #1
0
def bias():
    from matplotlib import pyplot as plot
    synth = WaveSynth(samplerate=1000)
    waves = []
    waves.append(synth.sine(2, 4, 0.02, bias=0.1))
    waves.append(synth.triangle(2, 4, 0.02, bias=0.2))
    waves.append(synth.pulse(2, 4, 0.02, bias=0.3, pulsewidth=0.45))
    waves.append(synth.harmonics(2, 4, [(n, 1/n) for n in range(1, 8)], 0.02, bias=0.4))
    waves.append(synth.sawtooth(2, 4, 0.02, bias=0.5))
    waves.append(synth.sawtooth_h(2, 4, 7, 0.02, bias=0.6))
    waves.append(synth.square(2, 4, 0.02, bias=0.7))
    waves.append(synth.square_h(2, 4, 7, 0.02, bias=0.8))
    waves.append(synth.white_noise(4, amplitude=0.02, bias=0.9))
    for wave in waves:
        plot.plot(wave.get_frame_array())
    plot.title("All waveforms biased to levels above zero")
    plot.show()
예제 #2
0
def bias():
    from matplotlib import pyplot as plot
    synth = WaveSynth(samplerate=1000)
    waves = []
    waves.append(synth.sine(2, 4, 0.02, bias=0.1))
    waves.append(synth.triangle(2, 4, 0.02, bias=0.2))
    waves.append(synth.pulse(2, 4, 0.02, bias=0.3, pulsewidth=0.45))
    waves.append(
        synth.harmonics(2,
                        4, [(n, 1 / n) for n in range(1, 8)],
                        0.02,
                        bias=0.4))
    waves.append(synth.sawtooth(2, 4, 0.02, bias=0.5))
    waves.append(synth.sawtooth_h(2, 4, 7, 0.02, bias=0.6))
    waves.append(synth.square(2, 4, 0.02, bias=0.7))
    waves.append(synth.square_h(2, 4, 7, 0.02, bias=0.8))
    waves.append(synth.white_noise(4, amplitude=0.02, bias=0.9))
    for wave in waves:
        plot.plot(wave.get_frame_array())
    plot.title("All waveforms biased to levels above zero")
    plot.show()