TR-i Posted September 7, 2021 Share Posted September 7, 2021 Does anyone have some example code on how to implement PIXI sound filters? Tried parsing the code on the example page but it's pretty obtuse. Quote Link to comment Share on other sites More sharing options...
b10b Posted September 7, 2021 Share Posted September 7, 2021 Is your question about how to create a new Filter Class, or how to bind an existing Filter Instance to an existing SoundInstance? Are you wanting to run filters on mobile devices during intensive gameplay? Quote Link to comment Share on other sites More sharing options...
TR-i Posted September 8, 2021 Author Share Posted September 8, 2021 Just want to experiment with the built-in filters. Quote Link to comment Share on other sites More sharing options...
b10b Posted September 8, 2021 Share Posted September 8, 2021 I understand the goal but I do not understand the problem. Have you created a SoundInstance? Have you created a Filter? Are you aware of the "filters" (array) member of the SoundInstance? If so push the created Filter instance into that array (or create the array). Done. Think of it like adding a Filter to a DisplayObject. Quote Link to comment Share on other sites More sharing options...
TR-i Posted September 8, 2021 Author Share Posted September 8, 2021 All I know is, this throws an error: const sound = new PIXI.sound.Sound.from('data:audio/mp3;base64,' + audiodata); sound.filters = [new filters.TelephoneFilter()]; As does this: const sound = new PIXI.sound.Sound.from('data:audio/mp3;base64,' + audiodata); sound.sound.filters = [new filters.TelephoneFilter()]; Quote Link to comment Share on other sites More sharing options...
b10b Posted September 8, 2021 Share Posted September 8, 2021 (edited) Option 1. What's the error? (F12, console message). Try the full package reference ... const sound = new PIXI.sound.Sound.from('data:audio/mp3;base64,' + audiodata); sound.filters = [new PIXI.sound.filters.TelephoneFilter()]; Edited September 9, 2021 by b10b Too much haste Quote Link to comment Share on other sites More sharing options...
TR-i Posted September 9, 2021 Author Share Posted September 9, 2021 (edited) sound.filters = [new PIXI.sound.filter.TelephoneFilter()]; Throws an error. sound.filters = [new PIXI.sound.filters.TelephoneFilter()]; Does not. However, there seems to be no change in the sound after adding the filter. Tried Distortion and Reverb filters- no difference. Edited September 9, 2021 by TR-i Quote Link to comment Share on other sites More sharing options...
b10b Posted September 9, 2021 Share Posted September 9, 2021 Sorry that was my bad on the typo, too much haste on my part! Yes, package name is PIXI.sound.filters. I have corrected in original post to avoid errors propagating to others. Sound.from returns Sound. Sound has member "filters" which is a passthru to this.media.filters. I can see nothing specifically wrong with that code, so some debugging is needed - check whether WebAudio is being used perhaps? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.