async function generateFilters() {
console.info(`Crafting custom room correction filters...`);
delay *= 2;
const measurements = await fetch_mREW();
let indexTC = dChannels + 1;
await postNext('Minimum phase version', indexTC, {
"include cal": false,
"append lf tail": false,
"append hf tail": false,
"frequency warping": false,
"replicate data": false
});
await postDelete(indexTC);
await fetch_mREW(indexTC,'PUT', {title: "Dr Toole target curve"});
await new Promise(resolve => setTimeout(resolve, delay * 1.15));
const result1 = await swal.fire({
confirmButtonColor: "#6fa3e7",
text: "Import the speaker targets",
input: 'text',
showCancelButton: true
});
for (let i = 1; i <= dChannels; i++)
{
await postNext('Minimum phase version', i, {
"include cal": false,
"append lf tail": false,
"append hf tail": false,
"frequency warping": false,
"replicate data": false
});
ii = 2* dChannels + i * 2;
await postNext('Arithmetic', [ii, indexTC], {
function: "A / B",
regularisation: "0",
lowerLimit: "0",
upperLimit: "0"});
await postNext('Arithmetic', [ii + 1, ii + 1], {
function: "1 / A",
maxGain: "0",
lowerLimit: "0",
upperLimit: "200",
autoTarget: "0",
excludeNotches: false});
await postNext('Arithmetic', [dChannels + 1 + i, ii + 2], {
function: "Merge B to A",
mergeFrequency: "300",
mergeBlend: true});
await postNext('Minimum phase version', ii + 3, {
"include cal": false,
"append lf tail": false,
"append hf tail": false,
"frequency warping": false,
"replicate data": false
});
await postNext('Arithmetic', [i, ii + 4], {function: "A * B"});
const finTitle = measurements[i].title.replace("o","final");
await fetch_mREW(ii + 5, 'PUT', {title: finTitle});
const filtTitle = measurements[i].title.replace("o","");
await fetch_mREW(ii + 4, 'PUT', {title: filtTitle});
console.log(`Optimal filter generation for speaker ${filtTitle} is completed.`);
await postDelete(ii);
await new Promise(resolve => setTimeout(resolve, delay * 1.15));
await postDelete(ii);
await new Promise(resolve => setTimeout(resolve, delay * 1.15));
await postDelete(ii);
await new Promise(resolve => setTimeout(resolve, delay * 1.15));
await postDelete(ii);
await new Promise(resolve => setTimeout(resolve, delay * 1.15));
}
for (let xxx = 0; xxx < dChannels; xxx++) {
await postDelete(dChannels + 2);
await new Promise(resolve => setTimeout(resolve, delay * 1.15));
}
console.log(`Done!`);
console.info(`************************************************************************************************************************`);
}