Torchaudio.load() in C++

I want to convert ogg-file to torch.Tensor using torchaudio.load function, but in deployment I need to do it in C++ (I converted original model to TorchScript). Can I use it from C++? Or what can I do as alternative?

1 Like

torchaudio does not yet have a C++ interface. However, torchaudio.load is a wrapper around https://github.com/pytorch/audio/blob/master/torchaudio/torch_sox.cpp which you could use.

Any update on this?
I also need to convert “.wav” file to torchaudio tensor in c++ while deployment on mobile device. Is there any way to do this.

This link is no more: https://github.com/pytorch/audio/blob/master/torchaudio/torch_sox.cpp
Is there any alternate link or implementation of this?

Thanks.

Same here. Is there any built-in way to read a wav file into a torch tensor in C++?