MCPcopy Create free account
hub / github.com/MTG/essentia / tuningSystemFeatures

Function tuningSystemFeatures

src/examples/python/streaming_extractor/highlevel.py:42–64  ·  view source on GitHub ↗
(pool, namespace='')

Source from the content-addressed store, hash-verified

40
41
42def 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
67def sfxPitch(pool, namespace=''):

Callers 2

computeFunction · 0.85
computeHighLevelMethod · 0.85

Calls 4

normalizeFunction · 0.70
KeyMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected