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

IndexError: tuple index out of range #156

Closed
ghost opened this issue Nov 9, 2015 · 6 comments
Closed

IndexError: tuple index out of range #156

ghost opened this issue Nov 9, 2015 · 6 comments

Comments

@ghost
Copy link

ghost commented Nov 9, 2015

I always get the error IndexError: tuple index out of range when trying to write. I cannot even run the example on the documentation. Do you know why it always skips the check 414 if data.ndim == 1: and fails at 417 channels = data.shape[1]

import soundfile as sf
data, samplerate = sf.read('piano.wav') # mono signal 
sf.write(data, 'new_file.ogg', samplerate=samplerate)

I tried on Ubuntu 14.04 and OSX 10.11

@bastibe
Copy link
Owner

bastibe commented Nov 9, 2015

Does the same error happen if you try to write to a non-ogg file? I have seen strange issues with ogg files lately.

@ghost
Copy link
Author

ghost commented Nov 9, 2015

Ohh... No, I just found that the mistake is that the documentation is outdated in that part regarding the order of the arguments (and some other sections too).
I should have run `sf.write('new_file.ogg', data, samplerate)
Cheers!

@bastibe
Copy link
Owner

bastibe commented Nov 9, 2015

No, actually you shouldn't. sf.write(data, 'new_file.ogg', samplerate) is correct. But it seems your version of pysoundfile is outdated. The order of arguments has changed in 0.8.0.

@mgeier
Copy link
Contributor

mgeier commented Nov 9, 2015

Yes, we changed the order in 0.8.0 (see #132).
The file name now has to come first, like it's usual in many other libraries.

We also changed it in the docs, but for some reason the online documentation still showed the old usage. I just did a rebuild on readthedocs.org and now it should show the correct instructions.

UPDATE: Sadly, the problem with writing OGG files still persists, see #130.

@ghost
Copy link
Author

ghost commented Nov 9, 2015

Thank's!

@ghost ghost closed this as completed Nov 9, 2015
@ghost
Copy link
Author

ghost commented Nov 9, 2015

Hi again, actually I just installed using pip install and the version stamped on the file is "0.8.1". I will be careful to the changes ;) Awesome work!

@ghost ghost reopened this Nov 9, 2015
@ghost ghost closed this as completed Nov 9, 2015
This issue was closed.
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

2 participants