maxl0rd/standingwave3 — Issue #20: How to change the frequency using the ResamplingFilter?
Author: mx2012
Created: 2012-01-20 08:13:53+00:00
State: open

I'm trying to change the frequency of a Wav file,but the ResamplingFilter doesn't work correctly.
I made a simple case for test.I used the StandardizeFilter at first and then I used the ResamplingFilter.
I tried and it worked at first,but it stopped soon.

Here's something about the error:

Error: Fill called beyond the bounds of an unresizable CacheFilter
at com.noteflight.standingwave3.filters::CacheFilter/fill()
at com.noteflight.standingwave3.filters::ResamplingFilter/getSampleRange()
at com.noteflight.standingwave3.filters::ResamplingFilter/getSample()
at com.noteflight.standingwave3.output::AudioSampleHandler/handleSampleData()
at com.noteflight.standingwave3.output::AudioPlayer/handleSampleData()

and this is my code:

import com.noteflight.standingwave3.formats.WaveFile;
import flash.events.Event;
import flash.net.FileFilter;
import flash.net.FileReference;
import com.noteflight.standingwave3.output.AudioPlayer;
import com.noteflight.standingwave3.filters.StandardizeFilter;
import com.noteflight.standingwave3.filters.ResamplingFilter;

var file:FileReference;
var player:AudioPlayer;
function init() {
file=new FileReference();
file.addEventListener(Event.COMPLETE,complete);
file.addEventListener(Event.SELECT,select);
file.browse();
}
function select(e:Event):void {
file.load();
}
function complete(e:Event):void {
player=new AudioPlayer();
var fil:StandardizeFilter = new StandardizeFilter(WaveFile.createSample(file.data));
var rfil:ResamplingFilter= new ResamplingFilter(fil,1.01);
player.play(rfil);
}
init();