For background information, see "Some background" further down.
I have a list that looks like this:
Start-Time-In-Seconds;End-Time-In-Seconds 1;2 4;6 12;15 ...
This works together with a wave file by acting as a cutlist. So the desired parts are 1->2, 4->6, 12->15, ...
If the distance between End-Time-In-Seconds of the previous element and Start-Time-In-Seconds of the current element is below a threshold of seconds(I call it Pausendauer) I merge those two, ie if the threshold is 3 seconds then the list will be
Start-Time-In-Seconds;End-Time-In-Seconds 1;6 12;15 ...
If the distance between Start-Time-In-Seconds and End-Time-In-Seconds is below a threshold of seconds(I call it Minimallänge) I discard this sample, ie if the threshold is 4 seconds then the list will be
Start-Time-In-Seconds;End-Time-In-Seconds 1;6 ...
What could an algorithm look like that iterates (intelligently) through all combinations of Minimallänge and Pausendauer to aim at a certain number of entries? Example:
The number of entries should be 3. Given the number 3 the algorithm should iterate (intelligently) through all combinations of Minimallänge and Pausendauer to output something like this:
Start-Time-In-Seconds;End-Time-In-Seconds 1;12 18;20 50;100
And that should be all. You notice I did not add "..." to it as the final list is to only consist of three entries.
Some background: The wave file contains several interviews being recorded continuously with pauses in between. A VAD gave me areas where it presumes voice to be. As I know the number of total conversations(f.i. 3, usually more which is why this makes sense) my goal is to determine them automatically. The cutlist is the raw output of my VAD which I want to turn into a usable cutlist for ffmpeg.
PS: If you can, share an algorithm in c#.