本文整理汇总了Python中Main.getBeatMarkers方法的典型用法代码示例。如果您正苦于以下问题:Python Main.getBeatMarkers方法的具体用法?Python Main.getBeatMarkers怎么用?Python Main.getBeatMarkers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Main
的用法示例。
在下文中一共展示了Main.getBeatMarkers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import Main [as 别名]
# 或者: from Main import getBeatMarkers [as 别名]
def main():
for filename in os.listdir(os.getcwd() + '/Output'):
if(filename[-4:] == '.mp3'): os.remove('Output/' + filename)
localAudioFiles = []
for filename in os.listdir(os.getcwd() + '/Input'):
print filename
if(filename != '.DS_Store' and filename != 'Thumb.db'):
localAudioFiles.append(audio.LocalAudioFile('Input/' + filename))
keys = [localAudioFiles[0].analysis.key['value'], localAudioFiles[1].
analysis.key['value'], 0,0,0]
for i,laf in enumerate(localAudioFiles[0:2]):
if(laf.analysis.mode['value'] == 0): keys[i] = keys[i]+3
if(keys[i] > 11): keys[i] = keys[i] - 12
tempos = [localAudioFiles[0].analysis.tempo['value'], localAudioFiles[1].
analysis.tempo['value'], 0,0,0]
localAudioFiles = matchTempoAndKey(localAudioFiles, tempos, keys)
for i in range(3): localAudioFiles[i+2].encode(str(i)+'.mp3')
print "tempos after match should equal midTempo: ", [laf.analysis.tempo['value']
for laf in localAudioFiles]
equalize_tracks([localAudioFiles[0],localAudioFiles[1],localAudioFiles[2]])
equalize_tracks([localAudioFiles[3],localAudioFiles[4]])
print "len(localAudioFiles)/5 after match: ", len(localAudioFiles)/5
loudnessMarkers = Main.findLoudestRegion([localAudioFiles[0].analysis.segments,
localAudioFiles[1].analysis.segments],
[localAudioFiles[0].analysis.tempo['value'],
localAudioFiles[1].analysis.tempo['value']])
beatMarkers = Main.getBeatMarkers(loudnessMarkers,
[localAudioFiles[0].analysis.segments,
localAudioFiles[1].analysis.segments],[localAudioFiles[0].analysis.beats,
localAudioFiles[1].analysis.beats])
mashComponents(localAudioFiles, beatMarkers)
示例2: main
# 需要导入模块: import Main [as 别名]
# 或者: from Main import getBeatMarkers [as 别名]
def main():
flushDirectory()
filenames = getAudioFiles()
for j in range(len(filenames)/5):
localAudioFiles = [audio.LocalAudioFile(filenames[5*j], verbose=False),
audio.LocalAudioFile(filenames[5*j+1], verbose=False)]
localAudioFiles.append(audio.AudioData(filenames[5*j+2], sampleRate=44100,
numChannels=2, verbose=False))
localAudioFiles.append(audio.AudioData(filenames[5*j+3], sampleRate=44100,
numChannels=2, verbose=False))
localAudioFiles.append(audio.AudioData(filenames[5*j+4], sampleRate=44100,
numChannels=2, verbose=False))
keys = [localAudioFiles[0].analysis.key['value'], localAudioFiles[1].
analysis.key['value'], 0,0,0]
for i,laf in enumerate(localAudioFiles[0:2]):
if(laf.analysis.mode['value'] == 0): keys[i] = keys[i]+3
if(keys[i] > 11): keys[i] = keys[i] - 12
print "keys: ", keys
tempos = [localAudioFiles[0].analysis.tempo['value'], localAudioFiles[1].
analysis.tempo['value'], 0,0,0]
deleteOldSongs([os.path.basename(laf.filename) for laf in localAudioFiles])
localAudioFiles = matchTempoAndKey(localAudioFiles, tempos, keys)
for i in range(3): localAudioFiles[i+2].encode(str(i)+'.mp3')
print "tempos after match should equal midTempo: ", [laf.analysis.tempo['value']
for laf in localAudioFiles]
equalize_tracks([localAudioFiles[0],localAudioFiles[1],localAudioFiles[2]])
equalize_tracks([localAudioFiles[3],localAudioFiles[4]])
print "len(localAudioFiles)/5 after match: ", len(localAudioFiles)/5
loudnessMarkers = Main.findLoudestRegion([localAudioFiles[0].analysis.segments,
localAudioFiles[1].analysis.segments],
[localAudioFiles[0].analysis.tempo['value'],
localAudioFiles[1].analysis.tempo['value']])
beatMarkers = Main.getBeatMarkers(loudnessMarkers,
[localAudioFiles[0].analysis.segments,
localAudioFiles[1].analysis.segments],[localAudioFiles[0].analysis.beats,
localAudioFiles[1].analysis.beats])
mashComponents(localAudioFiles, beatMarkers)