diff --git a/_prepro_aistpp.py b/_prepro_aistpp.py index 1177eb48..49b10285 100644 --- a/_prepro_aistpp.py +++ b/_prepro_aistpp.py @@ -142,7 +142,7 @@ def extract_acoustic_feature(audio, sr): audio_harmonic, audio_percussive = extractor.get_hpss(audio) # harmonic_melspe_db = get_harmonic_melspe_db(audio_harmonic, sr) # percussive_melspe_db = get_percussive_melspe_db(audio_percussive, sr) - chroma_cqt = extractor.get_chroma_cqt(audio_harmonic, sr) + chroma_cqt = extractor.get_chroma_cqt(audio_harmonic, sr, octave=7 if sr==15360*2 else 5) # chroma_stft = extractor.get_chroma_stft(audio_harmonic, sr) onset_env = extractor.get_onset_strength(audio_percussive, sr) diff --git a/_prepro_aistpp_music.py b/_prepro_aistpp_music.py index bc0d8c3f..dc8b5b2c 100644 --- a/_prepro_aistpp_music.py +++ b/_prepro_aistpp_music.py @@ -25,10 +25,9 @@ store_dir = args.store_dir extractor = FeatureExtractor() -if not os.path.exists(args.train_dir): - os.mkdir(args.train_dir) -if not os.path.exists(args.test_dir): - os.mkdir(args.test_dir) +if not os.path.exists(args.store_dir): + os.mkdir(args.store_dir) + def make_music_dance_set(video_dir): @@ -79,7 +78,7 @@ def extract_acoustic_feature(audio, sr): audio_harmonic, audio_percussive = extractor.get_hpss(audio) # harmonic_melspe_db = get_harmonic_melspe_db(audio_harmonic, sr) # percussive_melspe_db = get_percussive_melspe_db(audio_percussive, sr) - chroma_cqt = extractor.get_chroma_cqt(audio_harmonic, sr) + chroma_cqt = extractor.get_chroma_cqt(audio_harmonic, sr, octave=7 if sr==15360*2 else 5) # chroma_stft = extractor.get_chroma_stft(audio_harmonic, sr) onset_env = extractor.get_onset_strength(audio_percussive, sr) diff --git a/extractor.py b/extractor.py index f3b312bd..12e8b6b7 100644 --- a/extractor.py +++ b/extractor.py @@ -53,8 +53,8 @@ def get_percussive_melspe_db(audio_percussive, sr): return percussive_melspe_db @staticmethod - def get_chroma_cqt(audio_harmonic, sr): - chroma_cqt_harmonic = librosa.feature.chroma_cqt(y=audio_harmonic, sr=sr, n_octaves=5) + def get_chroma_cqt(audio_harmonic, sr, octave=7): + chroma_cqt_harmonic = librosa.feature.chroma_cqt(y=audio_harmonic, sr=sr, n_octaves=octave) print(f'{chroma_cqt_harmonic.shape} -> chroma_cqt_harmonic') return chroma_cqt_harmonic diff --git a/prepare_aistpp_data.sh b/prepare_aistpp_data.sh index 074e8218..16e0c451 100644 --- a/prepare_aistpp_data.sh +++ b/prepare_aistpp_data.sh @@ -3,7 +3,7 @@ python _prepro_aistpp.py python _prepro_aistpp_music.py # for actor critic -python _prepro_aistpp_music.py --store_dir data/aistpp_music_feat --sampling_rate 15360*2 +# python _prepro_aistpp_music.py --store_dir data/aistpp_music_feat --sampling_rate 30720 # remove bad dances; the list is from AIST++ project page for ff in `cat ignore_list.txt`