Convert the (frequencies, amplitude) list to a (Note, amplitude) list.
(freqTable, maxNote=100)
| 113 | |
| 114 | |
| 115 | def find_notes(freqTable, maxNote=100): |
| 116 | """Convert the (frequencies, amplitude) list to a (Note, amplitude) list.""" |
| 117 | res = [0] * 129 |
| 118 | n = Note() |
| 119 | for (freq, ampl) in freqTable: |
| 120 | if freq > 0 and ampl > 0: |
| 121 | f = _find_log_index(freq) |
| 122 | if f < maxNote: |
| 123 | res[f] += ampl |
| 124 | else: |
| 125 | res[128] += ampl |
| 126 | return [(Note().from_int(x) if x < 128 else None, n) for (x, n) in enumerate(res)] |
| 127 | |
| 128 | |
| 129 | def data_from_file(file): |
no test coverage detected