-
Notifications
You must be signed in to change notification settings - Fork 121
RAW example in README is severely broken #144
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
Conversation
|
Yes, I agree! |
|
@bastibe do you want to do that? |
|
Sure |
|
I still think that the RAW example is useful, even with the "dict trick". RAW files are inherently complex to deal with, so a bit of inelegance is not a big problem I'd say. |
|
I agree that having an example for RAW is useful, but the current one is much too complicated and more confusing than helpful. To a beginner should not be suggested that writing a RAW file is generally a good idea, so it would be best if we don't show this in an example. OTOH, a beginner might well be confronted with a RAW file from somebody else, and it would be extremely helpful to see an example how to read a RAW file. import soundfile as sf
data, samplerate = sf.read('myfile.raw', channels=1, samplerate=44100,
subtype='FLOAT')To be honest, I have no clue what import soundfile as sf
data, samplerate = sf.read('myfile.raw', channels=1, samplerate=44100,
subtype='FLOAT', endian='LITTLE')And then we could even mention, that the user should find out by trial and error if |
|
x86 is little-endian, so the default argument makes perfect sense, and should be correct in most cases. I agree that writing RAW should be discouraged, and added a note to that effect to the README. |
remove write example add note about endianness add note about RAW file usage
|
Cool. You could even explicitly state the alternative with " |
RAW example in README is severely broken
There are surprisingly many bugs (even when not counting PEP-8 violations) in this (this is before #132):
This would be a variation that actually works (after merging #132):
Given this complexity, this is probably not such a "useful idiom" after all?
I hereby suggest to remove this example and replace it with an example for just reading a RAW file, which will show that all those arguments have to be given even for reading.
Reading RAW files is much more important than writing them, anyway.