classification
Title: Poor support other than 44.1khz, 16bit audio files?
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: francismb, kawai, loki_dePlume, phew, r.david.murray, serhiy.storchaka
Priority: normal Keywords: easy, patch

Created on 2008-03-09 15:06 by loki_dePlume, last changed 2013-11-14 17:36 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
chunk.patch kawai, 2008-03-12 17:06
aifc.patch kawai, 2008-03-12 17:07
24b48k.aif loki_dePlume, 2009-12-30 00:52 A 24-bit 48000hz AIFF file - for testing
test_issue2259.patch francismb, 2011-07-18 21:04 play with file 24b48k.aif
Messages (18)
msg63419 - (view) Author: Oki Mikito (loki_dePlume) Date: 2008-03-09 15:06
It appears that aifc, as well as wave, does not support audio files other 
than 44100 hz 16-bit format.

--
>>> f = aifc.open('Track 06')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/aifc.py", 
line 928, in open
    return Aifc_read(f)
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/aifc.py", 
line 341, in __init__
    self.initfp(f)
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/aifc.py", 
line 321, in initfp
    chunk.skip()
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/chunk.py", 
line 158, in skip
    self.file.seek(n, 1)
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/chunk.py", 
line 111, in seek
    raise RuntimeError
RuntimeError
--

Could it be that the 'Chunk' class in chunk module may be returning improper 
values...? In any case, aifc refuses to open a 24bit 44100hz audio file. 
Does anyone have insights on this?
msg63476 - (view) Author: HiroakiKawai (kawai) Date: 2008-03-12 17:04
I looked into the problem, and found that current aifc impelementation 
assumes that SSND chunk is aligned (in Audio-IFF). But it is not always 
true. SSND chunk might not be aligned.

Here I'd like to submit a set of patches for this issue.
I'd like to donate these patches to python.
msg63477 - (view) Author: HiroakiKawai (kawai) Date: 2008-03-12 17:06
Patch for chunk.py that skip() method may get an optional arguments, 
that it will skip in aligned or not.
msg63478 - (view) Author: HiroakiKawai (kawai) Date: 2008-03-12 17:07
Patch for aifc.py that will use chunk.skip(True) in SSND chunk.
msg63479 - (view) Author: HiroakiKawai (kawai) Date: 2008-03-12 17:09
Can I ask someone to review the patch files, and to merge into the code 
base if those patches are ok?
msg63481 - (view) Author: Oki Mikito (loki_dePlume) Date: 2008-03-12 17:30
Hello Kawai,

I see you are attemping to kill two bugs in one stone (or ... whack!) by eliminating the _skiplist ... Beautiful :-) As we discussed in the Mixi Python thread, I was going to give those patches a set of runs, but I'm completely swamped until Saturday morning, JST...

On Wed, 12 Mar 2008 17:09:17 +0000, HiroakiKawai wrote:
> 
> HiroakiKawai <kawai@apache.org> added the comment:
> 
> Can I ask someone to review the patch files, and to merge into the code 
> base if those patches are ok?
> 
> __________________________________
> Tracker <report@bugs.python.org>
> <http://bugs.python.org/issue2259>
> __________________________________
> _______________________________________________
> Python-bugs-list mailing list 
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-bugs-list/moki%40u01.gate01.com
> 
>
msg84065 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-03-24 08:49
Killing two birds with one stone is actually a bad idea when it comes to
patches.  I would recommend breaking this patch into its two independent
pieces, the alignment fix and the skiplist fix, and attaching the
skiplist fix to issue 2245 as a proposed fix there.

Both issues need tests.
msg84088 - (view) Author: HiroakiKawai (kawai) Date: 2009-03-24 14:46
Killing one or two is not the point in this issue ticket. The ticket is 
opened per issue what one experienced. Thus there might be different 
tickets that needs the same patch.

For this issue, the problem is "Poor support other than 44.1khz, 16bit 
audio files?". I posted one patch for this issue. I think the patch 
could not be separated, and should not be. I could not see it resonable 
to separate the patch into two. :(

If you do really want to have separate patches, I can prepare. Or anyone 
can prepare.
msg84090 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-03-24 15:05
The issue isn't whether the patch(es) are on one issue or not, if you
want to keep them here, that's fine.  This patch is so small that
breaking it up isn't strictly necessary, either, though I still think it
would be cleaner and more likely to get applied if you did so. (My
thought after reading the developer documentation is that each patch
file should consist of the minimum amount of independently testable
changes, regardless of whether or not they unltimately fix a single
issue.)  But I could be wrong, it's just my opinion :)

What we do for sure need in order to get this closer to having the devs
accept it is unit (or doctest) test cases that demonstrate the problem
and thereby demonstrate that the patch fixes the problem.

In case you didn't see it, it was also suggested, on the other ticket,
that the 'else: pass' could just be dropped.

(I'm one of the people doing ticket triage, by the way, in case you
wonder what my role is...my goal is to get tickets resolved, by getting
tickets up to a high enough quality that the devs can easily accept or
reject them.)
msg84960 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-04-01 02:12
If you can provide a small audio file that demonstrates the problem that
might be enough to get both of these issues moving, since I could write
a test using that.
msg86801 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-04-29 13:23
In r72100 I applied the skiplist part of this patch.  In order to apply
the remainder I need a small auido test file that demonstrates the
current failure.
msg97016 - (view) Author: Oki Mikito (loki_dePlume) Date: 2009-12-30 00:51
Hello,

My apology for failing to reply ... Here's a small AIFF file (24-bit, 
48000hz). Try this file to see if it can be opened using aifc. Thank you!
msg97017 - (view) Author: Oki Mikito (loki_dePlume) Date: 2009-12-30 00:52
Hello,

My apology for failing to reply ... Here's a small AIFF file (24-bit, 
48000hz). Try this to see if it can be opened using aifc. Thank you!
msg140618 - (view) Author: Francis MB (francismb) * Date: 2011-07-18 21:04
Adding a test that opens the 24b48k.aif file, gets some information and does navigation on it. I'm aware that it doesn't triggers any extra failure against the actual tip (5a1bb8d4afd7) but it does if r72100 is undone (with some small rework :)). I'm not sure if that is the kind of test needed (if not just ignore it).
msg140755 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-07-20 17:31
Well, if the test doesn't fail before applying the remainder of the patch, then it doesn't test the bits that haven't been applied yet.

I don't know enough about aifc to construct a test that fails or to understand the remainder of the fix well enough to feel comfortable committing it *without* a test that fails first.  So I'm hoping someone else will be able to figure it out :)  Thanks for trying.
msg142961 - (view) Author: Philipp Weinfurter (phew) Date: 2011-08-25 08:10
From AIFF-C Draft '91, Section 5, Sound Data Chunk:
"If soundData[] contains an odd number of bytes, a pad byte with a value of zero is added at the end to preserve an even length for this
Chunk."

So I think aifc.patch is wrong.

However, Chunk.skip() is broken for non-seekable files, I added a trivial patch
msg142988 - (view) Author: Philipp Weinfurter (phew) Date: 2011-08-25 19:34
Oops. Misread the code, that part of skip() is fine. Patch removed. Sorry about that.
msg199914 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-10-14 15:50
I tested 2.6, 2.7, 3.2, 3.3, and 3.4. All of them read and write 24b48k.aif. Currently 2.7, 3.3, and 3.4 have tests for 24-bit aifc files. Seems this issue is not more actual.
History
Date User Action Args
2013-11-14 17:36:06serhiy.storchakasetstatus: pending -> closed
2013-10-14 15:50:58serhiy.storchakasetstatus: open -> pending
messages: + msg199914

dependencies: - Add support for 24-bit samples in the audioop module
resolution: out of date
stage: patch review -> resolved
2013-10-14 10:57:23serhiy.storchakasetassignee: serhiy.storchaka
stage: test needed -> patch review
2013-09-05 19:38:18serhiy.storchakasetdependencies: + Add support for 24-bit samples in the audioop module
2013-09-05 17:21:09serhiy.storchakasetnosy: + serhiy.storchaka

versions: + Python 3.3, Python 3.4, - Python 2.6, Python 3.0, Python 3.1
2011-08-25 19:34:09phewsetmessages: + msg142988
2011-08-25 19:27:23phewsetfiles: - chunk2.patch
2011-08-25 08:10:44phewsetfiles: + chunk2.patch
nosy: + phew
messages: + msg142961

2011-07-20 17:31:58r.david.murraysetmessages: + msg140755
2011-07-18 21:05:47francismbsetfiles: + test_issue2259.patch
nosy: + francismb
messages: + msg140618

2009-12-30 00:52:58loki_dePlumesetfiles: + 24b48k.aif

messages: + msg97017
2009-12-30 00:52:03loki_dePlumesetfiles: - 24b48k.aif
2009-12-30 00:51:23loki_dePlumesetfiles: + 24b48k.aif

messages: + msg97016
2009-12-14 14:47:00r.david.murraysetassignee: r.david.murray -> (no value)
2009-04-29 13:23:31r.david.murraysetassignee: r.david.murray
messages: + msg86801
2009-04-01 02:12:25r.david.murraysetmessages: + msg84960
2009-03-24 15:05:37r.david.murraysetmessages: + msg84090
2009-03-24 14:46:18kawaisetmessages: + msg84088
2009-03-24 08:49:12r.david.murraysetnosy: + r.david.murray
messages: + msg84065
2009-03-24 08:09:27r.david.murraysetpriority: normal
versions: - Python 2.5
2009-03-24 02:21:15r.david.murraysetkeywords: + easy
stage: test needed
type: crash -> behavior
versions: + Python 2.6, Python 3.0, Python 3.1, Python 2.7
2008-03-12 17:30:13loki_dePlumesetmessages: + msg63481
2008-03-12 17:09:16kawaisetmessages: + msg63479
2008-03-12 17:07:26kawaisetfiles: + aifc.patch
messages: + msg63478
2008-03-12 17:06:11kawaisetfiles: + chunk.patch
keywords: + patch
messages: + msg63477
2008-03-12 17:04:04kawaisettype: enhancement -> crash
messages: + msg63476
severity: major -> normal
nosy: + kawai
2008-03-09 15:06:46loki_dePlumecreate