def run_world(): from aukit import audio_world as awd from aukit import audio_player as apr from aukit import audio_io as aio inpath = r"E:/data/temp/01.wav" # sr, x = wavfile.read(inpath) x, sr = aio.load_wav(inpath, with_sr=True) f0, sp, ap = awd.world_spectrogram(x, sr) y = awd.inv_world_spectrogram(f0, sp, ap, sr) apr.play_audio(x, sr) apr.play_audio(y, sr)
def run_editor(): import aukit from aukit.audio_player import play_sound, play_audio from aukit import audio_editor as aed inpath = r"hello.wav" wav, sr = aukit.load_wav(inpath, with_sr=True) aud = aed.wav2audiosegment(wav, sr) out = aed.strip_audio(aud) wav = aed.audiosegment2wav(out) out = aed.remove_silence_wave(wav, sr=sr) out = aed.strip_silence_wave(out, sr=sr) print(len(wav), len(out)) play_audio(out, sr)
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)
def test_audio_player(): from aukit.audio_player import play_audio play_audio(_wav, sr=_sr) play_audio(_wav_bytes, sr=_sr)
restsize = D.shape[1] % poolsize if restsize > 0: x += 1 rightlist = np.zeros([D.shape[0], poolsize - restsize]) D = np.c_[D, rightlist] D = D.reshape((-1, poolsize)) D = D.sum(axis=1).reshape(-1, x) return D if __name__ == '__main__': from aukit.audio_player import play_audio path = r"E:/data/temp/01.wav" y, sr = librosa.load(path) # y = change_vague(3, y, sr) # y = change_pitch(-6, y, sr) # y = change_speed(0.5, y, sr) # y = change_sample(0.8, y, sr) # y = change_reback(3, y, sr) # y = change_pitchspeed(2, y, sr) # y = change_attention(50, y, sr) # y = change_male(5, y, sr) # y = change_vague(6, y, sr) """童声""" y = change_pitch(6, y, sr) y = change_male(20, y, sr) play_audio(y, sr=sr)