Microphone recorded sound slowing down

OS (e.g. Win10): Win 10
PsychoPy version (e.g. 1.84.x): 2023.2
Standard Standalone? (y/n) If not then what?: Yes

I encountered some problems using the microphone component when running it with external microphone from an MRI-compatible audio recording system (i.e., FOMRI-IIIT).
My experiment is fairly simple - participants will read aloud words on each slide with their voice and neural responses recorded in the scanner. So I build an experiment with Psychopy using the microphone component.

It worked well when using my own microphone but when we connected it to the audio system, the recorded sound was slowing down with a lower quality (we compared this with recording using the laptop audio recorder).

No error message was shown though. So I am wondering whether this problem could derive from the wrong audio library (I used ptb as recommended) or input (I only used IOhub for now but will try psychtoolbox next time). Or was it caused by the wrong sampling rate (I used DVD 48khz and it was the only one that worked and matched with the external microphone) or maximal size? I am a bit confused right now and any of your ideas and suggestions are appreciated! Another question is whether the coder version voice.key will work better in this case?

The overall settings for the microphone component are as follows:

Start time: 0s
Stop time: 120s

Save onset/offset times
Sync timing with screen refresh
Speaking start/Stop times
all ticked

Out file Type: default

channels: auto
Sample Rate(HZ) DVD Audio (48kHZ)
Max Recording size 24000

Mix_test properties
Audio library: ptb
Audio latency priority: 4: critical
Force stereo: ticked

Input:
Keyboard Backend: ioHub

If anyone once encountered the same problem and solved it, could you please let me know how you solved it? Or any idea why it went wrong?

Thank you!

1 Like

Hi,

The issue with the recorded sound slowing down and deteriorating in quality might be linked to the audio library, sampling rate, or the compatibility between the FOMRI-IIIT microphone and PsychoPy. One way to tackle this problem is to try out a different audio library, such as ‘sounddevice’. Moreover, tweaking the sampling rate or audio format could potentially resolve the issue. It’s also crucial to check the compatibility between the FOMRI-IIIT microphone and PsychoPy to ensure they’re in sync. Another suggestion would be to use the coder version paired with voice.key, which might yield improved results. Additionally, investigating any potential hardware or software issues with the MRI-compatible audio recording system could provide clarity on the problem. It’s vital to test each of these solutions in isolation, allowing you to identify which one effectively sorts out the issue.

Hope this helps,

Thomas

Hi Thomas, Thank you for all the suggestions! I will try each of them out later this week. However, I am not very aware of how I can investigate any potential hardware or software issues with the MRI-compatible audio recording system as you mentioned. Could you please elaborate a little bit in this regard if possible?

Hi,

For hardware concerns, you might want to ensure all connections are secure, and it could be beneficial to test the FOMRI-IIIT microphone with another software. Interference from the MRI equipment may also be an issue. It might be worth checking for any available firmware updates. On the software front, ensure you’ve selected the proper version of PsychoPy and the microphone’s drivers. Trying out a different recording software could help pinpoint if the challenge is specific to PsychoPy.

Hope this helps,

Thomas

Thank you so much for all the suggestions! I will try all these possible solutions this Thursday and get back to you!

-Yingying

Hi,

You’re welcome! Let me know how it goes.

Thomas

Hi Thomas,

I tried all measures you mentioned using the microphone component but the problem persisted. So I swapped to using voicekey and coder. I could get high-quality audio recordings this time. However, I encountered another problem-I am trying to record the whole audio when participants are looking at a few pictures and talking during the picture presentation. Therefore, instead of placing the voicekey start and stop within the trial loop for image presentation, I separated them and put them outside of the loop. But weirdly, when I checked the recorded audio, the audio recording started way earlier than where it actually was-it started recording right after the beginning of the whole program. I attached the program including psychopy itself, the image folder, condition file and the sample audio in this message. If it is possible, could you please help me take a look and let me know if you spot any problems?
Thank you!
Psychopy_voicekey.zip (7.0 MB)

-Yingying

Hi,

Thank you for the update. I’m pleased to hear that using voicekey in the coder version enhanced your audio quality, though I’m sorry to hear about the timing issue. Firstly, ensure the voicekey start function is placed precisely where you intend the recording to commence and not at the outset of your script or within any sections that run immediately upon starting the programme. It’s vital to ensure that no other triggers or conditions in your code might be kicking off the voicekey recording too early. Moreover, examine the voicekey function settings for any default configurations that might lead to premature recording. If you aim for the recording to begin at a specific point, you might consider adding a delay or wait function to briefly pause the script until you’re ready to record. I’m currently tied up and can’t review your files right away. Please have a go with the suggestions provided. If problems continue, let me know, and I’ll review your files when feasible. Cheers for your understanding.

As shown in the figure, you might need to place the start and stop codes of “voicekey” within the ’trial‘ loop so that the timing will be accurate. Additionally, since you are conducting an fMRI experiment, it’s important to pay attention to the voice onset time relative to the start of the initial experiment.