Exemplo n.º 1
0
def additive_complex_sound_test():
    def s(f, duration):
        return sum([
            (1 / i**1.5) * Sine(frequency=f * i, duration=duration) * ADSR(
                (0.01e3) * (i), 0.8, 0.5 + (1 / (i + 2)), 0.02e3)
            for i in range(1, 20)
        ])

    freqs = [
        midC(-3),
        midC(1),
        midC(-4),
        midC(4),
        midC(6),
        midC(2),
        midC(-1),
        midC(11)
    ] * 2
    duration = 1e3

    t = Signal.concat(*[s(f, duration) for f in freqs])

    audio = t.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    #play_Audio(audio)
    export_test(audio, additive_complex_sound_test)
Exemplo n.º 2
0
def IIR_one_pole_filters_test():
    s = WAV(african)[10e3:20e3]

    s[:5e3] *= IIR_OnePole_LowPass(880)
    s[5e3:] *= IIR_OnePole_HighPass(440)

    audio = s.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    #play_Audio(audio)
    export_test(audio, IIR_one_pole_filters_test)
Exemplo n.º 3
0
def IIR_one_pole_test():
    s = WAV(african)[10e3:20e3]

    Fc = 880 / 44100
    b1 = np.e**(-2 * np.pi * Fc)
    s[:, :5e3] *= IIR_OnePole(1 - b1, b1)

    audio = s.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    #play_Audio(audio)
    export_test(audio, IIR_one_pole_test)
Exemplo n.º 4
0
def next_gen_parse_osc_melody_test():
    from gensound import Square, Signal
    sig = Square

    t = 0.5e3

    v1 = sig("C3 Eb F G F Eb " * 10, duration=t)
    v2 = sig("Eb4=3 Bb " * 10, duration=t)
    v3 = sig("G4=2 A D, " * 10, duration=t)

    s = Signal()
    s[0] = v2
    s[1] = v3
    s += 0.5 * v1
    export_test(s.mixdown(44100), next_gen_parse_osc_melody_test)
Exemplo n.º 5
0
def one_impulse_reverb_test():
    from gensound.effects import OneImpulseReverb
    s = WAV(african)[10e3:20e3] * OneImpulseReverb(
        mix=1.2, num=2000, curve="steep")
    s.play(44100, max_amplitude=0.2)
    export_test(s.mixdown(44100), one_impulse_reverb_test)
Exemplo n.º 6
0
def guitar_amp_test():
    s = WAV(gtrcln) * Gain(20) * GuitarAmp_Test(harshness=10, cutoff=4000)

    audio = s.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    export_test(audio, guitar_amp_test)
Exemplo n.º 7
0
def test_negative_shift_combine():
    s = WAV(african)[10e3:20e3]
    s[5e3:] = s[5e3:] * Shift(1e3)
    audio = s.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    export_test(audio, test_negative_shift_combine)
Exemplo n.º 8
0
def IIR_general_test():
    s = WAV(african)[10e3:20e3]
    s[3e3:] *= IIR_general([0, -0.5, 0, 0], [0.25, 0.15, 0.07, 0.03])
    audio = s.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    # play_Audio(audio)
    export_test(audio, IIR_general_test)
Exemplo n.º 9
0
def IIR_basic_test():
    s = WAV(african)[10e3:20e3]
    s[5e3:] *= IIR_basic()  # y(n) = 0.3*x(n) + 0.7*y(n-1)
    audio = s.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    # play_Audio(audio)
    export_test(audio, IIR_basic_test)