Ejemplo n.º 1
0
def test_transform_chain():
    s = WAV(african)[10e3:20e3]
    t = MovingAverage(5) * Fade(duration=0.5e3)
    t *= Gain(Line(0, -10, 3e3) | Line(-10, 0, 5e3))
    s *= t
    audio = s.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    play_Audio(audio)
Ejemplo n.º 2
0
def curve_continuity_test():
    c = Line(220, 330, 4e3) | Constant(330, 4e3)
    s = Sine(frequency=c, duration=8e3)

    c2 = Constant(220, 2e3) | Line(220, 330, 9e3) | Constant(330, 2e3)
    s = Sine(frequency=c2, duration=18e3)
    audio = s.mixdown(sample_rate=11025, byte_width=2, max_amplitude=0.2)
    play_Audio(audio)
Ejemplo n.º 3
0
def to_infinity_curve_test():
    c = Line(-80, -10, 10e3)
    p = Line(-100, 100, 5e3)
    #s = Sine(duration=20e3)*Gain(c)
    s = Sine(duration=10e3) * Pan(p)
    audio = s.mixdown(sample_rate=11025, byte_width=2, max_amplitude=0.2)
    #play_Audio(audio)
    export_test(audio, to_infinity_curve_test)
Ejemplo n.º 4
0
def test_gain_param():
    s = WAV(african)[15e3:28e3]
    c1 = Line(-80, 0, duration=8e3)
    c2 = Line(-40, -6, duration=4e3)
    s *= Gain(c1, c2)
    s[1, 4e3:] *= Gain(-6)
    audio = s.mixdown(sample_rate=24000, byte_width=2, max_amplitude=0.2)
    play_Audio(audio)
Ejemplo n.º 5
0
def lowpass_FIR_test():
    #s = WAV(african)[10e3:20e3]*LowPassBasic(cutoff=880, width=100)
    c = Line(55, 110, 3e3) | Constant(110, 2e3)
    c |= Line(110, 220, 3e3) | Constant(220, 2e3)
    c |= Line(220, 440, 3e3) | Constant(440, 2e3)
    c |= Line(440, 880, 3e3) | Constant(880, 2e3)
    s = Sine(frequency=c, duration=20e3)[0:2]
    s[1] *= LowPassBasic(cutoff=330, width=100)
    audio = s.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
Ejemplo n.º 6
0
def pan_stereo_test():
    s = WAV(african)[10e3:30e3]
    t = s[0] * Pan(Line(-100, 50, 20e3)) + s[1] * Pan(Line(0, 100, 20e3))

    # stereo signal panned in space from (-100,0) to (50,100)
    # the stereo field moves right gradually as well as expanding
    # from an opening of 90 degrees to 45 degrees (with headphones)
    Pan.panLaw = -3
    audio = t.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    play_Audio(audio)
Ejemplo n.º 7
0
def Butterworth_test():
    #s = WAV(african)[10e3:20e3]
    c = Line(55, 110, 3e3) | Constant(110, 2e3)
    c |= Line(110, 220, 3e3) | Constant(220, 2e3)
    c |= Line(220, 440, 3e3) | Constant(440, 2e3)
    c |= Line(440, 880, 3e3) | Constant(880, 2e3)
    c |= Line(880, 2 * 880, 3e3) | Constant(2 * 880, 2e3)
    s = Sine(frequency=c, duration=20e3)[0:2]
    s[1] *= Butterworth(cutoff=880)
    audio = s.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    play_Audio(audio)
Ejemplo n.º 8
0
    def realise(self, audio):
        env_start = Line(0, 1, self.attack) | Constant(1, self.hold)
        env_start |= Line(1, self.sustain, duration=self.decay)
        length_start = env_start.num_samples(audio.sample_rate)
        # or maybe as one envelope by extrpolating from audio.duration?
        env_end = Line(self.sustain, 0, duration=self.release)
        length_end = env_end.num_samples(audio.sample_rate)

        audio.audio[:, :length_start] *= env_start.flatten(audio.sample_rate)
        audio.audio[:, length_start:-length_end] *= self.sustain
        audio.audio[:, -length_end:] *= env_end.flatten(audio.sample_rate)
Ejemplo n.º 9
0
def test_amplitude_param():
    s = WAV(african)[15e3:25e3]
    c1 = Constant(1, 3e3) | Line(1, 0.01, duration=7e3)
    c2 = SineCurve(frequency=3, depth=0.3, baseline=0.7, duration=10e3)
    s *= Amplitude(c1, c2)
    audio = s.mixdown(sample_rate=24000, byte_width=2, max_amplitude=0.2)
    play_Audio(audio)
Ejemplo n.º 10
0
def Butterworth_experiment():
    s = WAV(african)[10e3:25e3]
    s1 = s[0] * Butterworth(cutoff=880)
    c = Line(-100, 100, 13e3)
    s2 = s[1] * Pan(c)
    t = s1[0:2] + s2
    audio = t.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    play_Audio(audio)
Ejemplo n.º 11
0
def SweepTest(stay=0.5e3, step=0.5e3):  # start at really low A
    start = 55
    octaves = 4
    c = Constant(start, stay)

    for octave in range(octaves):
        c |= Line(start, start * semitone**4, step) | Constant(
            start * semitone**4, stay)
        start *= semitone**4
        c |= Line(start, start * semitone**3, step) | Constant(
            start * semitone**3, stay)
        start *= semitone**3
        c |= Line(start, start * semitone**5, step) | Constant(
            start * semitone**5, stay)
        start *= semitone**5

    return Sine(frequency=c, duration=(step + stay) * 3 * octaves + stay)
Ejemplo n.º 12
0
def pan_mono_test3():
    s = Sine(duration=2e3) * Pan(-100)
    s |= Sine(duration=2e3) * Pan(0)
    s |= Sine(duration=2e3) * Pan(100)

    c = Line(-100, 100, 5e3) | Logistic(100, -100, duration=5e3)
    s2 = Sine(duration=10e3) * Pan(c)

    Pan.panLaw = -6
    audio = s2.mixdown(sample_rate=11025, byte_width=2, max_amplitude=0.2)
    #play_Audio(audio)
    export_test(audio, pan_mono_test3)
Ejemplo n.º 13
0
def pan_mono_test():
    c = Constant(-100, 2.5e3) | Line(-100, 100, 5e3)
    s = Sine(duration=10e3) * Pan(c)

    audio = s.mixdown(sample_rate=11025, byte_width=2, max_amplitude=0.2)
    play_Audio(audio)