当前位置: 首页>>代码示例>>Python>>正文


Python Math.note_name方法代码示例

本文整理汇总了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()
开发者ID:Leberwurscht,项目名称:Python-Guitar-Transcription-Aid,代码行数:35,代码来源:transcribe.py

示例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()
开发者ID:Leberwurscht,项目名称:Python-Guitar-Transcription-Aid,代码行数:11,代码来源:Visualizer.py

示例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)
开发者ID:Leberwurscht,项目名称:Python-Guitar-Transcription-Aid,代码行数:26,代码来源:Visualizer.py


注:本文中的Math.note_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。