MCPcopy Create free account
hub / github.com/bspaans/python-mingus / analyze_chunks

Function analyze_chunks

mingus/extra/fft.py:160–170  ·  view source on GitHub ↗

Cut the one channel data in chunks and analyzes them separately. Making the chunksize a power of two works fastest.

(data, freq, bits, chunksize=512)

Source from the content-addressed store, hash-verified

158
159
160def analyze_chunks(data, freq, bits, chunksize=512):
161 """Cut the one channel data in chunks and analyzes them separately.
162
163 Making the chunksize a power of two works fastest.
164 """
165 res = []
166 while data != []:
167 f = find_frequencies(data[:chunksize], freq, bits)
168 res.append(sorted(find_notes(f), key=operator.itemgetter(1))[-1][0])
169 data = data[chunksize:]
170 return res
171
172
173def find_melody(file="440_480_clean.wav", chunksize=512):

Callers 1

find_melodyFunction · 0.85

Calls 2

find_frequenciesFunction · 0.85
find_notesFunction · 0.85

Tested by

no test coverage detected