示例#1
0
def load_test_feature():
    filenames1 = ModelConfig.Audio_test_filename
    filenames2 = ModelConfig.Noise_test_filename

    mixed_wav, src1_wav, src2_wav = get_random_wav_batch(
        filenames1, filenames2, ModelConfig.SECOND, ModelConfig.SR)
    mixed_wav = get_batch_frame(mixed_wav)
    src1_wav = get_batch_frame(src1_wav)
    src2_wav = get_batch_frame(src2_wav)

    mixed_spec = get_spec(mixed_wav)
    mixed_mag = get_magnitude(mixed_spec)
    mixed_phase = get_phase(mixed_spec)

    src1_spec, src2_spec = get_spec(src1_wav), get_spec(src2_wav)
    src1_mag, src2_mag = get_magnitude(src1_spec), get_magnitude(src2_spec)
    src1_phase = get_phase(src1_spec)

    src1_batch, _ = spec_to_batch(src1_mag)
    src2_batch, _ = spec_to_batch(src2_mag)
    mixed_batch, _ = spec_to_batch(mixed_mag)
    mixed_phase_batch, _ = spec_to_batch(mixed_phase)
    src1_phase_batch, _ = spec_to_batch(src1_phase)

    # batch_size, n_frames, n_freq
    return mixed_batch, src1_batch, src2_batch, mixed_spec, mixed_phase_batch, src1_phase_batch, mixed_wav, src1_wav
示例#2
0
def load_feature_new(mixed_wav, src1_wav, src2_wav):
    mixed_wav = get_batch_frame(mixed_wav)
    src1_wav = get_batch_frame(src1_wav)
    src2_wav = get_batch_frame(src2_wav)

    mixed_spec = get_spec(mixed_wav)
    mixed_mag = get_magnitude(mixed_spec)

    src1_spec, src2_spec = get_spec(src1_wav), get_spec(src2_wav)
    src1_mag, src2_mag = get_magnitude(src1_spec), get_magnitude(src2_spec)

    src1_batch, _ = spec_to_batch(src1_mag)
    src2_batch, _ = spec_to_batch(src2_mag)
    mixed_batch, _ = spec_to_batch(mixed_mag)

    # batch_size, n_frames, n_freq
    return mixed_batch, src1_batch, src2_batch