#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

#### Categories

Supported by

edited July 2016

Dear all,

I am a newcomer here and now now planning a experiment using OpenSesame. I would like to record the voice of the participants. The version I am now working on is 3.1 (Windows). I have downloaded the voice recorder plugin (v0.12-python27-OS_0.27) from the website and copied its folder to the plugins directory of OpenSesame, as the instruction told. I have restart the software, but could still not find the voice recorder in the toolbar. How could I fix the problem. Would really appreciate an answer!!

best wishes
Wu

• edited July 2016

Hi Wu,

Welcome! Please make sure you separately copy the folders inside the downloaded soundrecorder plugin to OpenSesame's plugin folder (so don't put the entire soundrecorder_plugin folder there). For example, the sound recorder plugin consists of two folders, so your OpenSesame plugin folder should look like this:

OpenSesame\opensesame_plugins\soundrecorder_start
OpenSesame\opensesame_plugins\soundrecorder_stop


My guess is that you have placed them in a subfolder in OpenSesame's plugin folder, for example:

OpenSesame\opensesame_plugins\soundrecorder_plugin\soundrecorder_start
OpenSesame\opensesame_plugins\soundrecorder_plugin\soundrecorder_stop


or something similar.

Please let me know if this was the problem.

• edited 10:38PM

Hello dschreij,

Thank you very much for your reply. That‘s exactly the mistake I have made. I have already copy the folders separately to OpenSesame's plugin folder and have found it then in the toolbar! Thanks again for your help！

I still have a question about the sound recorder. I just tried to use this sound recorder plugin to record the sound. But before the videos was showed, the experiment crashed and told me that there was an unexpected error. The details are as follows:

• item-stack:experiment[run].new_loop[run].new_sequence[prepare].new_sound_start_recording[prepare]
• exception message: No module named pymedia
• time: Wed Jul 20 09:56:58 2016
• exception type: ImportError

I didn't quite catch what does "No module named pymedia“ mean, since I have already installed pymedia in my laptop. And does the "importError" mean that the microphone does not work properly?

Perhaps these questions are quite basic, but since I am not a programmer it's quite difficult for me figure out the problems. I hope it would not bother you and thanks in advance for help and instructions.

best regards
Wu

• edited 10:38PM

Hi Wu, OpenSesame uses its own pymedia module, that comes with the soundrecording module. It is weird that it complains about not finding pymedia, since you appear to have selected the correct file for download. Can you try downloading https://github.com/dschreij/opensesame_soundrecorder_plugins/archive/python27.zip and open it with a zip viewe? You should see that the pymedia folder is in included in the soundrecorder_start folder.

• edited 10:38PM

Hello dschreij,

Thanks a lot for your help! It does work.:) I have checked the elder folder and did not find the pymedia folder inside. But I do find the pymedia in the newly downloaded soundrecording module that was recommended by you. Thanks again!

If it's possible, I still want to ask another question which I just encountered. I just tried to run the experiment again, but before the videos were showed, the experiment crashed and told me that “object of type 'NoneType' has no len()” error.

The main part of the experiment is like this:

I will show videos one by one to my participants and they should describe them as soon as possibile. This is a self-paced experiment so they can move on to the next video by clicking the Space-button after the discriptions. What I would like to record is, 1. the discriptions and 2. the speech onset time. I still have the following questions:

1. How could I fix the “object of type 'NoneType' has no len()” error? I think I should reset something in the "sound_start_recording".

2. If I want to measure the speech onset time, how could I set the duration, should I set it with "sound" instead of "keypress". But I am afraid in this case the video will switch to the next one as soon as the software get the sound.

Thanks in advance for lending a hand again!

best regards,
Wu

• edited 10:38PM

Hi Wu,

1. Which video player plugin are you using? I have made several over the course of the last few years, but the one included with OpenSesame nowadays is media_player_mpy. Is that the one you are using? Or is it media_player_vlc or media_player_gst.

2. Could you post the full stacktrace that you see with the error message? On its own

object of type 'NoneType' has no len()


doesn't tell us very much. Usually a list of functions that were called is shown above the error message. Could you post that here? (Encapsulating it in three tildes (~) so the output looks nice?) If I have that information we can go bug-hunting!

Regarding your question about the speech onset time: This may be a bit more difficult. OpenSesame currently has no functionalities to automatically measure the onset time of recorded sounds. You will either have to

1. Do this manually. You can be sure that the moment at which the sound recording starts is the same for every trial. Thus you can view each sound file in a wave editor and measure the time from the start of the recording, until the onset of the sound. Audacity is an open-source sound editor that may have these functionalities.

2. You can try and find another python library that does this for you. A quick google search delivered me https://pypi.python.org/pypi/soundmeter, but I don't know if it fits your needs. After your experiment is finished, you can run all your sound recordings through a separate analysis script that uses a module like soundmeter to determine the onset times.

Sorry this isn't more convenient yet. The soundrecorder plugin is pretty old, and dare I say obsolete. We are thinking of implementing a new one with more options such as measuring sound onset, but we haven't come that far yet.

Daniel

• edited July 2016

Hi Daniel,

Thanks a lot for your reply! I am also very happy that we got further!

The video player pulgin I am using is media_player_mpy. It's the one that are installed in version 3.1. The full stacktrace is as follows:

 File "D:\OpenSesame\lib\site-packages\libqtopensesame\misc\process.py", line 140, in run
exp.run()

File "D:\OpenSesame\lib\site-packages\libopensesame\experiment.py", line 411, in run
self.items.execute(self.var.start)

File "D:\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 89, in execute
self.run(name)

File "D:\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 104, in run
self[name].run()

File "D:\OpenSesame\lib\site-packages\libopensesame\sequence.py", line 51, in run
self.experiment.items.run(_item)

File "D:\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 104, in run
self[name].run()

File "D:\OpenSesame\lib\site-packages\libopensesame\loop.py", line 318, in run
self.experiment.items.execute(self._item)

File "D:\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 88, in execute
self.prepare(name)

File "D:\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 120, in prepare
self[name].prepare()

File "D:\OpenSesame\lib\site-packages\libopensesame\sequence.py", line 124, in prepare
self.experiment.items.prepare(_item)

File "D:\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 120, in prepare
self[name].prepare()

File "D:\OpenSesame\lib\site-packages\share\opensesame_plugins\sound_start_recording\sound_start_recording.py", line 117, in prepare
output_file = os.path.normpath(os.path.join(self.exp.experiment_path,rel_loc))

File "D:\OpenSesame\lib\ntpath.py", line 65, in join
result_drive, result_path = splitdrive(path)

File "D:\OpenSesame\lib\ntpath.py", line 115, in splitdrive
if len(p) > 1:
TypeError: object of type 'NoneType' has no len()


And I also would like to thank you for the explanation about the speech onset time. Doing it manually is no problem!

best regards,
Wu

• edited 10:38PM

Hmm, it appears as if something goes wrong with determining the location of the output sound file.

What have you entered in the field that specifies the location to which the recorded sound file is saved?

Alternatively, the soundrecorder plugin is quite old and was built when OpenSesame 2 was the main version, so it might be that something has changed in OpenSesame 3 that breaks this. @sebastiaan, do you maybe know if anything changed in the newer versions of OpenSesame that can cause this to break? Could it be that self.exp.experiment_path no longer exists?

• Hello Daniel,

The output Folder is "default". Can it be the problem of the output sound file. I have changed it to the "desk", but the warning still remains. The details about the sound recorder plugin is as follows:

Record sound: yes
channels: Mono
sample rate: 44100
Output Folder/File: default
Compression: None (wav)
If files exists (Overwrite)

Thanks again for the help!!

best regards,
Wu

• Hi Wu,
I will try and see if I can reproduce your problem in the next few days. I can't really guess what the problem is from your information. So I have to try to generate it myself. Bear with me, and I hope I can come back to you with more information soon.
Daniel

• Hi Daniel,

Thanks a lot for this!!!

I am looking forward to hearing from you soon!

best wishes,
Wu

• Hi Wu,

I have tried it and get the same error, but only if I have not saved the experiment yet. Have you saved your experiment before trying to run it?

This definitely is a bug, and I will push a fix to Github where user's are notified they need to save their experiment before they can record sound.

Thanks for pointing this out.

• I have just put a new version of the plugin online that issues a warning, stating that the experiment should be saved first before sound can be recorded. You can find it at

https://github.com/dschreij/opensesame_soundrecorder_plugins/releases/tag/v0.14

(download the .zip file). Could you try it out and see if it works?

• edited July 2016

Hello Daniel，

I am really grateful for your help!! I have stored the experiment and the experiment runs. But still got a problem, that is every time after the first video was showed and I pressed the button to switch to the next one, it breaks. And it shows that "Stopped - The experiment did not finish normally for the following reason: sound recorder already running". And still, I could find the audio which was just recorded by the micro phone.

the sequence is: media_player_mpy → sound_start_recording → keyboard_response → logger.

My design is: The participants will watch a series of videos one by one. Once one video was showed, they should describe it through a microphone as soon as possible. I would like to record the sound and also the speech onset time（ I will use the Audacity which you have recommended above to check the spech onsets). After the description, they should press the space button to switch to the next trial.

My setting is as follows:

media_player_mpy:
set video_src "[video_clips]"
set soundrenderer sounddevice
set resizeVideo yes
set playaudio yes
set loop no
set event_handler_trigger "on keypress"
set event_handler ""
set duration keypress
set description "Media player based on moviepy"

sound_start_recording:
set description "Sound recorder plugin for OpenSesame"

keyboard_response:
set timeout infinite
set flush yes
set duration keypress
set description "Collects keyboard responses"
set allowed_responses SPACE

Can it be the problem of the sequence or the settings?

• edited July 2016

Best regards,
Wu

• Hi Wu,

That seems to be correct behavior of OpenSesame, because you don't stop the sound recorder in the trial. Therefore it will still be running when a new trial starts, and then the 'sound_start_recording' item tries to start recording sound again, while the previous recording is still ongoing, causing this error. To fix this you have to add a sound_stop_recording somewhere in your trial. Then your sequence will look something like this:

media_player_mpy → sound_start_recording → keyboard_response → sound_stop_recording → logger.


this will record sound until the user presses a key. I think that is what you intend to do, and that is the purpose of the keyboard_response item? let me know if this works.

Best,

Daniel

• Hello Daniel,

Thanks a lot for your patient explanation! That is exactly what I want to get, namely the timw window between the video onset and the speech onset, and the keyboard_response will be used only to switch the videos. Thanks again!!

I have tried right now, it worked perfect and I also get a csv formular showing relevant datas. But still could not find the sound files for each videos that should be recorded by the Microphone. I have just checked the micro phone and it works. How could I fix it? I am sorry for the disturbance.

Greetings,
Wu

• edited July 2016

Hi Wu,

the files are saved at the location that you specify in the field Output folder/file, the one which normally contains default. With default set, each recording will be saved as default.wav or default.mp3 (depending on the output format you selected) in the same folder as the experiment file is located. But you can also save recordings in a subfolder, by for instance setting this field to recordings/default.

If you have the option If file exists set to overwrite then each new recording will overwrite the previous one, leaving you with only one recording at the end. So you will want to give each recording a unique filename, such that they are not overwritten. You can use your experimental variables for this. For instance it is allowed to set the value recordings/subject_[subject_nr]/trial-[count_trial_sequence], if the sequence which contains your trial items is called trial_sequence (if not, you should change the variable name that I use above to [count_<your_sequence_name>] or rename the sequence to trial_sequence). If we take subject 3 on trial 11 as an example, the recording will be saved as

recordings/subject_3/trial-11.wav

You can read more about all these settings by viewing the help page of the sound recorder which appears if you click the question mark button at the top right of sound recorder's configuration panel.

Also, make sure you have the option record sound set to yes!

I hope this helps.