Hi all, I have implemented a code with the help of @nathan (whom I can’t thank enough helping me in this project) and now trying to implement this on a real-world app on different platforms (iOS, Android, Mac, Windows, Linux-maybe). With no knowledge on app development, would really appreciate if someone could guide me achieve this personal project.
The idea of the code is simple: It boosts the input signal on a noisy environment by using mic sensitivity. You listen to the noise (environmental noise) from the mic and set a limit (threshold) where beyond that limit level, make the input TRACK volume louder at the chosen speaker volume.
Server.default.options.numWireBufs = 1024;
s.boot;
//To specify your I/O
ServerOptions.devices;
(
s.options.inDevice = "MacBook Pro Microphone";
s.options.outDevice = "External Headphones";
s.reboot;
)
~music= Buffer.read(s,"LOAD A AUDIO FILE"); //Stereo Track
(
SynthDef(\DynamicBoostEQ, {
arg loop=1, da=2;
var mic, sig, loFreq = 20, hiFreq = 20000, numBands = 32 , threshold = -20, bandFreqs, dB, maxBoost= 5;//Threshold currently set to -20
bandFreqs = Array.geom(numBands, loFreq, (hiFreq/loFreq)**(1/numBands));
mic = SoundIn.ar(0, 1); //Input Mic Signal (Mono)
mic = BPF.ar(mic, bandFreqs, 0.25);
dB = Amplitude.ar(mic, 0.1, 0.5).ampdb.poll(label: "Mic Sensitivity"); //Convert to dB scale
mic = min(max(dB - threshold, 0), maxBoost);
sig = PlayBuf.ar(2, \buf.kr(0), BufRateScale.ir(\buf.kr(0)), loop: loop, doneAction: da); //Input audio signal(Stereo)
numBands.do{ arg i;
sig = BPeakEQ.ar(sig, bandFreqs[i], 0.25, mic[i]);
};
sig = sig*1!2;
sig = Limiter.ar(sig, 1); //A limiter before - Just to be safe!!!
Out.ar(\out.kr(0), sig);
}).add;
)
Synth(\DynamicBoostEQ, [\buf, ~music]);
As far as I’m aware, the app only requires access to mic and can be running in the background. The 2 variables that can be modified by the user are the threshold and maxBoost.
Could someone please help me in this regard?