# Import audio samples

**URL:** <https://discourse.psychopy.org/t/import-audio-samples/37755>\
**Category:** Builder\
**Created:** [November 29, 2023, 4:19pm UTC](https://discourse.psychopy.org/t/import-audio-samples/37755 "2023-11-29T16:19:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![altario\_fancino](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/altario_fancino/32/40275_2.png) [@altario\_fancino](https://discourse.psychopy.org/u/altario_fancino)\
**Post date:** [November 29, 2023, 4:19pm UTC](https://discourse.psychopy.org/t/import-audio-samples/37755/1 "2023-11-29T16:19:46Z")

</div>

**OS** (Win10)  
**PsychoPy version** (v2023.2.3)

Hello I am a Master’s student currently developing my thesis on Cognitive/Musical Neuroscience. In my experiment I need to present different auditive stimuli to the participants and then perform some self-reports about emotional assessment. I have tried to import the audio files in different formats such as wav mp3 and aiff and I still get an error message about some combination of audio parameters.  
Part of the error message appears as:  
PsychPortAudio:Open: Usage:

pahandle = PsychPortAudio(‘Open’ [, deviceid][, mode][, reqlatencyclass][, freq][, channels][, buffersize][, suggestedLatency][, selectchannels][, specialFlags=0]);  
PTB-ERROR: Failed to open audio device -1. PortAudio reports this error: Invalid device  
PTB-ERROR: Desired audio parameters likely unsupported by audio device.  
PTB-ERROR: This could be, e.g., due to an unsupported combination of audio sample rate, audio channel count/allocation, or audio sample format.  
Error in function Open: Usage error  
Failed to open PortAudio audio device due to unsupported combination of audio parameters.

Anyone as any solutions? (Please not that I’m a coding newbie and I am currently using the non coding part of the PsychoPy)

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [November 30, 2023, 1:44pm UTC](https://discourse.psychopy.org/t/import-audio-samples/37755/2 "2023-11-30T13:44:48Z")

</div>

Hello,

Your audio files may have been recorded at a sampling rate that is not supported by the device you are addressing.

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![mayling](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/mayling/32/31777_2.png) [@mayling](https://discourse.psychopy.org/u/mayling)\
**Post date:** [November 30, 2023, 2:58pm UTC](https://discourse.psychopy.org/t/import-audio-samples/37755/3 "2023-11-30T14:58:14Z")

</div>

Try the mp3 format. It should work. I edited all my audio files using the Audition program and it runs perfectly online.

---

<div class="post-metadata">

**Author:** ![altario\_fancino](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/altario_fancino/32/40275_2.png) [@altario\_fancino](https://discourse.psychopy.org/u/altario_fancino)\
**Post date:** [December 4, 2023, 6:05pm UTC](https://discourse.psychopy.org/t/import-audio-samples/37755/4 "2023-12-04T18:05:48Z")

</div>

Hi! Thanks for your answer. How can I see/change the sampling rate? I can listen to the audio files outside of PsychoPy.

---

<div class="post-metadata">

**Author:** ![altario\_fancino](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/altario_fancino/32/40275_2.png) [@altario\_fancino](https://discourse.psychopy.org/u/altario_fancino)\
**Post date:** [December 4, 2023, 6:07pm UTC](https://discourse.psychopy.org/t/import-audio-samples/37755/5 "2023-12-04T18:07:13Z")

</div>

I tried the mp3 format already. It says the file is in an unknown format:

RuntimeError: Error opening ‘C:/Users/Guilherme Borges/Downloads/sad-emotional-and-dramatic-piano-136898.mp3’: File contains data in an unknown format.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [December 4, 2023, 7:28pm UTC](https://discourse.psychopy.org/t/import-audio-samples/37755/6 "2023-12-04T19:28:18Z")

</div>

Audacity is free software you can use to edit sound files.
