Skip to content

Commit

Permalink
de a hard code bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lisiyao21 committed Apr 20, 2022
1 parent ff0edde commit 9997e75
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion _prepro_aistpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 4 additions & 5 deletions _prepro_aistpp_music.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion prepare_aistpp_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit 9997e75

Please sign in to comment.