Search code examples
actionscript-3audio

AS3 Standing Wave 3 Library Change Pitch


I am trying to figure out how to change the pitch of a sound in Standing Wave 3 actionscript library. I have imported a sound at 440hz(A) and am trying to change it's pitch to say a (C) note.

Any tips greatly appreciated.


Solution

  • Have you had a look at the filters? Particularly the ResamplingFilter. You use is by creating a new ResamplingFilter with 2 parameters. The first one is the source (IAudioSource) and the second parameter is the factor by which the frequency will be change by.

    This is what it would look like:

    var aNote:IAudioSource = new SoundSource(new ANoteSoundAsset());
    var cNote:IAudioSource = new ResamplingFilter(aNote, 1.189);
    player.play(cNote);
    

    This would raise pitch of the the note from being A4 to approximately a C5 note.

    Useful links: