# Samples clipping after playing back a few seconds

**URL:** <https://qa.fmod.com/t/samples-clipping-after-playing-back-a-few-seconds/17485>\
**Category:** FMOD Engine\
**Created:** [July 27, 2021, 4:56pm UTC](https://qa.fmod.com/t/samples-clipping-after-playing-back-a-few-seconds/17485 "2021-07-27T16:56:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![snibbe](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/snibbe/32/2463_2.png) [@snibbe](https://qa.fmod.com/u/snibbe)\
**Post date:** [July 27, 2021, 4:56pm UTC](https://qa.fmod.com/t/samples-clipping-after-playing-back-a-few-seconds/17485/1 "2021-07-27T16:56:10Z")

</div>

I’m playing back sounds with a simple pitch-shifted sample playback, however after a few seconds of adding more samples, the audio starts to “clip.” Any advice on how to avoid this? These are 2 second WAV samples. The code worked in much earlier versions of FMOD. I’m on iOS.

```auto
    ERRCHECK(fmodsys_->playSound(sound, 0, true, &channel)); 
    fmodresult_ = channel->setVolume(kVolume);
    ERRCHECK(channel->getFrequency(&channelFrequency));
    ERRCHECK(channel->setFrequency(powf(2.0f,pitchShift/12.0f) * channelFrequency));
    ERRCHECK(channel->setPaused(false)); // This is where the sound really starts

```

Here’s a video example:

[https://streamable.com/q3w4pz](https://streamable.com/q3w4pz)

And here’s how I load the sounds:

```auto
    FMOD::System_Create(&fmodsys_);
    fmodresult_ = fmodsys_->init(32, FMOD_INIT_NORMAL, NULL);
    ERRCHECK(fmodresult_);
    SetFMODSystem(fmodsys_);
    fmodsys_ = GetFMODSystem();
    fmodresult_ = fmodsys_->createSound(buffer, FMOD_CREATESAMPLE, NULL, &sound);
    ERRCHECK(fmodresult_);

```

Thanks!

---

<div class="post-metadata">

**Author:** ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)\
**Post date:** [July 27, 2021, 7:12pm UTC](https://qa.fmod.com/t/samples-clipping-after-playing-back-a-few-seconds/17485/2 "2021-07-27T19:12:45Z")

</div>

It sound as if there was some stealing applied: the last sound steals the previous ones. This could be in line with the 32 max channel. Is there a release at some point?

---

<div class="post-metadata">

**Author:** ![snibbe](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/snibbe/32/2463_2.png) [@snibbe](https://qa.fmod.com/u/snibbe)\
**Post date:** [July 27, 2021, 7:33pm UTC](https://qa.fmod.com/t/samples-clipping-after-playing-back-a-few-seconds/17485/3 "2021-07-27T19:33:20Z")

</div>

I did try upping the max channels, but either get the same problem, or going completely silent.

---

<div class="post-metadata">

**Author:** ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)\
**Post date:** [July 27, 2021, 7:46pm UTC](https://qa.fmod.com/t/samples-clipping-after-playing-back-a-few-seconds/17485/4 "2021-07-27T19:46:43Z")

</div>

Do you get the same problem after the same amount of note played, or does it have an impact on that point?

---

<div class="post-metadata">

**Author:** ![snibbe](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/snibbe/32/2463_2.png) [@snibbe](https://qa.fmod.com/u/snibbe)\
**Post date:** [July 27, 2021, 8:43pm UTC](https://qa.fmod.com/t/samples-clipping-after-playing-back-a-few-seconds/17485/5 "2021-07-27T20:43:13Z")

</div>

You can see in the video - basically the notes play fine for a few seconds and then start clipping out. Very likely we’re exhausting available channels. The old FMOD used to somehow prioritize newer samples, but somehow the way it works now, we’re getting these sound artifacts. Open to any solution!

---

<div class="post-metadata">

**Author:** ![snibbe](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/snibbe/32/2463_2.png) [@snibbe](https://qa.fmod.com/u/snibbe)\
**Post date:** [July 28, 2021, 2:07am UTC](https://qa.fmod.com/t/samples-clipping-after-playing-back-a-few-seconds/17485/6 "2021-07-28T02:07:24Z")

</div>

I have solved this. It looks like the update() call wasn’t getting called in our code on a per-frame basis. Once that was restored, everything works fine!

`fmodsys_->update();`
