Hello, I am using the “mic” component to save a new created “wav” file in the folder. Please let me know what could be the reason
OS : Win10
PsychoPy version : 2022.1.3
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?:
I am using “mic” component trying to save the “wav” data files in the folder, however when I open the created “wav” data folder there is no file saved.
What did you try to make it work?:
I am using “mic” component to record the sounds
I wrote the microphone code at “Compline to Python Script”.
Using the following code:
micRecFolder = filename + ‘_mic_recorded’
if not os.path.isdir(micRecFolder):
What specifically went wrong when you tried that?:
Experiment runs, but I do not receive an error about “mic” component, that could specify why the “wav” files aren’t saving.
Hi, did you first create the mic component on builder mode and then added the additional line of code when you compiled to coder? If so, any changes you made in coder would not be reflected in builder.
That being said, if you’re running your task locally, your recordings are saved in wav format in the data folder.
Hi @suelynnmah, thanks for the reply. We created the “mic” component in the Psychopy, but did not make any changes in the code. the folder is saving, but there are no wav files inside the folder, so no audio recordings.
Hi, would you mind sharing your task so that I can try to replicate this issue on my end?
Hi, @suelynnmah thank you, I am sharing with you the task. I want to tell you, that we used import nidaqmx for our task as our experiment includes sliders (national instrument card) that are connected to the computer, so maybe when you try to run it will show an error.
pong_t5.psyexp (37.2 KB)
Hi, I couldn’t run your task without your conditions file but I tried to make a new routine with a mic component and it does indeed save wav files within the data folder. However, I also included a placeholder instruction routine before this new routine to initialise the mic. Perhaps this is something you can try on your end.
Hi @suelynnmah, thank you for trying and letting me know. I want to tell you that the recordings are saving. we have 125 trials in total and mic is recording during all the trials. Before we never run the trials from beginning to end, that was why the files were showing empty. Later we run all the trials and after we checked that the wav files were all saved
Hi, could you please clarify how to include a placeholder instruction routine to initialize the mic? Thank you so much!
Hi @fassaneo1 , you can just make a new routine right before the routine where your mic is
Hi, I’m facing the same issue with the mic component (no .wav file in folder). Could you please detail what you wrote in the routine right before the routine where the mic is? Is it a code component to initialize the mic component?
Or would you mind sharing your version with the placeholder instruction routine?
Thanks in advance!
micDemo.psyexp (13.3 KB)
Hi @AFG, here’s the demo. Note that you need to complete the whole task for the recordings to be saved (i.e. if you hit escape, the files will not be saved)
Thank you very much @suelynnmah. Unfortunately, even with your demo, the audio folder still appears empty (I did wait for it to close by itself). And I also have the following error message, I don’t know if it coud be related:
############# Running: C:\Users\anef_\Downloads\micDemo_lastrun.py #############
17809.1266 INFO Loaded monitor calibration from [‘2022_05_27 12:37’]
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. Contribute - pygame wiki
PTB-INFO: Using modified PortAudio V19.7.0-devel, revision unknown
Traceback (most recent call last):
PTB-INFO: New audio device 5 with handle 0 opened as PortAudio stream:
PTB-INFO: For 2 channels Capture: Audio subsystem is Windows WASAPI, Audio device name is Microphone Array (Technologie Intel® Smart Sound pour microphones numériques)
PTB-INFO: Real samplerate 48000.000000 Hz. Input latency 10.000000 msecs, Output latency 0.000000 msecs.
2.9118 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’] (in that order).
5.9198 WARNING User requested fullscreen with size [1024 768], but screen is actually [1920, 1080]. Using actual size
0.7303 WARNING Monitor specification not found. Creating a temporary one…
File “C:\Users\anef_\Downloads\micDemo_lastrun.py”, line 349, in
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\microphone.py”, line 802, in stop
psychopy.sound.exceptions.AudioStreamError: Cannot stop a stream that has not been started.
################ Experiment ended with exit code 1 [pid:11016] #################
If you have an idea why I do get this, I’ll be happy to hear it! I’m using Psychopy’s last version, maybe it could be an explanation?
I finally found an aternative solution using the voicekey, that is also recording .wav file. Partly solved then
Hmm how odd. May I ask what version of psychopy are you using because I created this task in 2022.2.0 and it recorded the wav files for me
I’m using the same version, 2022.2.0, on Windows. Maybe we didn’t set the same parameters in the general experiment settings? I didn’t change default parameters (eg “use prefs” in both “Audio library” and “Audio latency priority”).
Yes my preferences are ptb by default. If you don’t mind, perhaps you could send me your task and I can try and replicate this issue on my end