Skip to content

Commit

Permalink
Script to convert to jasper format
Browse files Browse the repository at this point in the history
  • Loading branch information
ynop committed Dec 9, 2019
1 parent 9e072e6 commit 366660a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
10 changes: 10 additions & 0 deletions custom_formats.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This is the path where all output is stored
export PYTHONPATH=$PYTHONPATH:$(pwd)/src
out_path=data

echo "##############################################################"
echo "# Jasperize"
echo "##############################################################"
wave_path=$out_path/full_waverized
jasper_path=$out_path/full_jasperized
python scripts/jasperize.py $wave_path $jasper_path
1 change: 1 addition & 0 deletions data/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ download/
full/
full_normalized/
full_waverized/
full_jasperized/
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
click==7.0
tqdm==4.39.0
git+git://github.com/ynop/audiomate.git@92f5725#egg=audiomate
git+git://github.com/ynop/audiomate.git@30488ce#egg=audiomate
git+git://github.com/ynop/spoteno.git@7700d53#egg=spoteno
34 changes: 34 additions & 0 deletions scripts/jasperize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import os
import click

import audiomate
from audiomate.corpus import io


@click.command()
@click.argument('in_folder', type=click.Path(exists=True))
@click.argument('out_folder', type=click.Path())
@click.option('--base-folder', default=None, type=click.Path())
def run(in_folder, out_folder, base_folder):
if not os.path.exists(out_folder):
if base_folder is None:
base_folder = os.path.dirname(out_folder)

w = io.NvidiaJasperWriter(
num_workers=8,
no_check=True,
data_base_path=base_folder
)
target_audio_path = os.path.join(out_folder, 'audio')
os.makedirs(target_audio_path)

print('Load source corpus')
ds = audiomate.Corpus.load(in_folder)
print('Save jasper corpus')
w.save(ds, out_folder)
else:
print('Already jasperized')


if __name__ == '__main__':
run()

0 comments on commit 366660a

Please sign in to comment.