Exemplo n.º 1
0
Arquivo: test.py Projeto: mayite/aukit
def test_audio_griffinlim():
    from aukit.audio_griffinlim import inv_linear_spectrogram, inv_linear_spectrogram_tf, inv_mel_spectrogram
    from aukit.audio_griffinlim import default_hparams as hparams_griffinlim
    from aukit.audio_spectrogram import linear_spectrogram, mel_spectrogram

    out_linear = linear_spectrogram(_wav, hparams=hparams_griffinlim)
    out_wav = inv_linear_spectrogram(out_linear, hparams=hparams_griffinlim)
    assert out_wav.shape == (800, )

    out_mel = mel_spectrogram(_wav, hparams=hparams_griffinlim)
    out_wav = inv_mel_spectrogram(out_mel, hparams=hparams_griffinlim)
    assert out_wav.shape == (800, )
Exemplo n.º 2
0
def run_spectrogram():
    from aukit import audio_spectrogram as asp
    from aukit import audio_griffinlim as agf
    from aukit import audio_io as aio
    from aukit.audio_player import play_audio
    inpath = r"E:/data/temp/01.wav"
    wav, sr = aio.load_wav(inpath, with_sr=True)
    print(wav.shape, sr)
    play_audio(wav, sr)

    lin_gf = agf.linear_spectrogram(wav)
    wav_gf = agf.inv_linear_spectrogram(lin_gf)
    play_audio(wav_gf, sr)

    mel_sp = asp.mel_spectrogram(wav)
    mel_sp = asp.mel2linear_spectrogram(mel_sp)
    wav_sp = agf.inv_linear_spectrogram(mel_sp)
    play_audio(wav_sp, sr)

    linear_gf = agf.linear_spectrogram(wav)
    mel_lin = agf.linear2mel_spectrogram(linear_gf)
    linear_mel = agf.mel2linear_spectrogram(mel_lin)
    wav_2 = agf.inv_linear_spectrogram(linear_mel)

    mel_sp = asp.mel_spectrogram(wav)
    mel_fea = asp.mel_spectrogram_feature(wav)

    # plt.figure()
    # plt.subplot("311")
    # plt.pcolor(linear)
    # plt.subplot("312")
    # plt.pcolor(linear2)
    # plt.subplot("313")
    # plt.pcolor(mel_fea)
    # plt.show()

    wav_ms = agf.inv_mel_spectrogram(mel_sp)
    wav_mf = agf.inv_mel_spectrogram(mel_fea)
    play_audio(wav_ms, sr)
    play_audio(wav_mf, sr)
Exemplo n.º 3
0
def inv_melspectrogram(mel, hparams=None):
    mel = mel * 20
    wav = inv_mel_spectrogram(mel, melgan_hparams)
    return wav
Exemplo n.º 4
0
def inv_linearspectrogram(spec):
    return inv_mel_spectrogram(spec, hparams=synthesizer_hparams)
Exemplo n.º 5
0
def inv_melspectrogram(spec):
    return inv_mel_spectrogram(spec)