Ant
Ant

Reputation: 5414

How to open an audio data

I have a m4a file, and i want to open it...what should i do? i've tried the obvious

>>> q = open('file.m4a').read()
>>> len(q)
6989886
>>> print q[:10000]

>>>

It prints a blank line! i've tried to open the file with 'rb' flag but it doesn't work.

Upvotes: 2

Views: 3260

Answers (2)

Greg Hewgill
Greg Hewgill

Reputation: 993303

Try printing the repr() of the data:

>>> print repr(q[:10000])

If you print the data itself, it may contain control character or other unprintable text, which makes for misleading output. The Python repr() function makes that data readable by escaping the characters as needed.

In the interactive shell, the repr() value of the expression entered is printed if it isn't None. So this would do the same thing:

>>> q[:10000]

Upvotes: 2

William
William

Reputation: 1007

Python Audio Tools ?

Upvotes: 2

Related Questions