(pool, namespace='')
| 40 | |
| 41 | |
| 42 | def tuningSystemFeatures(pool, namespace=''): |
| 43 | # expects tonal descriptors and tuning features to be in pool |
| 44 | tonalspace = 'tonal.' |
| 45 | if namespace: tonalspace = namespace + '.tonal.' |
| 46 | |
| 47 | # 1-diatonic strength |
| 48 | hpcp_highres = normalize(numpy.mean(pool[tonalspace + 'hpcp_highres'], 0)) |
| 49 | key,scale,strength,_ = standard.Key(profileType='diatonic')(hpcp_highres) |
| 50 | pool.set(tonalspace + 'tuning_diatonic_strength', strength) |
| 51 | |
| 52 | # 2- high resolution features |
| 53 | eqTempDeviation, ntEnergy,_ = standard.HighResolutionFeatures()(hpcp_highres) |
| 54 | pool.set(tonalspace+'tuning_equal_tempered_deviation', eqTempDeviation) |
| 55 | pool.set(tonalspace+'tuning_nontempered_energy_ratio', ntEnergy) |
| 56 | |
| 57 | # 3- THPCP |
| 58 | hpcp = normalize(numpy.mean(pool[tonalspace + 'hpcp'], 0)) |
| 59 | hpcp_copy = hpcp[:] |
| 60 | idx = numpy.argmax(hpcp) |
| 61 | offset = len(hpcp)-idx |
| 62 | hpcp[:offset] = hpcp_copy[idx:offset+idx] |
| 63 | hpcp[offset:offset+idx] = hpcp_copy[0:idx] |
| 64 | pool.set(tonalspace+'thpcp', essentia.array(hpcp)) |
| 65 | |
| 66 | |
| 67 | def sfxPitch(pool, namespace=''): |
no test coverage detected