Opened 5 years ago
Closed 4 years ago
#5610 closed defect (fixed)
Re-Enable Audio Spectrogram for Python 3
Reported by: | Fernando Gutierrez | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | programming | Keywords: | |
Cc: | Parent Tickets: |
Description
I propose a fix for the audio spectrogram code that works with Python 3.
I wrote a replacement that does not rely on the old unsupported third party code.
This new implementation only depends on numpy and soundfile/PySoundFile (PySoundFile was renamed to just soundfile in version 0.10, my implementation handles both)
Attached to this ticket is the patch
Attachments (1)
Change History (6)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
audiotospectrogram.py is my own work, I only copied the color = [] array from the old file to keep the same [blue, green, yellow, red] scheme for the spectrograms.
I'll run the tests. It may take a few days since I'm busy with other tasks.
by , 5 years ago
Attachment: | fix_spectrogram.diff added |
---|
Second version of proposed fix: Added license header to new file, removed extlib/freesound, fixed soundfile package name in setup.py
comment:3 by , 5 years ago
I ran the test and it passed:
mediagoblin@opochtli:/srv/mediagoblin/media.nil.mx/mediagoblin$ ./bin/python -m pytest ./mediagoblin/tests/test_audio.py --boxed ================================================= test session starts ================================================== platform linux -- Python 3.8.2, pytest-5.4.1, py-1.8.1, pluggy-0.13.1 rootdir: /srv/mediagoblin/media.nil.mx/mediagoblin/mediagoblin/tests, inifile: pytest.ini plugins: xdist-1.32.0, celery-4.2.2, forked-1.1.3 collected 2 items mediagoblin/tests/test_audio.py .. ================================================== 2 passed in 0.63s ===================================================
I could not test changes to setup.py because I hit this bug https://issues.mediagoblin.org/ticket/5611
comment:4 by , 4 years ago
Hi Fernando,
I've now merged this into the master branch. My apologies for the delay and thankyou for contributing this large piece of work!
Regards,
Ben
comment:5 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Wonderful, thanks Fenrando, this is really impressive. I'd like to take a little bit of time to test this out, so will be a week or two if that's ok with you.
Is
audiotospectrogram.py
all your own work or do we need to add any attribution or licensing info? Either way, could you please stick a license header on the file? You can see an example inmediagoblin/media_types/audio/models.py
.Would you mind verifying that
test_audio.py
runs successfully with your changes? You can run that with something likebin/python -m pytest ./mediagoblin/tests/test_audio.py --boxed
.While you're there, can you please also remove
extlib/freesound
(which is whatmediagoblin/media_types/audio/audioprocessing.py
was linked to).Thanks again!
NOTE TO SELF: We'll need to re-add
numpy
to themedia-types.rst
docs and to theDockerfile
s.