コード例 #1
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)
コード例 #2
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)
コード例 #3
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)
コード例 #4
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)
コード例 #5
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)
コード例 #6
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)
コード例 #7
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)