Does anyone did some stuff with audio in python and more specific wxpython like drawing waveforms? I don’t need to make it dynamic, the best solution is so I can somehow decompress an mp3 data and just draw it on a ordinary DC. Can you please provide some solution, or perhaps other libraries which can be integrated with wxpython well.
Thank you.
Vladislav Cebotari wrote:
Does anyone did some stuff with audio in python and more specific
wxpython like drawing waveforms? I don't need to make it dynamic, the
best solution is so I can somehow decompress an mp3 data and just draw
it on a ordinary DC. Can you please provide some solution, or perhaps
other libraries which can be integrated with wxpython well.
Matplotlib is excellent. I recommend it. If you're doing much
mathematics stuff, you might look at SciPy, which includes numpy and
matplotlib. It's basically MATLAB without the hefty price tag.
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
With Matplotlib, I have an example for my DSP package, AudioLazy:
https://github.com/danilobellini/audiolazy/blob/89109e32f5dcc1648dacd6991d76385b54b4ac98/examples/animated_plot.py
It gets the input from the mic and plot both its waveform and FFT in real time. I’m willing to update it as I’ve written some plots with the autocorrelation, cepstrum, F0, etc. while trying new DSP algorithms.
And this pedalboard project written by my mentees uses the very same idea, but “embeds” the Matplotlib canvas (using WxAgg) into a wxPython window:
https://github.com/RicardoBoccoliGallego/DigitalPedalBoard
···
2014-08-01 13:39 GMT-03:00 Tim Roberts timr@probo.com:
Vladislav Cebotari wrote:
Does anyone did some stuff with audio in python and more specific
wxpython like drawing waveforms? I don’t need to make it dynamic, the
best solution is so I can somehow decompress an mp3 data and just draw
it on a ordinary DC. Can you please provide some solution, or perhaps
other libraries which can be integrated with wxpython well.
Matplotlib is excellent. I recommend it. If you’re doing much
mathematics stuff, you might look at SciPy, which includes numpy and
matplotlib. It’s basically MATLAB without the hefty price tag.
–
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
–
You received this message because you are subscribed to the Google Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
–
Danilo J. S. Bellini
“It is not our business to set up prohibitions, but to arrive at conventions.” (R. Carnap)
+1
But if you really only want some simple potting, that may be kind of
heavyweight. IN which case, there is a Plot module with wxPython that does
the simple stuff -- I'll let you search the demo for it...
And you can also do simple plotting really easily with wx.lib.floatcanvas.
-Chris
···
On Fri, Aug 1, 2014 at 9:39 AM, Tim Roberts <timr@probo.com> wrote:
Vladislav Cebotari wrote:
> Does anyone did some stuff with audio in python and more specific
> wxpython like drawing waveforms? I don't need to make it dynamic, the
> best solution is so I can somehow decompress an mp3 data and just draw
> it on a ordinary DC. Can you please provide some solution, or perhaps
> other libraries which can be integrated with wxpython well.Matplotlib is excellent. I recommend it. If you're doing much
mathematics stuff, you might look at SciPy, which includes numpy and
matplotlib. It's basically MATLAB without the hefty price tag.
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
audacity is all about audio, and uses wxWidgets, so you might gain some insight of what widgets they’re using:
https://code.google.com/p/audacity/source/browse/audacity-src/#audacity-src%2Ftrunk%2Fsrc
I think the easiest way to get the data from an MP3 might be to use some existing audio conversion package (ffmpeg for example) to convert it to a .WAV file, which you should then be able to simply open() and read the chunks of data as integers.
···
On Friday, August 1, 2014 5:51:37 AM UTC-7, Vladislav Cebotari wrote:
Does anyone did some stuff with audio in python and more specific wxpython like drawing waveforms? I don’t need to make it dynamic, the best solution is so I can somehow decompress an mp3 data and just draw it on a ordinary DC. Can you please provide some solution, or perhaps other libraries which can be integrated with wxpython well.
Thank you.
Thank you all for replies. In the end I used pymedia: http://pymedia.org/ for converting mp3 file into a wav and then using numpy and a wraper for matplotlib (wx.lib.plot) I managed to draw the waveform.
I also tried to use pydub https://github.com/jiaaro/pydub but there was some issues with ffmpeg codec, it could not find it even if I explicitly write to pydub the location of ffmpeg exe. Also there are some issues with pymedia, I can’t play sounds asynch. (well, actually I can but when you hit play it requires a lot of time to “load up” and then it goes), I tried to run it with a timer playing frame chunks but it didn’t worked very well, so I used standard wxpython wx.Sound.
And I want to ask also, if it’s possible to play a .wav with wx.Sound for example from middle or other position.
I tried with seek to move across file and then play, but it doesn’t work, maybe the problem is because it should read the first chunk of data from .wav to specify samplerate etc. I’ll try it tomorrow.