-1
$\begingroup$

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#.

$\endgroup$

closed as off topic by Dilip Sarwate, Jason R, endolith, jonsca, sansuiso Mar 14 '13 at 12:13

Questions on Signal Processing Stack Exchange are expected to relate to signal processing within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ This is off-topic for dsp.SE. I vote to close. $\endgroup$ – Dilip Sarwate Mar 7 '13 at 12:17
  • $\begingroup$ Recommend a better place then. $\endgroup$ – Zurechtweiser Mar 7 '13 at 12:29
  • 1
    $\begingroup$ This is a general algorithm question, Stack Overflow might be a better place. But I warn you that your problem is ill defined in its current form - you can reduce the number of entries by increasing either of the two variables. This will lead to different solutions, and you will have to find another criteria to weigh them. It looks like you problem would be better defined if you had an extra constraint, for example, "total length of the resulting sequence is N seconds" or "maximize the % of original material that is preserved". $\endgroup$ – pichenettes Mar 7 '13 at 12:52
  • $\begingroup$ I hereby add: Minimallänge must be greater than 10 seconds. $\endgroup$ – Zurechtweiser Mar 7 '13 at 12:58
  • 1
    $\begingroup$ If the conversations are between different pairs of speakers, use speaker diarization techniques (unsupervised speaker recognition). Otherwise, maybe you could just detect the 2 largest silences/gaps and assume that these are the boundaries between the conversations. $\endgroup$ – pichenettes Mar 7 '13 at 15:54
1
$\begingroup$
  1. CPU is cheap these days, try them all. Unless the data set is massively large 2-dim binary search should do it
  2. The problem is ill posed: for every given number of entries there will be many possible combination of Minimallänge and Pausendauer, so you need on extra constrain or assumption to get a unique answer

A good way to visualize this would be the following: create a graph with Pausendauer as X-axis and Minimallänge as Y-axis. Then calculate the number of entries for each combo and then you can draw "lines of equal number of entries" into the graph. That will show you the general shape of the solution space. A 3-D graph obviously would do the same

$\endgroup$
  • $\begingroup$ I edited my question. $\endgroup$ – Zurechtweiser Mar 7 '13 at 14:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.