Hi all,
I’m having an issue where audio files which play fine on my computer (Mac M3 2024) but are completely distorted on an older mac (MacBook Air 2015). The task iteratively uses different audio clips, and when it plays the clips it plays entirely distorted-- not just pitch-different-- the audio is supposed to be sentences, and it the distorted audio sounds like gravel/crackling.
What works:
- Multiple other tasks, including playing movies and playing ‘beep’ sounds seem to be not distorted, and playback fine.
- The images / visuals of the task are fine
- The ‘response’ sounds are fine-- which are short audio ‘beep’ clips which stay the same
- The audios themselves play fine when played from the computer, so the files themselves aren’t corrupted
What I’ve tried:
- Changing the audio backend to PTB, Pyo, Pygame
- Changing the latency level
Note: another thing we’ve noticed is that the audio distortion tends to lift for a fraction of a second right after the ‘Esc’ key is pressed, before the task fully quits.
Code for the section:
# Set initial visibility
cross.opacity = 1 # 'cross' starts visible
allow_keys = False # Disallow keypresses at the start of the routine
audio_ended_response_key.keys = [] # Clear any previously stored keypresses
# Start audio after image
listening_t = globalClock.getTime()
audio_start = listening_t + 1
# Make scanner speaker as device
deviceManager.addDevice(
deviceName='scanner',
deviceClass='psychopy.hardware.speaker.SpeakerDevice',
index=scanner_index #this is set before and is correct
)
##initialize correct-response sound
audio = sound.Sound(
secs=1, stereo=True, hamming=True,
speaker='scanner', name='audio'
)
audio.setSound(Audio, hamming=True)
audio.setVolume(scanner_volume, log=False)
audio.seek(0)
The “Audio” is set by the ‘trials’ field which defines the name/location of the files, which seems to be working fine, since there are audios playing, just distorted.
Audio File Info:
- The audio files are 48.0 kHz sampling rate
- They are ~4s long
- They are .wav files
- They are ~400 KB
One file
Complete name : C1_allumettes.wav
Format : Wave
Format settings : PcmWaveformat
File size : 426 KiB
Duration : 4 s 544 ms
Overall bit rate mode : Constant
Overall bit rate : 768 kb/s
Track name : C1_allumettes
Track name/Position : 5
ITRK : 5
Audio
Format : PCM
Format settings : Little / Signed
Codec ID : 1
Duration : 4 s 544 ms
Bit rate mode : Constant
Bit rate : 768 kb/s
Channel(s) : 1 channel
Sampling rate : 48.0 kHz
Bit depth : 16 bits
Stream size : 426 KiB (100%) / 426 KiB (100%)
Any suggestions/ideas would be greatly appreciated!!
Thanks,
Kaley