本文整理匯總了Python中Math.note_name方法的典型用法代碼示例。如果您正苦於以下問題:Python Math.note_name方法的具體用法?Python Math.note_name怎麽用?Python Math.note_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Math
的用法示例。
在下文中一共展示了Math.note_name方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: analyze_semitone
# 需要導入模塊: import Math [as 別名]
# 或者: from Math import note_name [as 別名]
def analyze_semitone(self, control, semitone):
if not self.project:
return
if not control.has_data:
return
text = ""
for overtone, frequency, power, peak_center, difference_in_semitones in control.analyze_overtones(semitone, 10):
s = Math.frequency_to_semitone(frequency)
position = control.start + control.duration / 2.0
lower = Math.semitone_to_frequency(s - 0.5)
upper = Math.semitone_to_frequency(s + 0.5)
onset_min, onset_max = self.project.appsinkpipeline.find_onset(lower, upper, position, limit=5)
text += "%d. overtone: %f Hz (semitone %f; near %s)\n" % (overtone, frequency, s, Math.note_name(s))
text += "\tPower: %f (%f dB)\n" % (power, Math.power_to_magnitude(power))
text += "\tPosition: %f Hz (off by %f semitones)\n" % (peak_center, difference_in_semitones)
text += "\tOnset: between %fs and %fs\n" % (onset_min, onset_max)
text += "\n"
w = gtk.Window()
w.set_size_request(500, 400)
w.set_title("Info on %s (%f)" % (Math.note_name(semitone), semitone))
sw = gtk.ScrolledWindow()
w.add(sw)
tv = gtk.TextView()
tv.get_buffer().set_text(text)
tv.set_editable(False)
sw.add(tv)
w.show_all()
示例2: __init__
# 需要導入模塊: import Math [as 別名]
# 或者: from Math import note_name [as 別名]
def __init__(self, control, tuning=-5, **kwargs):
FretboardWindowBase.__init__(self, **kwargs)
self.set_title("Undertones of %s-tuned string (%f - %f Hz)" % (Math.note_name(tuning), tuning, Math.semitone_to_frequency(tuning)))
root = self.canvas.get_root_item()
self.visualizer = Undertones(control, self.volume, parent=root, tuning=tuning)
self.adjust_canvas_size()
示例3: construct
# 需要導入模塊: import Math [as 別名]
# 或者: from Math import note_name [as 別名]
def construct(self, posx, posy):
# captions
fretcaptions = goocanvas.Group(parent=self)
for fret in xrange(1,self.frets+1):
goocanvas.Text(parent=fretcaptions, x=fret*self.rectwidth, y=0, text=str(fret), anchor=gtk.ANCHOR_NORTH, font=10)
stringcaptions = goocanvas.Group(parent=self)
for string in xrange(len(self.strings)):
semitone = self.strings[string]
name = Math.note_name(semitone).upper()
text = goocanvas.Text(parent=stringcaptions, x=0, y=string*self.rectheight, text=name, anchor=gtk.ANCHOR_EAST, font=10)
text.connect("button_release_event", self.open_overtones, self.strings[string])
startx = posx + stringcaptions.get_bounds().x2-stringcaptions.get_bounds().x1 + 5
starty = posy + fretcaptions.get_bounds().y2-fretcaptions.get_bounds().y1
fretcaptions.props.x = startx + 0.5*self.rectwidth
fretcaptions.props.y = posy
stringcaptions.props.x = startx - 5
stringcaptions.props.y = starty + 0.5*self.rectheight
# fretboard
FretboardBase.construct(self, startx, starty)