Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing Custom Filters #145

Open
BlindElephants opened this issue Oct 1, 2020 · 5 comments
Open

Implementing Custom Filters #145

BlindElephants opened this issue Oct 1, 2020 · 5 comments

Comments

@BlindElephants
Copy link

Wondering if there are any hints or documentation about implementing additional filters?

Thanks,

@bigtimebuddy
Copy link
Member

You'll want this: http://pixijs.io/pixi-sound/docs/PIXI.sound.filters.Filter.html

You pass in an AudioNode (or a source and destination if you have a bigger chain). That's it. There are examples in src/filters folder (e.g., MonoFilter)

To get access to the WebAudio Context (in order to create AudioNodes), you'd get that from sound.context.audioContext.

Hope that helps. If you come up with any cool filters, would gladly add them to the project.

@BlindElephants
Copy link
Author

BlindElephants commented Oct 1, 2020

Thank you!

Followup question,

sound is no longer appearing in my resources for each loaded item. And it appears that the loadType and type of each loaded resource has changed. Instead, what is handed back is an <audio> element.

I'm assuming this is because I've loaded the library incorrectly, or perhaps prepped it incorrectly after forking pixi-sound and adding my own Filter class definitions. Any advice on this?

@bigtimebuddy
Copy link
Member

Please provide some more context about the issue you're having or make an example/repo that reproduces. I'm not sure what you're doing. Here's an simple example using Webpack:
https://github.com/bigtimebuddy/pixi-sound-webpack-example/

@andrewstart
Copy link
Contributor

If your project is built so that pixi-sound has its own copy of the @pixi/loaders dependency instead of sharing the one from pixi.js that you are loading with (if you linked in your local fork of pixi-sound, for example), you could see this problem - pixi-sound registers loader middleware on its version of the loader, but the loader you are actually initiating is a separate version that doesn't know about the sound middleware. The resource-loader library that the loader extends will, in the absence of middleware, load .wav, .ogg, and .mp3 files as <audio> elements.

@BlindElephants
Copy link
Author

BlindElephants commented Oct 2, 2020

thank you @andrewstart, that helps greatly.

@bigtimebuddy , just realized you may have been suggestion creating a custom audio filter by creating it as a JS class or Object that can be implemented through the pixi-sound Filters interface. This would not require any extension of the pixi-sound library using TypeScript. Am I understanding correctly?

Thank you both for your advice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants