Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

migperfer
Copy link

Added some functions that could be helpful to someone.
Also added the possibility of execute module meter.py with the included main directly.

if curve.lower() == "z":
return segment.dBFS
if curve.lower() == "a":
b = np.array([0.25574113, -0.51148225, -0.25574113, 1.0229645, -0.25574113,
Copy link
Owner

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?

Copy link
Author

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)
Copy link
Owner

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?

Copy link
Author

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.

@shichao-an
Copy link
Owner

@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

@migperfer
Copy link
Author

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.
Sorry for taking so long to answer, I had been very busy studying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants