jaqx0r / pymad Goto Github PK
View Code? Open in Web Editor NEWA Python wrapper for the MPEG Audio Decoder (MAD) library
License: Other
A Python wrapper for the MPEG Audio Decoder (MAD) library
License: Other
I noticed that this package seems to be broken. I wrote a minimal test program:
#!/usr/bin/env python
import sys
import mad
import wave
if len(sys.argv) not in (2, 3):
print('Usage: %s INFILE [OUTFILE]' % sys.argv[0])
sys.exit(1)
mf = mad.MadFile(sys.argv[1])
if len(sys.argv) == 2:
print('Samplerate: %r' % mf.samplerate())
print('Mode: %r' % mf.mode())
print('Channels: %d' % (1 if mf.mode() == mad.MODE_SINGLE_CHANNEL else 2))
else:
wf = wave.open(sys.argv[2], mode='wb')
wf.setframerate(mf.samplerate())
wf.setnchannels(1 if mf.mode() == mad.MODE_SINGLE_CHANNEL else 2)
#4 is the sample width of 32 bit audio
wf.setsampwidth(4)
frame = mf.read()
while frame is not None:
wf.writeframes(frame)
frame = mf.read()
wf.close()
I used the 1938 radio broadcast of "War of the Worlds" to test this.
The output of MadFile.mode()
is wrong (it's stereo) and conversion to wave produces just noise. Also, the python 3 version returns a samplerate of 0.
$ python2 mp3conv.py 381030.mp3
Samplerate: 44100
Mode: 0
Channels: 1
$ python mp3conv.py 381030.mp3
Samplerate: 0
Mode: 0
Channels: 1
I'm using the latest available version on Arch Linux:
$ pacman -Qs pymad
local/python-pymad 0.9-1
Python interface to libmad
local/python2-pymad 0.9-1
Python interface to libmad
The Website at http://spacepants.org/src/pymad/ is quite outdated.
The latest version of the source code is kept in arch:
baz register-archive http://arch.spacepants.org/[email protected] baz get [email protected]/pymad--main--0
People who are interested in helping out should be pointed to this Git repository instead of the baz repo, since development seems to happen here.
The latest stable release of pymad can be downloaded from here.
That should be a link to https://github.com/jaqx0r/pymad/releases instead.
Hello!
I wish to use pymad to decode MP3 files into a PCM stream. The main problem I'm having is figuring out the output sample width. Is there any way to query this? Without this information it is impossible to make sense of the buffer output from MadFile.read since there's no way to know how many bytes make up a single sample.
Thanks!
Although Python 2 will still be supported for quite some time, Ubuntu plans to remove Python 2 from the standard installation in 16.04, so this might be a good time to get Python 3 support ;-)
Hey, My name is Eliomar.
I am a bit new on this, and also I am new with python.
I am trying to test the software with the "test.py" file, in the description you say that a mad.MadFile, how I do this? isn't a predefined mad.MadFile with the project?
I was finding on internet how to do that but I didn't found anything. Can you give me an example?
I tried with some links of youtube (streaming audio with mpeg format no?) but nothing happened, It just give me this messages (Attached picture).
I also tried with madradio.py but it gives me an error with "import ao", I tried to install it with pip but it gives me an error.
Could you help me with this? sorry if some of these questions are stupid, I just have few days programming with python.
Although, there is a pypi entry, I was not able to install the package using pip (e.g., pip install pymad
). Would be great if this would be possible.. Cloning and running the build/setup tools worked, but pip would be easier :)
Could you do a release so that this package is installable under pip?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.