carlthome / python-audio-effects

Apply audio effects such as reverb and EQ directly to audio files or NumPy ndarrays.
MIT License
386 stars 53 forks source link

Docstrings #14

Open skrungly opened 6 years ago

skrungly commented 6 years ago

It would be much easier to use this if each of the AudioEffectsChain effect methods had docstrings. Right now it's necessary to dig through the source code to find which arguments to use.

mpariente commented 6 years ago

I agree with @kingdom5500, I'd be ready to write docstrings on the effects I'll use.

DannyDannyDanny commented 5 years ago

I'd love to help, how does it work? I clone like I usually would, add docstrings. Then what? 🙈

carlthome commented 5 years ago

@DannyDannyDanny, fork the project, make code changes and send a pull request! https://guides.github.com/introduction/flow/

rudytrubitt commented 5 years ago

@DannyDannyDanny , I can help with some of these too. If you want to assign a few to me I'll work on them.

rudytrubitt commented 5 years ago

I've started at the top of the list (equalizer) and am working down.

rudytrubitt commented 5 years ago

@carlthome , I'm making good progress on the doc strings, but I'm having trouble with bend. Can you give me a working example of how to use this function? It's not clear how to format the three numeric value that are part of each bend. Thanks!

rudytrubitt commented 5 years ago

And I have a similar question regarding chorus. These effects appear to require a single parameter (like "bends" and delays" that are made up of several numbers. I've tried quoting a group of values, and even tried making them a list as shown below, but so far nothing I've tried is working.

fx = (
    AudioEffectsChain()
    .chorus(0.7, 0.9, [55, 0.4, 0.25, 2])
)
rudytrubitt commented 5 years ago

I've added doc strings to most effects that lacked them and created a pull request. Cheers, Rudy

grprksh commented 5 years ago

I've added doc strings to most effects that lacked them and created a pull request. Cheers, Rudy

Hi Rudy,

I needed to use this library for an academic project of mine but I was getting the error '.[WinError 2] The system can not find the file specified'. Can you please help me with this as you are working on it.

Thanks

rudytrubitt commented 5 years ago

i have been using this on Mac OS and have not seen this error. Sorry, not sure what to suggest.

grprksh commented 5 years ago

Hi, Thank you for your response. I have tried using Mac and I was getting the same error. I am attaching the file, can you please check if possible

guru.zip

rudytrubitt commented 5 years ago

sorry, but i won’t be opening your unsolicited zip file. i note that you have no github history. maybe if you tell us more about your project, and your interest in python and sox?

grprksh commented 5 years ago

Hi, I am sorry for sending the zip file.

I am working on an academic project to classify the heartsounds. I wanted to ignore the background noise and I found this package but was unable to use this because of the error. The zip files contained the error, an audio file and my python script.

default _screenshot 2018-11-18 at 16 38 21 screenshot 2018-11-18 at 16 50 15

Python_First:

import librosa from pysndfx import AudioEffectsChain import numpy as np import math import python_speech_features import scipy as sp import os from scipy import signal

assert os.path.isfile('C:/Users/HARISH/Downloads/Guru/train/a0001.wav')

y, sr = librosa.load('Macintosh HD/Users/kabbie/Downloads/a0001.wav',sr = None) cent = librosa.feature.spectral_centroid(y=y, sr=sr) threshold_h = round(np.median(cent))1.5 threshold_l = round(np.median(cent))0.1 less_noise = (AudioEffectsChain().lowshelf(gain=-30.0, frequency=threshold_l, slope=0.8).highshelf(gain=-12.0, frequency=threshold_h, slope=0.5)) y_clean = less_noise('Macintosh HD/Users/kabbie/Downloads/a0001_sc.wav')

Python Secon:

import librosa from pysndfx import AudioEffectsChain import numpy as np import math import python_speech_features import scipy as sp import os import sox from scipy import signal

assert os.path.isfile('C:/Users/HARISH/Downloads/Guru/train/a0001.wav')

y, sr = librosa.load('a0001.wav',sr = None) cent = librosa.feature.spectral_centroid(y=y, sr=sr) threshold_h = round(np.median(cent))1.5 threshold_l = round(np.median(cent))0.1 less_noise = (AudioEffectsChain().lowshelf(gain=-30.0, frequency=threshold_l, slope=0.8).highshelf(gain=-12.0, frequency=threshold_h, slope=0.5)) y_clean = less_noise(y)

rudytrubitt commented 5 years ago

From your screenshot: sox could not be found! Your issue does not appear to be related to python-audio-effects. SoX appears to be installed, but not in a directory that is in your PATH. This isn't an appropriate forum to try and debug this, I suggest https://github.com/mozilla/DeepSpeech/issues/1319 or https://github.com/Homebrew/legacy-homebrew/issues/35643 .

DannyDannyDanny commented 5 years ago

@rudytrubitt Cool beans! Can I still contribute? Or are you getting to a point where I'll be a nuissance more than help?

rudytrubitt commented 5 years ago

Hi @DannyDannyDanny , if you can document bend and chorus, that would be great. I was not able to create a working test example of those, it is not clear to me what syntax is required for all the settings for these effects.

Carl asked me to run docformatter to ensure a consistent formatting which I will get to shortly. If you could do the same with your additions, that would be great. https://pypi.org/project/docformatter/ https://github.com/myint/docformatter#wrapping-descriptions

You can see what I've created docstrings for up to now in my repo: https://github.com/rudytrubitt/python-audio-effects.git

rudytrubitt commented 5 years ago

Hello @carlthome,

I’ve run docformater on my changes and updated my repo at (https://github.com/rudytrubitt/python-audio-effects.git).

Initially I thought I’d create a new pull request, but now I’m thinking that’s not necessary. I do see there are changes to master so that a merge is necessary. Let me know if you need anything else.

Cheers rudy