Skip to content

Commit

Permalink
drop pytsmod
Browse files Browse the repository at this point in the history
  • Loading branch information
genisplaja committed Nov 4, 2023
1 parent 8817eb8 commit 444d6b8
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 89 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,7 @@ tests/resources/mir_datasets/*
# For next release
compiam/models/rhythm/4wayTabla/
tests/rhythm/test_4way_tabla.py
compiam/rhythm/transcription/tabla_transcription/
compiam/rhythm/transcription/tabla_transcription/

# To avoid dependency clashes
compiam/utils/augment/augment_data_ps.py
46 changes: 23 additions & 23 deletions compiam/utils/augment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,36 @@

from compiam.utils import create_if_not_exists
from compiam.utils.augment.augment_data_ar import augment_data_attack_remix
from compiam.utils.augment.augment_data_ps import augment_data_pitch_shift
#from compiam.utils.augment.augment_data_ps import augment_data_pitch_shift
from compiam.utils.augment.augment_data_sf import augment_data_spectral_shape
from compiam.utils.augment.augment_data_sr import augment_data_stroke_remix
from compiam.utils.augment.augment_data_ts import augment_data_time_scale

file_dir = os.path.dirname(__file__)


def pitch_shift(in_path, out_dir, shifts=-1.0, sr=16000, n_jobs=4):
"""Pitch shift audio at <in_path>, by shifts in <shifts>. Output to <out_dir>
:param in_path: Path to input audio
:type in_path: str
:param out_dir: Directory to output pitch shifted audios
:type out_dir: str
:param shifts: Pitch shifts value in semitones (or list of values for multiple outputs)
:type shifts: float or list
:param sr: Sampling rate of input audio
:type sr: float
:param n_jobs: n jobs for parrelelization
:type n_jobs: int
"""
create_if_not_exists(out_dir)

if not isinstance(shifts, list):
shifts = [shifts]

_ = Parallel(n_jobs=n_jobs)(
delayed(augment_data_pitch_shift)(in_path, out_dir, sr, ps) for ps in shifts
)
#def pitch_shift(in_path, out_dir, shifts=-1.0, sr=16000, n_jobs=4):
# """Pitch shift audio at <in_path>, by shifts in <shifts>. Output to <out_dir>
#
# :param in_path: Path to input audio
# :type in_path: str
# :param out_dir: Directory to output pitch shifted audios
# :type out_dir: str
# :param shifts: Pitch shifts value in semitones (or list of values for multiple outputs)
# :type shifts: float or list
# :param sr: Sampling rate of input audio
# :type sr: float
# :param n_jobs: n jobs for parrelelization
# :type n_jobs: int
# """
# create_if_not_exists(out_dir)
#
# if not isinstance(shifts, list):
# shifts = [shifts]
#
# _ = Parallel(n_jobs=n_jobs)(
# delayed(augment_data_pitch_shift)(in_path, out_dir, sr, ps) for ps in shifts
# )


def spectral_shape(
Expand Down
62 changes: 0 additions & 62 deletions compiam/utils/augment/augment_data_ps.py

This file was deleted.

5 changes: 3 additions & 2 deletions notebooks/rhythm/0_Tabla_Stroke_Classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
"outputs": [],
"source": [
"# Data augment\n",
"from compiam.utils.augment import pitch_shift, spectral_shape, stroke_remix, time_scale, attack_remix\n",
"#from compiam.utils.augment import pitch_shift dropping for now\n",
"from compiam.utils.augment import spectral_shape, stroke_remix, time_scale, attack_remix\n",
"\n",
"pitch_shift(in_path, out_dir, fs, ps, shifts, n_jobs=n_jobs)\n",
"#pitch_shift(in_path, out_dir, fs, ps, shifts, n_jobs=n_jobs)\n",
"spectral_shape(in_path, out_dir, fs, gain_set, winDur, hopDur, params, n_jobs=n_jobs)\n",
"stroke_remix(in_path, out_dir, fs, gain_set, templates, winDur, hopDur, params, n_jobs=n_jobs)\n",
"time_scale(in_path, out_dir, fs, ts, params, n_jobs=n_jobs)\n",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ matplotlib>=3.0.0
numpy>=1.20.3
joblib>=1.2.0
pathlib~=1.0.1
pytsmod~=0.3.7
#pytsmod~=0.3.7 Needs update
tqdm>=4.66.1
IPython>=7.34.0
ipywidgets>=7.0.0,<8
Expand Down

0 comments on commit 444d6b8

Please sign in to comment.