echonest/echoprint-server — Issue #16: 60 seconds segment length issue
Author: marco1981
Created: 2011-11-24 15:04:24+00:00
State: open

Hi all,

I'm trying to understand the source code of **fp.py** file and I think you are using not consistent formulas to compute segments of 60 seconds in time units.

In the first case, we can retrieve the sixty seconds segment length by multiplying 60 seconds with 43.45 as shown in line 134:

```
cut_code_string_length(code_string)
""" Remove all codes from a codestring that are > 60 seconds in length.
Because we can only match 60 sec, everything else is unnecessary """
sixty_seconds = int(60.0 * 43.45 + first_timestamp)
```

But in the second case (see line 482) we use another computation to get the same parameter (segmentlength) :

```
def split_codes(fp):
""" Split a codestring into a list of codestrings. Each string contains
at most 60 seconds of codes, and codes overlap every 30 seconds. Given a
track id, return track ids of the form trid-0, trid-1, trid-2, etc. """

# Convert seconds into time units
segmentlength = 60 * 1000.0 / 43.45
```

Maybe I am wrong but I think the second formula is not correct. The right formula should be:
```
segmentlength = 60 * 43.45
```

If I am wrong please explain me the meaning of the second formula, otherwise please fix this issue.
Thank you very much.