b_plots = True  # True if you want to plot the extracted parameters.

    # PROCESS:============================================================================
    lu.mkdir(out_dir)

    # ANALYSIS:
    print("Analysing.....................................................")
    m_mag, m_real, m_imag, v_f0, fs, v_shift = mp.analysis_lossless(
        wav_file_orig)

    # MODIFICATIONS:
    # You can modify the parameters here if wanted.

    # SYNTHESIS:
    print("Synthesising.................................................")
    v_syn_sig = mp.synthesis_from_lossless(m_mag, m_real, m_imag, v_f0, fs)

    # SAVE WAV FILE:
    print("Saving wav file..............................................")
    wav_file_syn = out_dir + '/' + lu.get_filename(
        wav_file_orig) + '_copy_syn_lossless.wav'
    la.write_audio_file(wav_file_syn, v_syn_sig, fs)

    # PLOTS:===============================================================================
    if b_plots:
        plots(m_mag, m_real, m_imag, v_f0)
        raw_input("Press Enter to close de figs and finish...")
        lp.close('all')

    print('Done!')
Beispiel #2
0
        phase_dim=phase_dim,
        b_const_rate=b_const_rate)

    # MODIFICATIONS:
    # You can modify the parameters here if wanted.

    # SYNTHESIS:
    print("Synthesising.................................................")
    v_syn_sig = mp.synthesis_from_compressed(m_mag_mel_log,
                                             m_real_mel,
                                             m_imag_mel,
                                             v_lf0_smth,
                                             fs,
                                             b_const_rate=b_const_rate,
                                             b_out_hpf=False)

    # SAVE WAV FILE:
    print("Saving wav file..............................................")
    wav_file_syn = out_dir + '/' + lu.get_filename(wav_file_orig) + (
        '_copy_syn_low_dim_mag_dim_%d_ph_dim_%d_const_rate_%d.wav' %
        (mag_dim, phase_dim, b_const_rate))
    la.write_audio_file(wav_file_syn, v_syn_sig, fs)

    # PLOTS:===============================================================================
    if b_plots:
        plots(m_mag_mel_log, m_real_mel, m_imag_mel, v_lf0_smth)
        raw_input("Press Enter to close de figs and finish...")
        lp.close('all')

    print('Done!')
    lu.mkdir(out_dir)

    # ANALYSIS:
    print("Analysing.....................................................")
    m_mag, m_real, m_imag, v_f0 = analysis(wav_file_orig, fft_len)

    # MODIFICATIONS:
    # If wanted, you can do modifications to the parameters here.

    # SYNTHESIS:
    print("Synthesising.................................................")
    v_syn_sig = synthesis(m_mag, m_real, m_imag, v_f0, fs)

    # SAVE WAV FILE:
    print("Saving wav file..............................................")
    wav_file_syn = out_dir + '/' + lu.get_filename(wav_file_orig) + '_copy_syn_high_res.wav'
    la.write_audio_file(wav_file_syn, v_syn_sig, fs)

    # PLOTS:===============================================================================
    if b_plots:
        plots(m_mag, m_real, m_imag, v_f0)
        raw_input("Press Enter to close de figs and finish...")
        lp.close('all')

    print('Done!')





    lu.mkdir(out_dir)

    # ANALYSIS:
    print("Analysing.....................................................")
    m_mag, m_real, m_imag, v_f0, fs, v_shift = mp.analysis_lossless(wav_file_orig)

    # MODIFICATIONS:
    # You can modify the parameters here if wanted.

    # SYNTHESIS:
    print("Synthesising.................................................")
    v_syn_sig = mp.synthesis_from_lossless(m_mag, m_real, m_imag, v_f0, fs)

    # SAVE WAV FILE:
    print("Saving wav file..............................................")
    wav_file_syn = out_dir + '/' + lu.get_filename(wav_file_orig) + '_copy_syn_lossless.wav'
    la.write_audio_file(wav_file_syn, v_syn_sig, fs)

    # PLOTS:===============================================================================
    if b_plots:
        plots(m_mag, m_real, m_imag, v_f0)
        raw_input("Press Enter to close de figs and finish...")
        lp.close('all')

    print('Done!')