# Resampling sound in AS3

**URL:** https://forum.kirupa.com/t/resampling-sound-in-as3/319293
**Category:** flash
**Created:** [February 15, 2011, 3:41pm UTC](https://forum.kirupa.com/t/resampling-sound-in-as3/319293 "2011-02-15T15:41:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rumblesushi](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@rumblesushi](https://forum.kirupa.com/u/rumblesushi)
#### Post date: [February 15, 2011, 3:41pm UTC](https://forum.kirupa.com/t/resampling-sound-in-as3/319293/1 "2011-02-15T15:41:54Z")

</div>

Specifically using sound.extract and SampleDataEvent.

Forgive any nubby questions, I don’t have much experience working with sound in a technical sense, OR working with byte arrays/binary data.

I have to resample engine sounds according to current gear and RPM, and I feel a bit clueless on several things.

First, why can’t I access the sound byte array of a Sound directly? Why do I need the SampleDataEvent proxy?

The reason I find this annoying is it’s in set intervals. I might want to do it just once, or do it far more frequently.

For example, let’s say I need to extract and speed up or slow down a sound just once. I should be able to extract the sound bytes, write them to a new Sound object, then play it.

But no, it seems you HAVE to have a SampleDataEvent listening, resampling the sound however often it does, even if nothing is changing. It’s a waste.

Also another thing is the interval is not very fast, so when doing a constant resample of the pitch of an engine sound to simulate revs, you’re going to get a fairly sort of “choppy” sound effect, where it keeps skipping up in pitch, instead of a smooth transition.

One more thing, how do you loop the new resampled sound?

Any insight to these 3 questions would be appreciated.

Cheers,  
RumbleSushi
