# SoundFile the wrong sampleRate

**URL:** https://discourse.processing.org/t/soundfile-the-wrong-samplerate/26660
**Category:** Libraries
**Created:** [December 31, 2020, 9:50pm UTC](https://discourse.processing.org/t/soundfile-the-wrong-samplerate/26660 "2020-12-31T21:50:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![RFullum](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rfullum/32/10454_2.png) [@RFullum](https://discourse.processing.org/u/RFullum)
#### Post date: [December 31, 2020, 9:50pm UTC](https://discourse.processing.org/t/soundfile-the-wrong-samplerate/26660/1 "2020-12-31T21:50:33Z")

</div>

Does Processing only load audio files at 44.1KHz? I have an mp3 at 48KHz loaded to my sketch. I set the Sound object to 48KHz. My sound card is at 48KHz. But the file is loading at 44.1 and the slow playback confirms.

```auto
import processing.sound.*;

Sound sound;
SoundFile file;

void setup()
{
  sound = new Sound(this);
  sound.sampleRate(48000);
  
  file = new SoundFile(this, "Feel My Body feat. Xav A.mp3");
  file.play();
  println(file.sampleRate());
}

void draw()
{
}

```

Printed to the console:

```auto
44100

```

---

<div class="post-metadata">

### Author: ![OPi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/opi/32/18076_2.png) [@OPi](https://discourse.processing.org/u/OPi)
#### Post date: [March 26, 2023, 5:38pm UTC](https://discourse.processing.org/t/soundfile-the-wrong-samplerate/26660/3 "2023-03-26T17:38:53Z")

</div>

I guess that you set sound.sampleRate(48000) because you have other sounds at 48 KHz.  
A solution is to open your 44.1 KHz file with [Audacity](https://www.audacityteam.org/) (or other similar programs), to change the “Project Rate (Hz)” to 48000 Hz in the bottom left of the window, and finally to save it by exporting in your wanted format.
