from pydub import AudioSegment
from pydub.playback import play
import librosa
import numpy as np
max_val = np.iinfo(np.int16).max
wav, sr = librosa.load("linni.wav", sr=16000)
output = (wav * max_val).astype(np.int16)
ad = AudioSegment(
channels=1,
sample_width=2,
frame_rate=sr,
data=output.tobytes()
)
# ad.append(AudioSegment.silent(duration=1000))
play(ad)
08-27
4834
04-19
5915
09-15
7311
02-23
1079