Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support .wav files #113

Open
samyk opened this issue Dec 19, 2016 · 3 comments
Open

Support .wav files #113

samyk opened this issue Dec 19, 2016 · 3 comments

Comments

@samyk
Copy link
Contributor

samyk commented Dec 19, 2016

Feature request: It would be nice to be able to open .wav files straight into inspectrum.

@itdaniher
Copy link

This gains additional value in the context of migrating from other tools, ie Baudline, which natively exports RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo

@itdaniher
Copy link

import scipy.io.wavfile
import sys

filename = sys.argv[1]

fs1, y1 = scipy.io.wavfile.read(filename)

assert y1.dtype.name == 'int16'

stereo_to_complex = lambda a: a[0] + a[1]*1j
y1 = y1/65536.

y1 = stereo_to_complex(y1.T).astype('complex64')

filename = filename.replace('wav', 'cf32')

y1.tofile(str(fs1)+'.'+filename)

boring stack-overflow-derived solution that worked for me!

@reald
Copy link

reald commented Nov 13, 2020

Created pull request #176 . Alternatively you can set the sampling depth manually:

inspectrum -f cs16 file.wav

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants