question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loading sph audio files

See original GitHub issue

Can audio.load load NIST sphere format (SPH) files?

Hi!

So I have tried to load sph files from tedlium dataset with simply:

torchaudio.load("pathtofile")

The load was successful but when saving it to a .wav file to check if the torchaudio read correctly the audio then I realized it was not working.

My question then is if this type of audio files is currently supported by torchaudio and if so, could you provide some link/code that refers how to? I haven’t been able to find anything about torchaudio and sph files (but I know sox supports sph and allows to conversion into wav)

In case someone needs sph files here there are some sample ones https://filesamples.com/formats/sph. I got mines from the TEDLIUM dataset.

Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mthrokcommented, Aug 10, 2020

@jiwidi Thanks, and you are working on torchaudio master branch, right?

I added support for sph format in "sox_io" backend. Can you try my branch mthrok/sph or cherry pick this commit https://github.com/mthrok/audio/commit/f78ebf9556cf237de9e2fb8b3b156dca90769435 and try "sox_io" backend?

import torchaudio
torchaudio.set_audio_backend("sox_io")
wave, sample = torchaudio.load("sample1.sph")
torchaudio.save("sample1.wav", wave, sample)

I believe this works, and if you can confirm I will merge it to master branch.

0reactions
mthrokcommented, Aug 11, 2020

@jiwidi Thanks for confirming. I merged the commit to master.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Read .sph files in Python - audio - Stack Overflow
The audio files I have are stored in a .sph format. I am unable to find a method to read these files directly...
Read more >
sphfile - PyPI
Numpy-based NIST SPH audio-file reader. ... It just loads the data into a numpy array and then lets you dump it back out...
Read more >
Follow These Easy Steps to Open SPH Files - File Magic
Follow These Easy Steps to Open SPH Files · Step 1: Double-Click the File · Step 2: Choose the Right Program · Step...
Read more >
SPH File Extension: What Is It & How To Open It? - Solvusoft
An SPH file is an audio file created in the NIST SPHERE format, a format often used in speech recognition research. It contains...
Read more >
mcfletch/sphfile: NIST SPH File reader (e.g. for ... - GitHub
sphfile. Latest PyPI version. Numpy-based NIST SPH audio-file reader. ... It just loads the data into a numpy array and then lets you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found