Ejemplo n.º 1
0
def messy_random_concat_test():
    s = WAV(african)

    max_length = 20e3

    def messy_track():
        t = 0
        temp = 0

        while temp < max_length:
            duration = 400 + np.random.random() * 3e3
            temp += duration
            start = 4e3 + (30 - 4) * np.random.random() * 1e3
            t |= s[start:start + duration]

        return t

    L = messy_track() + messy_track()
    R = messy_track() + messy_track()

    s = L * Repan(0, None) + R * Repan(None, 1)

    t = sum([(1 - 8 / 10) * s * Shift(duration=100 * x) *
             MovingAverage(width=2 * x + 1) for x in range(5)])
    t += 0.6 * s * Downsample(factor=5) * MovingAverage(width=5)

    audio = t.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    play_Audio(audio)
Ejemplo n.º 2
0
def log_amp_test():
    # tests logarithmic scaling of amplitude factors
    signal = WAV(african) * Repan(0, None)  #switch L/R
    signal += 0.125 * WAV(african) * Repan(None, 1)
    audio = signal.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.5)
    play_Audio(audio, is_wait=True)
    pass
Ejemplo n.º 3
0
def reverse_phase_test():
    s = WAV(african)

    L = s[10e3:11e3] | -s[11e3:12e3] | s[12e3:13e3] | -s[13e3:14e3] | s[14e3:15e3] \
        | -s[15e3:16e3] | s[16e3:17e3]
    R = s[10e3:17e3]

    s = L * Repan(0, None) + R * Repan(None, 1)

    audio = s.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    #play_Audio(audio)
    export_test(audio, reverse_phase_test)
Ejemplo n.º 4
0
def slice_set_test():
    s = WAV(african)
    # careful with 5e3, creates float slices

    #s[5e3:18e3] = s[5e3:18e3]*Repan() + s[5e3:18e3]*Downsample(5)*Gain(-3)
    #s[5e3:18e3] *= Repan(1,0)
    s[5e3:18e3] = s[5e3:18e3] * Repan(1, None) + s[5e3:18e3] * Repan(None, 0)
    # TODO found a bug here? does it really keep both copies of the slice separate?
    # also test s = s[0:50] & sine() & s[50:100]

    audio = s.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    play_Audio(audio)
Ejemplo n.º 5
0
def concat_scalar_test():
    s = WAV(african)

    gap = 0.03
    L = s[10e3:11e3] | gap | s[11e3:12e3] | gap | s[12e3:13e3] | gap | s[13e3:14e3] \
        | gap | s[14e3:15e3] | gap | s[15e3:16e3] | gap | s[16e3:24e3]
    R = s[10e3:18e3] | gap | s[18e3:19e3] | gap | s[19e3:20e3] | gap | s[20e3:21e3] \
        | gap | s[21e3:24e3]

    s = L * Repan(0, None) + R * Repan(None, 1)

    audio = s.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    play_Audio(audio)
Ejemplo n.º 6
0
def cancellation_test():
    #signal = Sine(duration=5000) - 0.999*Sine(duration=5000)
    #signal += 0.01*Sine(frequency=130,duration=1000)
    signal = WAV(african) - WAV(african) * Repan(1, 0)
    #signal += 0.5*WAV(african) # basically neautralized the center "channel"
    #signal += 5.0*WAV(african) # strengthens center

    audio = signal.mixdown(sample_rate=44100, byte_width=2, max_amplitude=0.2)
    play_Audio(audio, is_wait=True)
Ejemplo n.º 7
0
def gain_test():
    signal = WAV(african) * Repan(0, None)
    signal += WAV(african) * Repan(None, 1) * Gain(-9)
    audio = signal.mixdown(sample_rate=44100, byte_width=2, max_amplitude=None)
    play_Audio(audio, is_wait=True)
Ejemplo n.º 8
0
def repan_test():
    signal = WAV(african) * Repan(1, 0)  #switch L/R
    audio = signal.mixdown(sample_rate=44100, byte_width=2, max_amplitude=None)
    play_Audio(audio, is_wait=True)
    pass