Problem Description: I’m a newcomer to PsychoPy. I’ve developed a basic English word imitation experiment where participants listen to an audio file (a word) and then repeat it.
I’m wondering if it’s possible to download the participant’s mic responses as WAV files on Pavlovia. When I attempted this, it only generated WebM files. Since I aim to conduct phonetic analysis, WAV files are imperative for my research.
Hi Sejung, At the moment pavlovia does only store audio as webmd. However you should be able to convert them offline using a script in PsychoPy coder view. Something like the below should help!
import subprocess
def convert_webm_to_wav(input_webm, output_wav):
# Command to convert WebM to WAV using FFmpeg
command = ['ffmpeg', '-i', input_webm, '-vn', '-acodec', 'pcm_s16le', '-ar', '44100', '-ac', '2', output_wav]
# Execute the command
try:
subprocess.run(command, check=True)
print(f'Conversion successful: {output_wav}')
except subprocess.CalledProcessError as e:
print(f'An error occurred during conversion: {e}')
# Specify the input WebM file and the output WAV file
input_webm_path = 'input.webm'
output_wav_path = 'output.wav'
convert_webm_to_wav(input_webm_path, output_wav_path)
Thank you so much, Becca, for your quick and excellent assistance. Everything works well. However, I need to determine whether the converted files are suitable for phonetic analysis. I understand that WAV files are ideal for this purpose, but I’m uncertain about the quality of conversions from WebM files to WAV files. If anyone can provide advice on this matter, I would greatly appreciate it. Thank you!