SiggiGue / pyfilterbank

Implementing a fractional octave filterbank for python. Based on Numpy and CFFI.
107 stars 27 forks source link

Cookbook or tutorial? #12

Closed koren88i closed 6 years ago

koren88i commented 6 years ago

Great project!

Besides the documentation regarding the different modules. Can you reference some information regarding what exactly each module do theoretically?

Is there a cookbook?

SiggiGue commented 6 years ago

Tanks! There are examples in the source code and in the documentation. This repo is all about filtering in terms of signal processing. There is no cookbook since the code is still in alpha and will get changed in future. But the documentation is covering most of the code and will help you if you have knowledge about signal processing, audio/acoustics and python including the scientific stack.

koren88i commented 6 years ago

Hey! thank you for answering.

I am struggling with this idea for a long time - maybe you can help me I want to :

  1. load mp3 song
  2. split it into 8 tracks of bands
  3. save those bands as new mp3

and if possible

  1. extract song "band distribution" and decide based in that how to divide into 8 bands meaning - if a song have a lot more bass in it - the bass part will have 2 bands as opposed to a song with almost no bass - than the lowest band will contain some bass and some treble..

The goal is the have 8 tracks that played together sum up (almost..) to the original song. and taking off each band remove the "same amount of song information" more or less.

is that possible with this library?

SiggiGue commented 6 years ago

MP3 decoding is not covered by this library. Look at stackoverflow or use google for this question. First hints may be ffmpeg, mpeg123, lame for instance.

Point 2. is one possible use case for this library.

For point 3 you need a third party library. E.g. python soundfile in combination with ffmpeg or so (see above).

Point 4 is possible but maybe you should get a bit more into acoustics, since you wrote:

if a song have a lot more bass in it - the bass part will have 2 bands as opposed to a song with almost no bass - than the lowest band will contain some bass and some treble..

So maybe you meant to split the signal into bands of equal information content ~ variance ~ energy density. Don't forget, that these properties are often time variant.

Your goal sounds to me that you want to implement an equalizer with energy dependent bandwidths in the end.

That is possible with this library. On the other hand think about using an fft approach. This library focuses on the analysis by time invariant filters. It does not focus on time variant filters and not on the synthesis of multiple bands.

Your question is more suitable for stackoverflow or dsp.stackexchange and is not an issue for this package.

koren88i commented 6 years ago

I already tried stacksoverflow but I guess I did not asked the right questions.

you wrote my goal is to implement an equalizer with energy dependent bandwidths in the end.

I'll try to reiterate:

my final app is a music player. that based on some score the user get - plays the song accordingly. 100 being the original track. 80 is 7 tracks.. 60 is 6 tracks etc... and the bands here are a mean to "distort" the original song.

Is there (and this is a big wish on my side) you can help me state my question?

SiggiGue commented 6 years ago

split your problem into small clear questions. then you will get complete answers. e.g. how to read mp3 with python. how to write audio data to mp3 with python. here you will get workarounds like ffmpeg encoding and decoding an writing/reading wav pcm data with python. the filtering is quite clear. maybe you do this in realtime.

Am 20.08.2018 um 17:54 schrieb koren88i notifications@github.com:

I already tried stacksoverflow but I guess I did not asked the right questions.

you wrote my goal is to implement an equalizer with energy dependent bandwidths in the end.

I'll try to reiterate:

my final app is a music player. that based on some score the user get - plays the song accordingly. 100 being the original track. 80 is 7 tracks.. 60 is 6 tracks etc... and the bands here are a mean to "distort" the original song.

Is there (and this is a big wish on my side) you can help me state my question?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

SiggiGue commented 6 years ago

And don't forget to read the documentation http://siggigue.github.io/pyfilterbank. I have no indea about your background, but maybe you should take a look into a/some signal processing book/s as well.

Am 20.08.2018 um 17:54 schrieb koren88i notifications@github.com:

I already tried stacksoverflow but I guess I did not asked the right questions.

you wrote my goal is to implement an equalizer with energy dependent bandwidths in the end.

I'll try to reiterate:

my final app is a music player. that based on some score the user get - plays the song accordingly. 100 being the original track. 80 is 7 tracks.. 60 is 6 tracks etc... and the bands here are a mean to "distort" the original song.

Is there (and this is a big wish on my side) you can help me state my question?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

koren88i commented 6 years ago

Ill try.

you wrote - So maybe you meant to split the signal into bands of equal information content ~ variance ~ energy density. Don't forget, that these properties are often time variant.

can't I just take the average of the information content?

can you explain the fft approach? or point in a direction of good doc?

I am sure my task is super simple (~30 lines of code) for someone who knows the right libraries.. and I can't afford now to delve into the signal processing world.. :(

Sorry I "fell" on you with this.. and thank you for your help so far.