-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add torchcrepe #87
Closed
Closed
Add torchcrepe #87
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6696b8b
add options for overriding language, whisper batch size and compute type
BWagener 36e4f1d
fix test setup for vscode
BWagener 8c0a5c7
add flag to disable midi creation
BWagener 3423767
add gaps to plot where no high confidence frequencies exist, filter o…
BWagener f5d1af0
replace crepe with torchcrepe, fix language override option
BWagener f142a77
address review findings
BWagener fbbf29a
enable full frequency range supported by torchcrepe, prevent error du…
BWagener edc1e4e
add missing force crepe cpu flag
BWagener File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
.env | ||
.vscode/ | ||
# virtual environment | ||
venv | ||
.venv | ||
|
||
# python | ||
**__pycache__ | ||
|
||
# test data | ||
test_input | ||
test_output | ||
|
||
# default output folder | ||
output | ||
output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
[tool.isort] | ||
profile = "black" | ||
[tool.pytest.ini_options] | ||
pythonpath = [ | ||
"src", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Tests for whisper.py""" | ||
|
||
import os | ||
import unittest | ||
from src.modules.Audio.denoise import ffmpeg_reduce_noise | ||
import pytest | ||
|
||
|
||
class DenoiseTest(unittest.TestCase): | ||
@pytest.mark.skip(reason="Skipping this FUNCTION level test, can be used for manual tests") | ||
def test_ffmpeg_reduce_noise(self): | ||
# Arrange | ||
test_dir = os.path.dirname(os.path.abspath(__file__)) | ||
root_dir = os.path.abspath(test_dir + "/../../..") | ||
test_file_abs_path = os.path.abspath(root_dir + "/test_input/vocals.wav") | ||
test_file_name = os.path.basename(test_file_abs_path) | ||
test_output = test_dir + "/test_output" | ||
|
||
# Act | ||
ffmpeg_reduce_noise(test_file_abs_path, test_output + "/output_" + test_file_name) | ||
|
||
# Assert | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Tests for pitcher.py""" | ||
|
||
import os | ||
import unittest | ||
import src.modules.Pitcher.pitcher as test_subject | ||
import pytest | ||
|
||
|
||
class PitcherTest(unittest.TestCase): | ||
@pytest.mark.skip(reason="Skipping this FUNCTION level test, can be used for manual tests") | ||
def test_get_pitch_with_crepe_file(self): | ||
# Arrange | ||
test_dir = os.path.dirname(os.path.abspath(__file__)) | ||
root_dir = os.path.abspath(test_dir + "/../../..") | ||
test_file_abs_path = os.path.abspath(root_dir + "/test_input/audio_denoised.wav") | ||
test_file_name = os.path.basename(test_file_abs_path) | ||
test_output = test_dir + "/test_output" | ||
|
||
# Act | ||
test_subject.get_pitch_with_crepe_file(test_file_abs_path, 'full', 'cuda', batch_size=1024) | ||
# test_subject.get_pitch_with_crepe_file(test_file_abs_path, 'full', 'cpu', batch_size=1024) | ||
|
||
print("done") | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
crepe==0.0.13 | ||
librosa==0.9.2 | ||
demucs~=4.0.0 | ||
ffmpeg_python~=0.2.0 | ||
git+https://github.com/m-bain/whisperx.git | ||
langcodes~=3.3.0 | ||
language-data~=1.1 | ||
librosa~=0.9.1 | ||
matplotlib~=3.7.1 | ||
musicbrainzngs~=0.7.1 | ||
numpy~=1.23.5 | ||
Pillow~=10.0.0 | ||
pretty_midi~=0.2.10 | ||
pydub==0.25.1 | ||
Levenshtein~=0.21.0 | ||
scipy~=1.10.1 | ||
PyHyphen~=4.0.3 | ||
python_Levenshtein~=0.21.1 | ||
torchcrepe==0.0.21 | ||
tqdm==4.65.0 | ||
vosk==0.3.44 | ||
tensorflow~=2.12.0 | ||
#tensorflow-directml-plugin~=0.4.0.dev230202 | ||
#cudatoolkit==11.8.0 | ||
matplotlib~=3.7.1 | ||
whisperx~=3.1.1 | ||
yt_dlp~=2023.7.6 | ||
numpy~=1.23.5 | ||
git+https://github.com/m-bain/whisperx.git | ||
PyHyphen~=4.0.3 | ||
demucs~=4.0.0 | ||
tqdm~=4.65.0 | ||
langcodes~=3.3.0 | ||
language-data~=1.1 | ||
Pillow~=9.5.0 | ||
|
||
isort==5.12 | ||
black==23.3 | ||
pylint==2.17 | ||
pytest~=7.3.1 | ||
musicbrainzngs~=0.7.1 | ||
pytest~=7.3.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Empty file?
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.
Interestingly enough this was the only way I could get pytest to properly discover the tests (microsoft/vscode-python#15062 (comment)).
I understand this is specific to the dev environment and not useful for everyone. So if you prefer I can remove the file from the repo and add it to my local gitignore file.