krqsalvador
Posts: 1
Joined: Sat Mar 05, 2016 11:23 am

Music player that manipulates frequencies

Sat Mar 05, 2016 11:38 am

Hello.

I am creating a music player using omxplayer. I would like to be able to manipulate an mp3 file's frequency, similar to that of an equalizer.

How would I go about manipulating frequencies of mp3 files? I've already seen codes on how to manipulate volumes by setting decibel values but I can't find anything on manipulating frequencies.

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: Music player that manipulates frequencies

Mon Mar 07, 2016 7:44 pm

Take a look at this https://www.raspberrypi.org/blog/graphic-equaliser/ and click on the link to the Adafruit page.
This is pushing it and it's only an analyser, it doesn't process the signal. I think you're asking a bit much from Python.

Sorry.
Dave.
Apple say... Monkey do !!

User avatar
paddyg
Posts: 2541
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Music player that manipulates frequencies

Mon Mar 07, 2016 8:53 pm

You would be able to do it in python using numpy which has fft and associated functions that are very fast, but I don't know how you would capture the sound data using omxplayer (I think you could using lame in a subprocess, or ffmpeg, which I've used for capturing video to numpy arrays.)
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
GTR2Fan
Posts: 1601
Joined: Sun Feb 23, 2014 9:20 pm
Location: South East UK

Re: Music player that manipulates frequencies

Mon Mar 07, 2016 9:43 pm

Bear in mind that if this is ultimately for listening to with an aim of making it sound better, there's nothing worse for uncovering undesirable artefacts in lossy audio than messing around with it spectrally, especially if the filters involved are high-Q, ie, very narrow as that is almost guaranteed to make it sound far worse.

MP3 and AAC encoders walk a very fine line at low-to-mid bitrates when it comes to deciding which sub-band to assign more or less bits to in order to maintain apparent transparency, and they'll sometimes starve one sub-band of bits if others can benefit more in terms of overall psychoacoustic performance from using those same bits.

Bending the spectral response on playback past a certain point has a nasty habit of exposing this as audible unpleasantness.

In short, bend it too far and you'll break it. ;)
Pi2B Mini-PC/Media Centre: ARM=1GHz (+3), Core=500MHz, v3d=500MHz, h264=333MHz, RAM=DDR2-1200 (+6/+4/+4+schmoo). Sandisk Ultra HC-I 32GB microSD card on '50=100' OCed slot (42MB/s read) running Raspbian/KODI16, Seagate 3.5" 1.5TB HDD mass storage.

jahboater
Posts: 5759
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: Music player that manipulates frequencies

Tue Mar 08, 2016 4:27 pm

Disk space is so cheap now, I just use flac.
Pi4 8GB running PIOS64

gkreidl
Posts: 6326
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Music player that manipulates frequencies

Tue Mar 08, 2016 4:39 pm

krqsalvador wrote:Hello.

I am creating a music player using omxplayer. I would like to be able to manipulate an mp3 file's frequency, similar to that of an equalizer.

How would I go about manipulating frequencies of mp3 files? I've already seen codes on how to manipulate volumes by setting decibel values but I can't find anything on manipulating frequencies.
You cannot do it using omxplayer, because the audio stream is directly sent to the hardware.
But the Pi is fast enough to do all that in software. Search the repository for audio players. VLC has some audio effects, but there may be better solutions.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

Return to “Python”