0

I'm currently working on building an experiment in PsychoPy (v1.82.01 stand-alone). I started on the project several months ago with an older version of PsychoPy.

It worked great and I ran some pilot subjects. We have since adjusted the stimuli sounds and it won’t run.

It looks like there is an issue with referencing the sound file, but I can’t figure out what’s going on.

I recreated the first part of the experiment with a single file rather than a loop so that it would be easier to debug. The sound file is referenced using:

study_sound = sound.Sound(u‘2001-1.ogg’, secs=-1)

When I run it, I get this output:

Screenshot or see below

Running: /Users/dkbjornn/Desktop/Test/test.py

2016-04-29 14:05:43.164 python[65267:66229207] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/9f/3kr6zwgd7rz95bcsfw41ynw40000gp/T/org.psychopy.PsychoPy2.savedState
0.3022  WARNING     Movie2 stim could not be imported and won't be available
sndinfo: failed to open the file.
Traceback (most recent call last):
  File "/Users/dkbjornn/Desktop/Test/test.py", line 84, in <module>
    study_sound = sound.Sound(u'2001-1.ogg', secs=-1)
  File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/sound.py", line 380, in __init__
    self.setSound(value=value, secs=secs, octave=octave, hamming=hamming)
  File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/sound.py", line 148, in setSound
    self._setSndFromFile(value)
  File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/sound.py", line 472, in _setSndFromFile
    start=self.startTime, stop=self.stopTime)
  File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/pyolib/tables.py", line 1420, in setSound
saved data to u'/Users/dkbjornn/Desktop/Test/data/99_test_2016_Apr_29_1405_1.csv'
    _size, _dur, _snd_sr, _snd_chnls, _format, _type = sndinfo(path)
TypeError: 'NoneType' object is not iterable
Milor123
  • 537
  • 4
  • 20
D. Bjornn
  • 1
  • 2

1 Answers1

2

The important thing here is the sndinfo: failed to open the file. message. Most likely, it cannot find your file on the disk. Check the following:

  1. Is the file 2001-1.ogg in the same folder as your experiment? Not in a subfolder? Or have you accidentially changed your path, e.g. using os.chdir?
  2. Is it actually called 2001-1.ogg? Any differences in uppercase/lowercase, spaces, etc. all count.

Alternatively, there's something in the particular way the .ogg was saved that causes the problem, even though the Sound class can read a large set of different sound codecs. Try exporting the sound file in other formats, e.g. .mp3 or .wav.

Jonas Lindeløv
  • 5,442
  • 6
  • 31
  • 54