Guide To Adding Audio For Your Instagram & Facebook Filters
Disclaimer: The method below has been working well for me on my Samsung S8 and Iphone6. Although not many people used my filter, I haven’t seen any problem of audio for my filters so far (I may very well be wrong though because of small sample size). This includes filters I have created since last year May. So if the method doesn’t work for you, you should report it as a bug on Spark AR Hub to let the Spark AR Team knows.
It seems like there have been quite a bit of question on audio not working properly in the Spark AR Facebook Community recently. So, I wrote this article hoping that I can clear some of the doubt for some of you!
Adding audio effect is probably one of the easier ways to level up your effect and provide a much better experience to your followers on Instagram. However, as of 10th April 2020, there is still some audio bug within Spark AR that always confused creators a little bit. But worry not, if you follow the steps below, your audio effect will probably work fine as it should be! (At least the effects I made with audio are all fine still)
Step 1: .m4a, mono, 44.1 kHz
The first thing you need to know about using audio in Spark AR is that you need it to be the correct file type and settings for Spark AR to accept it.
File format must be .m4a (You can find online converter here)
Audio must be Mono NOT stereo
Sampling rate must be 44100 Hz (or 44.1 kHz)
Step 2: Use Audio Playback Controller In Spark AR
There used to be 2 methods to play audio in Spark AR: Audio Playback Controller method and Single Clip Controller method. However, only the Audio Playback Controller method works for now. If you have been using the single clip controller method, you would probably need to update your project file to using Audio Playback Controller. To use this method, you would need to add an Audio Playback Controller after importing your audio file.
Next, add your audio file as the audio for the Audio Playback Controller you created.
Create a speaker and add the Audio Playback Controller as the Audio for the speaker.
Finally, you create patches for “Play”, “Loop” (Not needed if you don’t need the audio to loop after play) and “Reset” in the patch editor.
To play the sound correctly each time you want it to play, you need to turn the Boolean value of “Play”, “Loop” to True and trigger the Pulse of “Reset” all at the same time. Taking recording video as the trigger point to play the audio as an example, you can connect the patches like the screenshot below.
In summary, you need to ensure that you reset the audio every time play it if not the audio will only be able to play for 1 time. If you do not need your audio to loop after it played, you can ignore the loop patch. If you need the audio to start playing when the filter launch and keep on looping as background music continuously, all you need to do are to check “Play” and “Loop” in the inspector without the need to connect it in patch editor.
Finally, if you need some logic to only play 1 audio out of say 3 audios, you can create 3 different speakers with 3 different audio playback controllers and do the following setup in the patch editor.
See the filters I made on GOWAAA Instagram!