Ejemplo n.º 1
0
 def get_single_note(data_1, data_2, shift_steps, seconds):
     return np.concatenate([
         shift(get_note_of_length(data_2, seconds), shift_steps * 2),
         quiet(0.05)
     ] + ([
         shift(data_1[:int(random.random() * len(data_1))], shift_steps * 2)
     ] if random.random() > .5 else []))
Ejemplo n.º 2
0
def high_honk_seq_3(shift_amt=0, overlay_factor=0, cutoffs=(500, 2500)):
    s, o = shift_amt, overlay_factor
    stretched_high_honk = stretch(
        np.flip(os_honk(s + 1, o + 3, 0)[:1000], axis=0), .2)
    honkseq = np.concatenate([
        shift(stretched_high_honk, 4),
        shift(stretched_high_honk, 6),
        quiet(.3),
        shift(stretched_high_honk, 6),
        shift(stretched_high_honk, 4)
    ])
    return butter_band_filter(honkseq, cutoffs)
Ejemplo n.º 3
0
 def os_honk(shift_amt, overlay_factor):
     return overlay_decaying(shift(honks[3], -6 * shift_amt),
                             num_times=1 + overlay_factor * 2)
Ejemplo n.º 4
0
def shift_to_target(data, source_freq, target_freq, bins_per_oct=24):
    shift_amount = get_shift_factor(source_freq, target_freq, bins_per_oct)
    return shift(data, shift_amount)
Ejemplo n.º 5
0
if __name__ == "__main__":
    description = 'plesae provide a honk file pattern to construct birthday verses'
    parser = argparse.ArgumentParser(description=description)
    parser.add_argument('pattern', type=file, action='store', nargs='+')
    #base_path = '/Users/cail029/Documents/utility/geese/'
    honks = []
    for file in parser.parse_args().files:
        honks.append(load_data_with_sr(file))
    #honks = [load_data_with_sr(os.path.join(base_path, 'honk_%s.ogg' % i)) for i in range(8)]
    honks = [honk / np.max(honk) * 0.8 for honk in honks]
    geese = load_data_with_sr(os.path.join(base_path, 'geese.mp3'))
    fft_freqs, pitches, magnitudes = get_binned_freqs_mags(geese,
                                                           threshold=0.15)
    ode_shifts = [2, 0, -2, -4, -6, -8, -10, -12, -8, -6, -6, -4, -4, -2]
    ode = np.concatenate([stretch(shift(honks[0], x), .4) for x in ode_shifts])

    t = np.linspace(0, 0.5, 0.5 * dsr)
    abscos = np.abs(np.cos(60 * np.pi * t) + np.cos(70 * np.pi * t) + 2) / 4
    h2_mod = (shift(stretch(honks[2], 0.75), -12 * 7)[:16000])
    h1_mod = shift(stretch(honks[1], 0.25), -12 * 7)[:11000]

    dpl_rep = np.concatenate(
        [repeated(modified_dpl(freq=120), 3),
         modified_dpl(freq=60)], axis=0)

    def quiet(duration=1.0):
        return bf.triangle(freq=80)(np.linspace(0, duration,
                                                duration * dsr)) * .01

    def os_honk(shift_amt, overlay_factor):