# Error with sound when starting script

**URL:** <https://discourse.psychopy.org/t/error-with-sound-when-starting-script/39858>\
**Category:** Builder\
**Created:** [April 30, 2024, 10:31am UTC](https://discourse.psychopy.org/t/error-with-sound-when-starting-script/39858 "2024-04-30T10:31:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Maitland](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/david_maitland/32/40280_2.png) [@David\_Maitland](https://discourse.psychopy.org/u/David_Maitland)\
**Post date:** [April 30, 2024, 10:31am UTC](https://discourse.psychopy.org/t/error-with-sound-when-starting-script/39858/1 "2024-04-30T10:31:29Z")

</div>

Hi,

I have a script that displays a sound half way through, this works on one laptop, however, when I change it to another laptop the script immediately breaks with the following errors;

File “C:\Users\maitland-local\Desktop\DASH\DASH Task\_lastrun.py”, line 1315, in   
run(  
File “C:\Users\maitland-local\Desktop\DASH\DASH Task\_lastrun.py”, line 426, in run  
sound\_1 = sound.Sound(  
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend\_ptb.py”, line 334, in **init**  
self.setSound(value, secs=self.secs, octave=self.octave,  
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend\_ptb.py”, line 442, in setSound  
\_SoundBase.setSound(self, value, secs, octave, hamming, log)  
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\_base.py”, line 209, in setSound  
self.\_setSndFromFile(p)  
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend\_ptb.py”, line 448, in \_setSndFromFile  
self.sndFile = f = sf.SoundFile(filename)  
File “C:\Users\maitland-local\AppData\Roaming\Python\Python38\site-packages\soundfile.py”, line 658, in **init**  
self.\_file = self.\_open(file, mode\_int, closefd)  
File “C:\Users\maitland-local\AppData\Roaming\Python\Python38\site-packages\soundfile.py”, line 1216, in \_open  
raise LibsndfileError(err, prefix="Error opening {0!r}: ".format(self.name))  
soundfile.LibsndfileError: Error opening ‘bleep-41488.mp3’: Error : bad data offset.  
################# Experiment ended with exit code 1 [pid:5808] #################

I have tried changing the audio library but not no effect.

Thank you for any help.

---

<div class="post-metadata">

**Author:** ![David\_Maitland](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/david_maitland/32/40280_2.png) [@David\_Maitland](https://discourse.psychopy.org/u/David_Maitland)\
**Post date:** [April 30, 2024, 1:42pm UTC](https://discourse.psychopy.org/t/error-with-sound-when-starting-script/39858/2 "2024-04-30T13:42:35Z")

</div>

This issue was is that I needed to change the sound file to 16bit, 44,1000 Hz. This I did via audacity. Follow link below to where I found the solution.

> [@Errors with open .wav file](https://discourse.psychopy.org/t/errors-with-open-wav-file/19766):
>
> Hi the community, Operating System: Windows-10-10.0.18362-SP0 version: psychopy3 python 3.6 I am trying to create sound components with audio files. The .wav files are under the same parent folder as the project file. In the condition file, the relative path to each .wav file is given and the sound component path is set up with the column name. What did you try to make it work?: I have tried change the file name to .aiff and I am sure the path should have no errors. I also installed FFmpeg…
