def __init__(self): self.presets = [40,42,44,46,48,50,52,54,56,58,60,63,66,69,72,76,80,84,88,92,96,100,104,108,112,116,120,126,132,138,144,152,160,168,176,184,192,200,208] self.sli_bpm_min = self.presets[0] self.sli_bpm_max = self.presets[-1] self.bpm = 100.0 self.delay = 60.0/self.bpm self.name = 'Metronome' self.background_color = 'white' self.sli = ui.Slider('Beats per Minute') self.sli.action = self.sli_action self.add_subview(self.sli) self.box = ui.Label() self.box.text = '{:d}'.format(int(self.bpm)) self.add_subview(self.box) #self.seg = ui.SegmentedControl() #self.seg.segments = list( map(str,self.presets) ) #self.add_subview(self.seg) sound_list = ['8ve:8ve-tap-crisp', '8ve:8ve-tap-percussive', '8ve:8ve-tap-simple'] #self.sound_effect_file = dialogs.list_dialog(items=sound_list) self.sound_effect_file = sound_list[1] self.sli_set() #sound.set_volume(1.0) sound.set_honors_silent_switch(False) self.init_loop()
async def watch_living_video(cid): import sound sound.set_honors_silent_switch(False) sound.set_volume(1) sound.play_effect('piano:D3') json_response = await bilibili.request_playurl(cid) print(json_response) if not json_response['code']: data = json_response['data'] print(data) webbrowser.open(data)
def voiceUpdate(laneVoice,speedsVoice,lastLaneVoice,slowDown): sound.set_honors_silent_switch(False) if slowDown == 0: if lastLaneVoice != laneVoice[speedsVoice.index(max(speedsVoice))]: if voice.value == 1: speech.say("Switch to lane %s" % (laneVoice[speedsVoice.index(max(speedsVoice))])[-1]) else: for i in range(int(laneVoice[speedsVoice.index(max(speedsVoice))][-1])): sound.play_effect('Coin_2',1) time.sleep(.3) else: if voice.value == 1: speech.say("Prepare for a major slowdown and move to lane %s" % (lane[speeds.index(max(speeds))][-1])) else: sound.play_effect('Ding_3',1) time.sleep(.5) for i in range(int(laneVoice[speedsVoice.index(max(speedsVoice))][-1])): sound.play_effect('Coin_2',1) time.sleep(.3) eventLog.text = str(slowDown)
# coding: utf-8 # https://forum.omz-software.com/topic/2512/no-sound-when-i-run-a-script-at-all import sound sound.set_honors_silent_switch(False) sound.set_volume(1) sound.play_effect('piano:D3')