# Get rid of sound distortion

**URL:** <https://discourse.processing.org/t/get-rid-of-sound-distortion/20696>\
**Category:** Libraries\
**Created:** [May 10, 2020, 1:23am UTC](https://discourse.processing.org/t/get-rid-of-sound-distortion/20696 "2020-05-10T01:23:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhr](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mhr](https://discourse.processing.org/u/mhr)\
**Post date:** [May 10, 2020, 1:23am UTC](https://discourse.processing.org/t/get-rid-of-sound-distortion/20696/1 "2020-05-10T01:23:46Z")

</div>

Hi,  
I’m trying to play tiny parts of the same sound file through MouseDragged function on p5.  
Everything works just fine when the variables are defined in the begining, but I want to be able to change them using the keyboard. I can get the sketch to work but the problem is that the sound gets gradually distorted.  
How can I solve the problem?  
Thanks

---

<div class="post-metadata">

**Author:** ![mhr](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mhr](https://discourse.processing.org/u/mhr)\
**Post date:** [May 10, 2020, 1:31am UTC](https://discourse.processing.org/t/get-rid-of-sound-distortion/20696/2 "2020-05-10T01:31:53Z")

</div>

Just found out a way.

---

<div class="post-metadata">

**Author:** ![Sven](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sven/32/8293_2.png) [@Sven](https://discourse.processing.org/u/Sven)\
**Post date:** [May 11, 2020, 2:41pm UTC](https://discourse.processing.org/t/get-rid-of-sound-distortion/20696/3 "2020-05-11T14:41:02Z")

</div>

Hey, good to hear you figured it out. What solved it?
