| Reference | Downloads | Github

Program crashes when using sound in mac pro and the library pyo

The following code:

from psychopy import *
win = visual.Window(monitor='testMonitor',allowGUI=False,units='deg')
tick = sound.Sound(1500,secs=0.01,sampleRate=44100, bits=8)

crashes psychopy 1.84.1 in a new mac pro giving the following message:

Fatal Python error: (pygame parachute) Segmentation Fault

The same code does not crash in a old macbook pro retina with the same version of psychopy. It gives a Warning:

WARNING: 140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API’s in AudioComponent.h.

The general preferences look like this:

When I swap ‘pyo’ and ‘pygame’ in the preferences, the crash in the mac pro does not occur. The problem is that using pygame the synchronization between sounds and visual signals is pretty bad as measured with an oscilloscope.

I’m afraid I don’t know why that would be. The vagaries of pyo.

Potential workarounds:

  1. Could you try pysoundcard which should be available in the 1.84.1 standalone package (wasn’t working in the 1.84.0 standalone though)? So set your preferences to ‘pysoundcard’,‘pyo’,‘pygame’ or leave out pyo altogether to make sure it gets ignored.
  2. you might get away with sticking to ‘pyo’ for the lib but switching the audio driver to use coreaudio before portaudio (but I think that’s the configuration that caused some machines not to quit properly at the end of the study)
1 Like

Thanks! I tried both and don’t work.

The workaround 2 gives the same error.

The workaround 1 gives the error message:

######## Running: /Users/visca/Documents/dani/choicebiastoj/sti/ ########
2016-09-07 15:39:19.982 python[790:8900] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/0t/rzh79psd47q4t32y37298jlr0000gn/T/org.psychopy.PsychoPy2.savedState
Traceback (most recent call last):
File “/Users/visca/Documents/dani/choicebiastoj/sti/”, line 4, in
tick = sound.Sound(1500,secs=0.01,sampleRate=44100, bits=8)
File “/Applications/”, line 336, in init
self.setSound(value=value, secs=secs, octave=octave)
File “/Applications/”, line 147, in setSound
self._setSndFromFreq(value, secs, hamming=hamming)
File “/Applications/”, line 200, in _setSndFromFreq
File “/Applications/”, line 438, in _setSndFromArray
File “/Applications/”, line 668, in init
’input’, idevice, ichannels, idtype, ilatency, samplerate)
File “/Applications/”, line 700, in _get_stream_parameters
info = device_info(device)
File “/Applications/”, line 267, in device_info
raise RuntimeError(“Invalid device”)
RuntimeError: Invalid device
Exception AttributeError: “‘SoundPySoundCard’ object has no attribute ‘_stream’” in <bound method SoundPySoundCard.del of <psychopy.sound.SoundPySoundCard object at 0x1131c8c90>> ignored