0

I am trying to create a pydub.AudioSegment from torch.Tensor object. I tried to transform into an intermediate data type (e.g. numpy) like in the code below. Not a successful method.


wav_audio = AudioSegment(
        wav.cpu()[0].numpy().tobytes(),
        frame_rate=16000,
        sample_width=wav.cpu()[0].numpy().dtype.itemsize,
        channels=1
    )

Is there any other method?

0 Answers0