<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find_melody(file='440_480_clean.wav', chunksize=512):
 """Cut the sample into chunks and analyze each chunk. Return a list [(Note, chunks)] where chunks is the number of chunks where that note is the most dominant. If two consequent chunks turn out to return the same Note they are grouped together. This is an experimental function. """

    (data, freq, bits) = data_from_file(file)
    res = []
    for d in analyze_chunks(data, freq, bits, chunksize):
        if res != []:
            if res[-1][0] == d:
                val = res[-1][1]
                res[-1] = (d, val + 1)
            else:
                res.append((d, 1))
        else:
            res.append((d, 1))
    return [(x, freq) for (x, freq) in res]