def fbFeatureExtraction(): exampleFB = converter.parse('ismir2011_fb_example1b.xml') fe1 = features.jSymbolic.PitchClassDistributionFeature(exampleFB) print (fe1.extract().vector) # [0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.6666666666666666, 0.0, 0.0, 1.0, 0.0, 0.0] n1 = exampleFB.parts[0][1][5] n1.expressions.append(expressions.Turn()) x = expressions.realizeOrnaments(n1) n2 = exampleFB.parts[0][2][2] n2.expressions.append(expressions.Mordent()) y = expressions.realizeOrnaments(n2) exampleFB.parts[0][1].elements = [exampleFB.parts[0][1][4]] exampleFB.parts[0][1].append(x) exampleFB.parts[0][2].elements = [exampleFB.parts[0][2][0], exampleFB.parts[0][2][1]] exampleFB.parts[0][2].append(y) fb1 = figuredBass.realizer.figuredBassFromStream(exampleFB.parts[1]) #realization = fb1.realize() sol1 = fb1.generateRandomRealization() exampleFBOut = stream.Score() exampleFBOut.insert(0, exampleFB.parts[0]) exampleFBOut.insert(0, sol1.parts[0]) exampleFBOut.insert(0, sol1.parts[1]) fe1.setData(exampleFBOut) print (fe1.extract().vector)
def fbFeatureExtraction(): exampleFB = converter.parse("ismir2011_fb_example1b.xml") fe1 = features.jSymbolic.PitchClassDistributionFeature(exampleFB) print fe1.extract().vector # [0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.6666666666666666, 0.0, 0.0, 1.0, 0.0, 0.0] n1 = exampleFB.parts[0][1][5] n1.expressions.append(expressions.Turn()) x = expressions.realizeOrnaments(n1) n2 = exampleFB.parts[0][2][2] n2.expressions.append(expressions.Mordent()) y = expressions.realizeOrnaments(n2) exampleFB.parts[0][1].elements = [exampleFB.parts[0][1][4]] exampleFB.parts[0][1].append(x) exampleFB.parts[0][2].elements = [exampleFB.parts[0][2][0], exampleFB.parts[0][2][1]] exampleFB.parts[0][2].append(y) fb1 = figuredBass.realizer.figuredBassFromStream(exampleFB.parts[1]) # realization = fb1.realize() sol1 = fb1.generateRandomRealization() exampleFBOut = stream.Score() exampleFBOut.insert(0, exampleFB.parts[0]) exampleFBOut.insert(0, sol1.parts[0]) exampleFBOut.insert(0, sol1.parts[1]) fe1.setData(exampleFBOut) print fe1.extract().vector