Skip to content

How to change the frequency using the ResamplingFilter? #20

@mx2012

Description

@mx2012

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions