Sound/wav_files in replicators
Hi Chris,
I was wondering if I could get your help with playing audio (WAV) files on MWorks. I would like to put a long list of WAV file in a list/range replicator, but noticed the following compilation error:
Component 'sound/wav_file' is not allowed inside component 'range_replicator' [line 384, column 9]
- And here are two code snippets I’ve tried so far:
// snippet 1: audio only
range_replicator (
variable = filename
from = 0
to = num_original_videos - 1
step = 1
) {
wav_file ${filename} (
path = 'filenames(audio/audio_*.wav)'
)
}
// snippet 2: audio only
list_replicator (
variable = filename
values = 'filenames(audio/audio_*.wav)'
) {
wav_file ${filename} (
path = ${filename}
autoplay = true
volume = 0
)
}
- I’m not sure if I’m not using the right syntax, or if sound/wav_file is not supported as an indexable stimulus group. Do you have any suggestions?
Thanks!
Yoon
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Christopher Sta... on 14 May, 2021 02:14 PM
Hi Yoon,
Like the error message says, sounds aren't allowed inside replicators. Looking at the MWorks source code, it's not immediately clear to me why they aren't allowed. Let me see if I can figure it out and change things so they are allowed.
In the meantime, I think you're stuck doing things the hard way and defining each sound individually. Sorry!
Chris
2 Posted by Yoon Bai on 25 May, 2021 06:50 PM
Hi Chris,
I wanted to follow up with a workaround, hoping it might help others in the meantime. The workaround is to convert sound clips to video clips. I converted WAV files to MP4 files using ffmpeg <https://ffmpeg.org/> (and added a still image throughout the duration of the sound clip) and this worked well with replicators (verified this on MWorks 0.9 and 0.10).
Best,
Yoon
Support Staff 3 Posted by Christopher Sta... on 26 May, 2021 08:15 PM
Hi Yoon,
That's a clever workaround. Thanks for sharing!
Chris
Support Staff 4 Posted by Christopher Sta... on 23 Jul, 2021 01:40 PM
Hi Yoon,
As of the current MWorks nightly build, sounds are now allowed in range and list replicators (example and example, respectively).
Cheers,
Chris
Christopher Stawarz closed this discussion on 07 Sep, 2021 03:57 PM.