Skip to main content

Numpy-based NIST SPH audio-file reader

Project description

Latest PyPI version

Numpy-based NIST SPH audio-file reader. This is for use with NIST SPH audio-files, the most likely use being extracting the TEDLIUM_release2 audio into formats that standard tools can easily process.

Note that this library doesn’t require any external tools such as vox or gstreamer. It just loads the data into a numpy array and then lets you dump it back out to wave files.

Note that the library does not support files with embedded-shorten-* encodings, only the base ulaw encoding. You will need to convert such files with:

sph2pipe file.sph file-raw.sph

to allow them to be loaded.

Usage

from sphfile import SPHFile
sph =SPHFile(
    'TEDLIUM_release2/test/sph/JamesCameron_2010.sph'
)
# Note that the following loads the whole file into ram
print( sph.format )
# write out a wav file with content from 111.29 to 123.57 seconds
sph.write_wav( 'test.wav', 111.29, 123.57 )

Requirements

  • numpy

License

MIT License (c) 2017 Mike C. Fletcher

Authors

sphfile was written by Mike C. Fletcher.

History

  • 1.0.3 – Allow for other header keys during header format parsing

  • 1.0.2 – Use signed integers for 2 and 4-byte sample_n_bytes

  • 1.0.1 – Fix to allow for files that have non-sample-multiple bytes in the data section

  • 1.0.0 – Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphfile-1.0.3.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file sphfile-1.0.3.tar.gz.

File metadata

  • Download URL: sphfile-1.0.3.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.6.9

File hashes

Hashes for sphfile-1.0.3.tar.gz
Algorithm Hash digest
SHA256 1596d801facc2b03a40a1bc67a839701f068a41597059feb82fc9378420c52c0
MD5 378414723f4ae232707f75f45c6d45fe
BLAKE2b-256 16a13e4872ea94c7dc56a1aee3f355342397e438b69af6770e1f52bec08c53d3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page