Hi, I need a way to determine the sound level of mp3 files. These files are internet radio recordings (12 hours each), but some of them only contain low level noise. I’d like to find those “bad” recordings in order to delete them.
Found this Objective-C code on stackoverflow but I can’t find a way to use functions like  MIN,  sqrtf, log10f in AppleScriptObjC. Is this possible at all? If not, does anyone have vanilla AppleScript equivalents?
Also, what’s the equivalnt of HUGE_VALF in AppleScriptObjC?
Here’s the Objective-C part where I’m stuck in translating:
    float maxDecible = 0;
    float minDecible = HUGE_VALF;
    NSMutableArray * sd = [NSMutableArray new]; //used for standard deviation
    for (int n = 0; n < MIN(buffer.format.channelCount, 2); n++){ //go through channels
        NSMutableArray * decibles = [NSMutableArray new]; //holds actual decible values
        
        //go through pulling the decibles
        for (int i = 0; i < deciblesCount; i++){
            
            int offset = frameIncrement * i; //grab offset
            //equation from stack, no idea the maths
            float sqr = sqrtf(buffer.floatChannelData[n][offset * buffer.stride]/(float)buffer.frameLength);
            float decible = 20 * log10f(sqr);
            
            decible += 160; //make positive
            decible = (isnan(decible) || decible < 0) ? 0 : decible; //if it's not a number or silent, make it zero
            if (decible > 0){ //if it has volume
                [sd addObject:@(decible)];
            }
            [decibles addObject:@(decible)];//add to decibles array
            
            maxDecible = MAX(maxDecible, decible); //grab biggest
            minDecible = MIN(minDecible, decible); //grab smallest
        }
        
        [channels addObject:decibles]; //add to channels array
    }