Audio silence detection issues

    Jan 06 2016 | 2:47 pm
    In my work as a audio designer for games I often need to handle a large amount of audio files. Therefor I´ve been trying to create a small and simple utility to chop up long audio files into smaller ones by detecting the silent parts of a buffer~ object and storing the segments into new buffer~ objects. The method I am using now works well when handling audio files with no noise floor, where the signal is 0. between the segments I want.
    But when I bounce an audio file with dithering or some plugin that itroduces a noise floor I am running into issues. This is because my method of defining my segments is using a "change" object and looking at non-zero to 0 transitions and vice versa.
    I´ve been trying to find a workaround by adding the option to subtract from the signal and adding minimum requirements in samples for segments to be considered silence but this introduces stack overflow issues and all kinds of crazy results.
    I might be approaching the issue in the wrong way, and I am not very skilled in the delicate art of max programming so I turn to you guys.
    Max Patcher
    In Max, select New From Clipboard.
    Here is my patch I am currently using.