-
Notifications
You must be signed in to change notification settings - Fork 89
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
pitch_shift() takes 1 positional argument but 2 positional arguments (and 1 keyword-only argument) were given #31
Comments
Hello, As shown in the image above the project folder will be displayed. So change the path accordingly C:\>cd c:\users\yoyob\appdata\roaming\python\python311\scripts\ 2 - type the following to get to the source file cd ../site-packages/pianoputer Once you are in the right folder and can see the file pianoputer.py notepad pianoputer.py At line 103 and line 106 in file pianoputer.py if channels == 1:
sound = librosa.effects.pitch_shift(y, sr, n_steps=tone)
else:
new_channels = [
librosa.effects.pitch_shift(y[i], sr, n_steps=tone)
for i in range(channels)
] to if channels == 1:
print(y, len(y))
sound = librosa.effects.pitch_shift(y=y, sr=sr, n_steps=tone)
else:
new_channels = [
librosa.effects.pitch_shift(y=y[i], sr=sr, n_steps=tone)
for i in range(channels)
]
Then run the source code python pianoputer.py Once this has been changed into the project source code and reloaded to PIP |
def pitch(data, sampling_rate, pitch_factor=0.7): def get_features(path): #get audio features without augmentation #get audio features with noise #get audio features with stretching and pitching return result when i call this function from get_features this gives the error "TypeError: pitch_shift() takes 1 positional argument but 2 were given" |
hello, can you provide the method def pitch(data, sampling_rate, pitch_factor=0.7):
return librosa.effects.pitch_shift(data, sampling_rate, pitch_factor=pitch_factor) to def pitch(data, sampling_rate, pitch_factor=0.7):
return librosa.effects.pitch_shift(data, sampling_rate, n_steps=pitch_factor) Kind Regards |
Thank you for this helpful information
…On Fri, Jun 21, 2024 at 11:18 PM Yoann Berenguer ***@***.***> wrote:
hello, can you provide the method extract_features?
This method is missing from your code and I cannot reproduce without it
Also worse changing the method from
def pitch(data, sampling_rate, pitch_factor=0.7):
return librosa.effects.pitch_shift(data, sampling_rate, pitch_factor=pitch_factor)
to
def pitch(data, sampling_rate, pitch_factor=0.7):
return librosa.effects.pitch_shift(data, sampling_rate, n_steps=pitch_factor)
Kind Regards
—
Reply to this email directly, view it on GitHub
<#31 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BJKWNPNQDHBM6IGNEMGSHDLZIRRQJAVCNFSM6AAAAABJT3JVOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBTGE4DGMJSHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
(v3_8) PS C:\Users\WeiHao\PycharmProjects\pianoputer> pianoputer
pygame 2.5.1 (SDL 2.28.2, Python 3.8.17)
Hello from the pygame community. https://www.pygame.org/contribute.html
Generating samples for each key
Transposing note 1 out of 43 for Key.BACKQUOTE
Traceback (most recent call last):
File "C:\Users\WeiHao.conda\envs\v3_8\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\WeiHao.conda\envs\v3_8\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\WeiHao.conda\envs\v3_8\Scripts\pianoputer.exe_main.py", line 7, in
File "C:\Users\WeiHao.conda\envs\v3_8\lib\site-packages\pianoputer\pianoputer.py", line 345, in play_pianoputer
key_sounds = get_or_create_key_sounds(
File "C:\Users\WeiHao.conda\envs\v3_8\lib\site-packages\pianoputer\pianoputer.py", line 102, in get_or_create_key_sounds
sound = librosa.effects.pitch_shift(y, sr, n_steps=tone)
TypeError: pitch_shift() takes 1 positional argument but 2 positional arguments (and 1 keyword-only argument) were given
The text was updated successfully, but these errors were encountered: