diff --git a/code/generate_audio/audios/animation1.wav b/code/generate_audio/audios/animation1.wav new file mode 100644 index 0000000..57d5a91 Binary files /dev/null and b/code/generate_audio/audios/animation1.wav differ diff --git a/code/generate_audio/audios/animation2.wav b/code/generate_audio/audios/animation2.wav new file mode 100644 index 0000000..f2bfd97 Binary files /dev/null and b/code/generate_audio/audios/animation2.wav differ diff --git a/code/generate_audio/audios/animation3.wav b/code/generate_audio/audios/animation3.wav new file mode 100644 index 0000000..5f14ff8 Binary files /dev/null and b/code/generate_audio/audios/animation3.wav differ diff --git a/code/generate_audio/audios/animation4.wav b/code/generate_audio/audios/animation4.wav new file mode 100644 index 0000000..97bb698 Binary files /dev/null and b/code/generate_audio/audios/animation4.wav differ diff --git a/code/generate_audio/audios/demo1.wav b/code/generate_audio/audios/demo1.wav new file mode 100644 index 0000000..a1c135f Binary files /dev/null and b/code/generate_audio/audios/demo1.wav differ diff --git a/code/generate_audio/audios/example1.wav b/code/generate_audio/audios/example1.wav new file mode 100644 index 0000000..e60c645 Binary files /dev/null and b/code/generate_audio/audios/example1.wav differ diff --git a/code/generate_audio/audios/example2.wav b/code/generate_audio/audios/example2.wav new file mode 100644 index 0000000..61dff2c Binary files /dev/null and b/code/generate_audio/audios/example2.wav differ diff --git a/code/generate_audio/audios/snack1.wav b/code/generate_audio/audios/snack1.wav new file mode 100644 index 0000000..54efbf5 Binary files /dev/null and b/code/generate_audio/audios/snack1.wav differ diff --git a/code/generate_audio/audios/snack10.wav b/code/generate_audio/audios/snack10.wav new file mode 100644 index 0000000..10d1d0b Binary files /dev/null and b/code/generate_audio/audios/snack10.wav differ diff --git a/code/generate_audio/audios/snack11.wav b/code/generate_audio/audios/snack11.wav new file mode 100644 index 0000000..5cca5de Binary files /dev/null and b/code/generate_audio/audios/snack11.wav differ diff --git a/code/generate_audio/audios/snack12.wav b/code/generate_audio/audios/snack12.wav new file mode 100644 index 0000000..d2a7ce6 Binary files /dev/null and b/code/generate_audio/audios/snack12.wav differ diff --git a/code/generate_audio/audios/snack13.wav b/code/generate_audio/audios/snack13.wav new file mode 100644 index 0000000..3bf9d18 Binary files /dev/null and b/code/generate_audio/audios/snack13.wav differ diff --git a/code/generate_audio/audios/snack2.wav b/code/generate_audio/audios/snack2.wav new file mode 100644 index 0000000..a5381c0 Binary files /dev/null and b/code/generate_audio/audios/snack2.wav differ diff --git a/code/generate_audio/audios/snack3.wav b/code/generate_audio/audios/snack3.wav new file mode 100644 index 0000000..31fa01f Binary files /dev/null and b/code/generate_audio/audios/snack3.wav differ diff --git a/code/generate_audio/audios/snack4.wav b/code/generate_audio/audios/snack4.wav new file mode 100644 index 0000000..54efbf5 Binary files /dev/null and b/code/generate_audio/audios/snack4.wav differ diff --git a/code/generate_audio/audios/snack5.wav b/code/generate_audio/audios/snack5.wav new file mode 100644 index 0000000..75af132 Binary files /dev/null and b/code/generate_audio/audios/snack5.wav differ diff --git a/code/generate_audio/audios/snack6.wav b/code/generate_audio/audios/snack6.wav new file mode 100644 index 0000000..a5381c0 Binary files /dev/null and b/code/generate_audio/audios/snack6.wav differ diff --git a/code/generate_audio/audios/snack7.wav b/code/generate_audio/audios/snack7.wav new file mode 100644 index 0000000..a5381c0 Binary files /dev/null and b/code/generate_audio/audios/snack7.wav differ diff --git a/code/generate_audio/audios/snack8.wav b/code/generate_audio/audios/snack8.wav new file mode 100644 index 0000000..a5381c0 Binary files /dev/null and b/code/generate_audio/audios/snack8.wav differ diff --git a/code/generate_audio/audios/snack9.wav b/code/generate_audio/audios/snack9.wav new file mode 100644 index 0000000..2db506b Binary files /dev/null and b/code/generate_audio/audios/snack9.wav differ diff --git a/code/generate_audio/audios/tv1.wav b/code/generate_audio/audios/tv1.wav new file mode 100644 index 0000000..e60e820 Binary files /dev/null and b/code/generate_audio/audios/tv1.wav differ diff --git a/code/generate_audio/audios/tv2.wav b/code/generate_audio/audios/tv2.wav new file mode 100644 index 0000000..320d093 Binary files /dev/null and b/code/generate_audio/audios/tv2.wav differ diff --git a/code/generate_audio/audios/tv3.wav b/code/generate_audio/audios/tv3.wav new file mode 100644 index 0000000..df43349 Binary files /dev/null and b/code/generate_audio/audios/tv3.wav differ diff --git a/code/generate_audio/audios/tv4.wav b/code/generate_audio/audios/tv4.wav new file mode 100644 index 0000000..3eecc74 Binary files /dev/null and b/code/generate_audio/audios/tv4.wav differ diff --git a/code/generate_audio/audios/tv5.wav b/code/generate_audio/audios/tv5.wav new file mode 100644 index 0000000..df43349 Binary files /dev/null and b/code/generate_audio/audios/tv5.wav differ diff --git a/code/generate_audio/audios/tv6.wav b/code/generate_audio/audios/tv6.wav new file mode 100644 index 0000000..35bbf92 Binary files /dev/null and b/code/generate_audio/audios/tv6.wav differ diff --git a/code/generate_audio/audios/tv7.wav b/code/generate_audio/audios/tv7.wav new file mode 100644 index 0000000..50d1f70 Binary files /dev/null and b/code/generate_audio/audios/tv7.wav differ diff --git a/code/generate_audio/components/close_door.wav b/code/generate_audio/components/close_door.wav new file mode 100644 index 0000000..fd1e1e4 Binary files /dev/null and b/code/generate_audio/components/close_door.wav differ diff --git a/code/generate_audio/components/close_fridge.wav b/code/generate_audio/components/close_fridge.wav new file mode 100644 index 0000000..c46717f Binary files /dev/null and b/code/generate_audio/components/close_fridge.wav differ diff --git a/code/generate_audio/components/close_television.wav b/code/generate_audio/components/close_television.wav new file mode 100644 index 0000000..05253e7 Binary files /dev/null and b/code/generate_audio/components/close_television.wav differ diff --git a/code/generate_audio/components/drop_remote.wav b/code/generate_audio/components/drop_remote.wav new file mode 100644 index 0000000..80f9488 Binary files /dev/null and b/code/generate_audio/components/drop_remote.wav differ diff --git a/code/generate_audio/components/empty.wav b/code/generate_audio/components/empty.wav new file mode 100644 index 0000000..1670543 Binary files /dev/null and b/code/generate_audio/components/empty.wav differ diff --git a/code/generate_audio/components/idle_television.wav b/code/generate_audio/components/idle_television.wav new file mode 100644 index 0000000..3aa5d8c Binary files /dev/null and b/code/generate_audio/components/idle_television.wav differ diff --git a/code/generate_audio/components/open_door.wav b/code/generate_audio/components/open_door.wav new file mode 100644 index 0000000..3a31063 Binary files /dev/null and b/code/generate_audio/components/open_door.wav differ diff --git a/code/generate_audio/components/open_fridge.wav b/code/generate_audio/components/open_fridge.wav new file mode 100644 index 0000000..044defa Binary files /dev/null and b/code/generate_audio/components/open_fridge.wav differ diff --git a/code/generate_audio/components/open_television.wav b/code/generate_audio/components/open_television.wav new file mode 100644 index 0000000..05253e7 Binary files /dev/null and b/code/generate_audio/components/open_television.wav differ diff --git a/code/generate_audio/components/pickup_remote.wav b/code/generate_audio/components/pickup_remote.wav new file mode 100644 index 0000000..1b4668d Binary files /dev/null and b/code/generate_audio/components/pickup_remote.wav differ diff --git a/code/generate_audio/components/pickup_snack.wav b/code/generate_audio/components/pickup_snack.wav new file mode 100644 index 0000000..91f63bd Binary files /dev/null and b/code/generate_audio/components/pickup_snack.wav differ diff --git a/code/generate_audio/components/step.wav b/code/generate_audio/components/step.wav new file mode 100644 index 0000000..3baf61f Binary files /dev/null and b/code/generate_audio/components/step.wav differ diff --git a/code/generate_audio/generate_audio.py b/code/generate_audio/generate_audio.py new file mode 100644 index 0000000..28a7a7d --- /dev/null +++ b/code/generate_audio/generate_audio.py @@ -0,0 +1,27 @@ +import os +import csv +from pydub import AudioSegment +from trial_actions import * + +component_dir = 'components' +audio_dir = 'audios' +model_data_file = '../model_data/audios.csv' + +with open(model_data_file, 'w') as f: + csvwriter = csv.writer(f) + csvwriter.writerow(['trial', 'audio']) + + for trial, actions in trial_actions.items(): + # generate audio file + audios = [] + for action in ['empty'] + actions: + audio_file = os.path.join(component_dir, ACTION_TO_FILE[action]) + audios.append(AudioSegment.from_wav(audio_file)) + combined_sounds = sum(audios) + velocidad_X = 1.75 + combined_sounds = combined_sounds.speedup(velocidad_X) + combined_sounds.export(os.path.join(audio_dir, f'{trial}.wav'), format = 'wav') + + # record string version + if trial.startswith('snack') or trial.startswith('tv'): + csvwriter.writerow([trial, ', '.join(map(lambda x: ACTION_TO_STRING[x], actions))]) diff --git a/code/generate_audio/trial_actions.py b/code/generate_audio/trial_actions.py new file mode 100644 index 0000000..f593b41 --- /dev/null +++ b/code/generate_audio/trial_actions.py @@ -0,0 +1,66 @@ +ACTION_TO_FILE = { + 'close_door': 'close_door.wav', + 'close_fridge': 'close_fridge.wav', + 'close_television': 'close_television.wav', + 'drop_remote': 'drop_remote.wav', + 'empty': 'empty.wav', + 'step': 'step.wav', + 'idle_television': 'idle_television.wav', + 'open_door': 'open_door.wav', + 'open_fridge': 'open_fridge.wav', + 'open_television': 'open_television.wav', + 'pickup_remote': 'pickup_remote.wav', + 'pickup_snack': 'pickup_snack.wav', +} + +ACTION_TO_STRING = { + 'close_door': 'door closed', + 'close_fridge': 'fridge closed', + 'close_television': 'TV turned off', + 'drop_remote': 'remote dropped', + 'empty': 'silence', + 'step': 'step', + 'idle_television': 'TV playing', + 'open_door': 'door opened', + 'open_fridge': 'fridge opened', + 'open_television': 'TV turned on', + 'pickup_remote': 'remote picked up', + 'pickup_snack': 'snack picked up', +} + +fridge_seq = ['open_fridge', 'pickup_snack', 'close_fridge'] +spill = [] +tv_seq = ['pickup_remote', 'open_television', 'idle_television', 'close_television'] + +trial_actions = { + # examples + 'animation1': ['step'] + ['open_door'] + ['step'] * 9 + ['empty'] + fridge_seq, + 'animation2': ['close_fridge', 'empty'] + ['step'] * 6 + spill + ['step'] * 4, + 'animation3': ['step'] + ['open_door'] + ['step'] * 7 + ['pickup_remote', 'step', 'empty', 'open_television', 'idle_television'], + 'animation4': ['idle_television', 'close_television', 'step', 'step', 'drop_remote'] + ['step'] * 6, + 'demo1': ['step', 'open_door'] + ['step'] * 9 + fridge_seq + ['step'] * 10, + 'example1': [], + 'example2': ['step'] * 2 + ['open_door'] + ['step'] * 12 + tv_seq + ['step'] * 2 + ['drop_remote'] + ['step'] * 10 + ['close_door'] + ['step'] * 2, + # snack trials + 'snack1': ['step'] * 8 + fridge_seq + ['step'] * 8, + 'snack2': ['step'] * 10 + fridge_seq + ['step'] * 10, + 'snack3': ['step'] * 16 + fridge_seq + ['step'] * 16, + 'snack4': ['step'] * 8 + fridge_seq + ['step'] * 3 + spill + ['step'] * 5, + 'snack5': ['step'] * 7 + fridge_seq + ['step'] * 2 + spill + ['step'] * 5, + 'snack6': ['step'] * 10 + fridge_seq + ['step'] * 10, + 'snack7': ['step'] * 10 + fridge_seq + ['step'] * 2 + spill + ['step'] * 8, + 'snack8': ['step'] * 10 + fridge_seq + ['step'] * 6 + spill + ['step'] * 4, + 'snack9': ['step'] * 10 + fridge_seq + ['step'] * 2 + spill + ['step'] + ['step'] * 10, + 'snack10': ['step'] * 10 + fridge_seq + ['step'] * 6 + spill + ['step'] * 16, + 'snack11': ['step'] * 2 + ['open_door'] + ['step'] * 9 + fridge_seq + ['step'] * 11, + 'snack12': ['step'] * 11 + fridge_seq + ['step'] * 11, + 'snack13': ['step'] * 2 + ['open_door'] + ['step'] * 8 + fridge_seq + ['step'] * 8 + ['close_door'] + ['step'] * 2, + # tv trials + 'tv1': ['step'] * 9 + tv_seq + ['step'] * 2 + ['drop_remote'] + ['step'] * 7, + 'tv2': ['step'] * 11 + tv_seq + ['step'] * 2 + ['drop_remote'] + ['step'] * 13, + 'tv3': ['step'] * 9 + tv_seq + ['drop_remote'] + ['step'] * 9, + 'tv4': ['step'] * 2 + ['open_door'] + ['step'] * 10 + tv_seq + ['drop_remote'] + ['step'] * 12, + 'tv5': ['step'] * 9 + tv_seq + ['drop_remote'] + ['step'] * 9, + 'tv6': ['step'] * 4 + ['open_door'] + ['step'] * 8 + tv_seq + ['drop_remote'] + ['step'] * 8 + ['close_door'] + ['step'] * 4, + 'tv7': ['step'] * 2 + ['open_door'] + ['step'] * 6 + tv_seq + ['step'] * 2 + ['drop_remote'] + ['step'] * 10 +}