-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ponderation curves #32
base: master
Are you sure you want to change the base?
Conversation
if curve.lower() == "z": | ||
return segment.dBFS | ||
if curve.lower() == "a": | ||
b = np.array([0.25574113, -0.51148225, -0.25574113, 1.0229645, -0.25574113, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jajaxdlol Are these hardcoded numbers only for the 44100 frequency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are hardcoded for 44100 freq yes. I'm not good at filter design so I have no idea on how to create a function to create curves according to frequency, I wasn't sure if you wanted to add a dependency to another library.
b = np.array([0.21700856, 0., -0.43401712, 0., 0.21700856]), | ||
a = np.array([1., -2.13467496, 1.27933353, -0.14955985, 0.0049087]) | ||
y = np.float32(lfilter(b, a, segment.get_array_of_samples())) | ||
audio_segment = pydub.AudioSegment(y.tobytes(), frame_rate=44100, sample_width=y.dtype.itemsize, channels=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we pull the config for frame_rate from self.config.RATE
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right! But for that, we should have weighting curves that depends on frequency.
@jajaxdlol Thank you for your PR. Looks a very cool feature! I left some comment in your code. I was wondering if these can be applied to different rates |
If you want we can make it as long as I told you, you don't mind to add dependency to another python library which allows to create filters according to frequency. |
Added some functions that could be helpful to someone.
Also added the possibility of execute module meter.py with the included main directly.