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

Error loading wav #7

Open
drone1 opened this issue Sep 23, 2018 · 5 comments · May be fixed by #8
Open

Error loading wav #7

drone1 opened this issue Sep 23, 2018 · 5 comments · May be fixed by #8

Comments

@drone1
Copy link

drone1 commented Sep 23, 2018

Hi Paul,

I'm trying to run this on MacOS High Sierra 10.13.6. Python 2.7.10.

I've tried a variety of wav files from sample packs and so forth as a test, and have gotten nothing but "Error loading wav..."; I added a bit of code to get more information. Seems I get a ValueError exception, which contains the following: "string size must be a multiple of element size"

It is triggered from this line:

wavedata=scipy.io.wavfile.read(filename)

I can dig further but was hoping you might just have an idea of what might be wrong here.

All I did was clone, copy a wav to the working directory as a.wav, then run:

./paulstretch_stereo.py a.wav b.wav

Full output:

Paul's Extreme Sound Stretch (Paulstretch) - Python version 20141220
by Nasca Octavian PAUL, Targu Mures, Romania

stretch amount = 8
window size = 0.25 seconds
Error loading wav: a.wav
Traceback (most recent call last):
  File "./paulstretch_stereo.py", line 149, in <module>
    (samplerate,smp)=load_wav(args[0])
TypeError: 'NoneType' object is not iterable
@ojczeo
Copy link

ojczeo commented Jan 10, 2019

Fixed it here:
https://github.com/ojczeo/paulstretch_python

@ojczeo ojczeo linked a pull request Jan 10, 2019 that will close this issue
@canyondust
Copy link

@ojczeo Thank you for updating the script. It seems 24bit causes level problems (clipping) and the script also fails under Python 3.8 (numpy 1.19.4, scipy 1.5.4) with the following error:

"Traceback (most recent call last):
File "./paulstretch_stereo.py", line 153, in
paulstretch(samplerate,smp,options.stretch,options.window_size,args[1])
File "./paulstretch_stereo.py", line 124, in paulstretch
outfile.writeframes(int16(output.ravel(1)*32767.0).tostring())
TypeError: order must be str, not int"

I'll try to fix it myself, but I know nothing about Python. However if you have time, and the fix is easy, it would be beneficial to macOS uses are Python 2 is depricated as of macOS 10.16+

Thanks!

@usworked
Copy link

usworked commented Oct 11, 2023

Hi @canyondust
Hope this helps you buddy.. change the output.writeframes line to this:
outfile.writeframes(int16(output.ravel('F')*32767.0).tostring())

@canyondust
Copy link

Heyya @usworked I this is such a coincidence you write now, because I hadn't done much with the code until YESTERDAY when I rewrote the IO to use the soundfile library instead of the wavefile library and added 24-bit support as well :)

@Mikec78660
Copy link

Wow funny. I just grabbed this utility for a project I was working on. got the same error. "TypeError: order must be str, not int"" Didn't think there was a chance it was still maintained after 9 years and saw the fix. Works great! Thank you for writing this.

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

Successfully merging a pull request may close this issue.

5 participants