def patch_music(rom, settings, log, symbols): # patch music if settings.background_music != 'normal' or settings.fanfares != 'normal': music.restore_music(rom) log.bgm = music.randomize_music(rom, settings) else: music.restore_music(rom)
def __init__(self, width=Settings.SCREEN_WIDTH, height=Settings.SCREEN_HEIGHT): pygame.init() self.width = width self.height = height self.screen = pygame.display.set_mode((self.width, self.height)) self.shooting = False self.shoot_ticker = 0 #Can shoot without waiting self.MAX_SHOOT_TICKER = 30 #One shot every x frames self.spawn_ticker = 1800 #Start spawning 1800 frames in. self.MAX_SPAWN_TICKER = 1800 #Max one new enemy every 1800 frames self.GAME_OVER = False self.END_GAME = False self.END_CREDITS = False self.RESPAWNING = False self.respawn_ticker = 0 self.SCORE = 0 ################## self.HIGHSCORES = [] self.checkHighscore() self.wave1_pass = False self.wave2_pass = False self.wave3_pass = False self.boss_spawned = False self.enemies_killed = 0 #Number of enemy01 killed self.music = Music("MainLoop") self.clock = pygame.time.Clock() self.LIVES = 3 #############
def main(): user_input = show_options() emotions = [] while user_input != 'x': if user_input == '1': # Extracting Feature Function Call get_features('Audio/') user_input = show_options() elif user_input == '2': # Building model using ANN Music.build_model() #Building model using KNN #MusicKNN.train_model() user_input = show_options() elif user_input == '3': #Predicting the model using ANN emotions = Music.predict_emotion() #Predicting the model using KNN #emotions = MusicKNN.predict_emotion() print(emotions) # num_images = input("Enter number of images you would like as a representation: ") # Chrome.build_image(emotions, int(num_images)) user_input = show_options() elif user_input == '4': song_predictor() get_features('Output/') #Predicting the model using ANN emotions = Music.predict_emotion() #Predicting the model using KNN #emotions = MusicKNN.predict_emotion() print(emotions) # num_images = input("Enter number of images you would like as a representation: ") # Chrome.build_image(emotions, int(num_images)) user_input = show_options()
def __init__(self, imageDir, imageScreenOne, imageScreenTwo, imageScreenThree, imageSerialPopup): # imageDir: directory for image # imageScreenOne: background image for the first screen # imageScreenTwo: background image for the second screen # imageScreenThree: background image for the third screen # initialization self.imageDir = imageDir self.imageScreenOne = imageScreenOne self.imageScreenTwo = imageScreenTwo self.imageScreenThree = imageScreenThree self.imageSerialPopup = imageSerialPopup # this are the proportion of us screen and will be used to # change dimension of window if the computer of user has different dimension self.imageW = 1366 self.imageH = 766 self.minRandTime = 10 self.maxRandTime = 20 # we initialize variable for mean self.minPartialInit = 100000 self.minPartial = self.minPartialInit self.minMeanInit = 100000 self.minMean = self.minMeanInit self.count = 0 self.tot = 0 self.meanYPos = 0 self.flag_off = 0 self.flag_on = 1 self.__toggle = 0 # we initialize user variable self.__user = "******" # we set a flag that is uset to know if play restart, in this case # music mustn't restart self.__tryAgainFlagForMusic = 0 # we initialize rootscreen self.window = tk.Tk() self.window.title("The reaction game") #read the dimensions of the screen self.widthScreen, self.heightScreen = self.window.winfo_screenwidth( ), self.window.winfo_screenheight() #calculate the dimensions of the main window self.widthRoot, self.heightRoot = int(self.widthScreen / 2), int( self.heightScreen / 2) #setup of the window dimensions self.window.geometry("%dx%d" % (self.widthRoot, self.heightRoot)) #block the possibility to resize the dimensions of the window self.window.resizable(width=False, height=False) # we initialize serial object self.serialObj = serialConnection(self.window, self.imageDir, self.imageSerialPopup) # we start music self.music = Music(self.window, "Img/", "sound_on.png", "sound_off.png", "Music/", "InstantCrush.wav")
def patch_music(rom, settings, log, symbols): # patch music if settings.background_music != 'normal' or settings.fanfares != 'normal' or log.src_dict.get( 'bgm', {}): music.restore_music(rom) log.bgm, errors = music.randomize_music(rom, settings, log.src_dict.get('bgm', {})) log.errors.extend(errors) else: music.restore_music(rom)
def patch_music(rom, settings, log, symbols): # patch music if settings.background_music != 'normal' or settings.fanfares != 'normal' or log.src_dict.get('bgm', {}): music.restore_music(rom) log.bgm, errors = music.randomize_music(rom, settings, log.src_dict.get('bgm', {})) log.errors.extend(errors) else: music.restore_music(rom) # Remove battle music if settings.disable_battle_music: rom.write_byte(0xBE447F, 0x00)
def spawnEnemies(self): #Wave 1 if self.enemies_killed < Settings.WAVE1_PASS and self.wave1_pass == False: if self.spawn_ticker > 0: self.spawn_ticker -= 1 elif self.spawn_ticker == 0: new_enemy = Enemy01() self.enemy_sprites.add(new_enemy) self.spawn_ticker = self.MAX_SPAWN_TICKER elif self.enemies_killed >= Settings.WAVE1_PASS and self.wave1_pass == False: self.enemies_killed = 0 self.wave1_pass = True #Wave 2 if self.enemies_killed < Settings.WAVE2_PASS and self.wave2_pass == False and self.wave1_pass == True: if self.spawn_ticker > 0: self.spawn_ticker -= 1 elif self.spawn_ticker == 0: tmp = random.randint(0, 1) if tmp == 0: new_enemy1 = Enemy01() self.enemy_sprites.add(new_enemy1) new_enemy = Enemy02() self.enemy_sprites.add(new_enemy) self.spawn_ticker = self.MAX_SPAWN_TICKER elif self.enemies_killed >= Settings.WAVE2_PASS and self.wave2_pass == False: self.enemies_killed = 0 self.wave2_pass = True #Wave 3 if self.enemies_killed < Settings.WAVE3_PASS and self.wave3_pass == False and self.wave1_pass == True and self.wave2_pass == True: if self.spawn_ticker > 0: self.spawn_ticker -= 1 elif self.spawn_ticker == 0: tmp = random.randint(0, 2) if tmp == 0: new_enemy1 = Enemy01() self.enemy_sprites.add(new_enemy1) tmp = random.randint(0, 3) if tmp == 0: new_enemy2 = Enemy02() self.enemy_sprites.add(new_enemy2) new_enemy = Enemy03() self.enemy_sprites.add(new_enemy) self.spawn_ticker = self.MAX_SPAWN_TICKER elif self.enemies_killed >= Settings.WAVE3_PASS and self.wave3_pass == False: self.enemies_killed = 0 self.wave3_pass = True #Boss if self.wave1_pass and self.wave2_pass and self.wave3_pass and self.boss_spawned == False: self.enemy_sprites.add(Boss()) self.music = Music("Blaze") self.music.play() self.boss_spawned = True
def make_playlist(username, playlistName="Spoons&Tunes", genre="rock", location="Boston,MA", numSongs=20): scope = 'playlist-modify-public' token = util.prompt_for_user_token(username, scope,"2a1cd7b9a1ee4294b4085e52d2ac51a2", "e771e11a11f9444c906f6eccabf3a037","http://google.com") songList = Music.getPlayList(genre, location, numSongs) spotify = spotipy.Spotify(auth=token) curlist = spotify.user_playlist_create(username,playlistName, public=True) songIDs = [] for song in songList: #print song songDict = spotify.search(q='track:'+song.__str__(),limit=1,type='track') for i, t in enumerate(songDict['tracks']['items']): songIDs.append( t['external_urls']['spotify']) break #songDict = song.get_tracks('spotify-WW')[0] #id = songDict['foreign_id'] #songIDs.append(id[14:]) #print len(songIDs) spotify.user_playlist_add_tracks(username, curlist['id'], songIDs) return curlist['external_urls']['spotify']
def __init__(self, width=Settings.SCREEN_WIDTH,height=Settings.SCREEN_HEIGHT): pygame.init() self.width = width self.height = height self.screen = pygame.display.set_mode((self.width, self.height)) self.shooting = False self.shoot_ticker = 0 #Can shoot without waiting self.MAX_SHOOT_TICKER = 30 #One shot every x frames self.spawn_ticker = 1800 #Start spawning 1800 frames in. self.MAX_SPAWN_TICKER = 1800 #Max one new enemy every 1800 frames self.GAME_OVER = False self.END_GAME = False self.END_CREDITS = False self.RESPAWNING = False self.respawn_ticker = 0 self.SCORE = 0################## self.HIGHSCORES = [] self.checkHighscore() self.wave1_pass = False self.wave2_pass = False self.wave3_pass = False self.boss_spawned = False self.enemies_killed = 0 #Number of enemy01 killed self.music = Music("MainLoop") self.clock = pygame.time.Clock() self.LIVES = 3#############
def get_voice_state(self, ctx: commands.Context): state = self.voice_states.get(ctx.guild.id) if not state or not state.exists: state = Music.VoiceState(self.bot, ctx) self.voice_states[ctx.guild.id] = state return state
def end(notes, scale): print(notes.items, scale, (scale - 1) % 7) end1 = Music.scaleInvertAtIndex(notes, scale, choice([4, 6])) end1.reverse() end1 += NoteSeq([Note(scale, octave=5, dur=0.5)]) if scale == 0: end1[-1].octave += 1 print("end:", end1.verbose) return end1
def genMelody(notes): scale = choice(Music.getScales(notes)) scaleName = Music.note_name(scale, -1).lower() + " major" print("scale:", scaleName) Melody = NoteSeq() Melody += notes currNotes = notes for note in notes: note.dur = choice(durations) print(notes.items) for i in range(4): currNotes = Transform(notes, scale) Melody += currNotes Melody += end(currNotes, scale) print(Melody.items) Music.getSheetMusic(Melody, scaleName.split()) return Melody
def main(): """Main function to get information for Bar 3. """ getter_volume = Volume.Volume() getter_music = Music.Music() getter_volume.show_info() sys.stdout.write(" | ") getter_music.show_song()
def __init__(self): # game loading self.disp = pygame.display self.window = self.disp.set_mode((1138, 640)) self.disp.set_caption("Ubongo") self.disp.set_icon(setIcon()) music.loadMenuMusic() self.game = Game() # game management self.program_running = True self.phase = -1 self.paused_phase = -1 self.hints_hidden = 1 self.current_turn = 0 self.col = 0 self.making_puzzle = False self.tp_mouse = False self.selected_piece = None self.selected_piece_id = 0 self.turn_queue = -1 self.puzzle = np.copy(self.game.getPuzzles(0)) self.puzzle_ai = np.full((3, 6, 6), -1, dtype=int) self.completed_puzzle = False # mouse hovering self.play_hover = False self.instructions_hover = False self.config_hover = False self.exit_hover = False self.return_hover = False self.space_hover = False self.begin_turn_hover = False self.hints_hover = False self.piece_hover = np.array([False, False, False, False]) self.blocked_piece = np.array([False, False, False, False]) self.new_game_hover = False self.back_menu_hover = False self.minus_time_hover = False self.plus_time_hover = False self.minus_turns_hover = False self.plus_turns_hover = False self.minus_cpu_hover = False self.plus_cpu_hover = False
def main(self): #load panels self.music = Music.Music(self) self.music.start() self.shell = Shell.Shell(self) self.shell.start() self.toogle(self.PANE_SHELL) #start event loop self.eventThread = EventThread(self) self.eventThread.start()
def has_music(text): thre = threading.Thread() if text[0].__eq__("点") and text[1].__eq__("歌"): url = Music.get_musicurl(text[2:]) thre = threading.Thread(target=play, args=[url]) thre.start() return url elif text.__contains__("停止"): os.system('killall -9 mplayer') else: return has_weather(text)
def analyze(): global samples_done, buffer while True: buffer_full.wait(timeout=20) frame = np.array(buffer).astype(np.float) frame_var = np.var(frame, axis = 0) frame_skew = stat.skew(frame, axis = 0) frame_kurt = stat.kurtosis(frame, axis = 0) features = np.hstack((frame_var, frame_skew, frame_kurt)) prediction = predict(features.reshape(1, -1)) if(prediction[0] == 1): print('Gesture Detected: Left Down') controller.next() #if you detect a gester, clear buffer fully #To prevent multiple detections on one gesture samples_done = 0 elif(prediction[0] == 2): print('Gesture Detected: Right Down') controller.previous() samples_done = 0 elif(prediction[0] == 3): print('Gesture Detected: Up Flick') controller.pause_play() samples_done = 0 buffer_full.clear()
def spawnEnemies(self): #Wave 1 if self.enemies_killed < Settings.WAVE1_PASS and self.wave1_pass == False: if self.spawn_ticker > 0: self.spawn_ticker -= 1 elif self.spawn_ticker == 0: new_enemy = Enemy01() self.enemy_sprites.add(new_enemy) self.spawn_ticker = self.MAX_SPAWN_TICKER elif self.enemies_killed >= Settings.WAVE1_PASS and self.wave1_pass == False: self.enemies_killed = 0 self.wave1_pass = True #Wave 2 if self.enemies_killed < Settings.WAVE2_PASS and self.wave2_pass == False and self.wave1_pass == True: if self.spawn_ticker > 0: self.spawn_ticker -= 1 elif self.spawn_ticker == 0: tmp = random.randint(0,1) if tmp == 0: new_enemy1 = Enemy01() self.enemy_sprites.add(new_enemy1) new_enemy = Enemy02() self.enemy_sprites.add(new_enemy) self.spawn_ticker = self.MAX_SPAWN_TICKER elif self.enemies_killed >= Settings.WAVE2_PASS and self.wave2_pass == False: self.enemies_killed = 0 self.wave2_pass = True #Wave 3 if self.enemies_killed < Settings.WAVE3_PASS and self.wave3_pass == False and self.wave1_pass == True and self.wave2_pass == True: if self.spawn_ticker > 0: self.spawn_ticker -= 1 elif self.spawn_ticker == 0: tmp = random.randint(0,2) if tmp == 0: new_enemy1 = Enemy01() self.enemy_sprites.add(new_enemy1) tmp = random.randint(0,3) if tmp == 0: new_enemy2 = Enemy02() self.enemy_sprites.add(new_enemy2) new_enemy = Enemy03() self.enemy_sprites.add(new_enemy) self.spawn_ticker = self.MAX_SPAWN_TICKER elif self.enemies_killed >= Settings.WAVE3_PASS and self.wave3_pass == False: self.enemies_killed = 0 self.wave3_pass = True #Boss if self.wave1_pass and self.wave2_pass and self.wave3_pass and self.boss_spawned == False: self.enemy_sprites.add(Boss()) self.music = Music("Blaze") self.music.play() self.boss_spawned = True
def __init__(self, tempo): self.volume = 16384 self.samplerate = 44100 self.p = pyaudio.PyAudio() self.stream = self.p.open(format=8, channels=1, rate=self.samplerate, output=True) self.totalsignal = [] self.m = Music.Music() self.tempo = tempo self.BPS = 60.0 / tempo # self.signalLog = open("signalLog.txt", 'r+') self.frameCounter = 0
def __init__(self, directory): self.directory = directory # Directory of app # Initialize pygame pygame.init() pygame.font.init() self.fps = 60 self.background = pygame.image.load(self.directory + \ "/images/background.jpg") self.header = pygame.image.load(self.directory + \ "/images/header.png") self.footer = pygame.image.load(self.directory + \ "/images/footer.png") self.border = pygame.image.load(self.directory + \ "/images/border.png") # Read config file self.configFile() # Initialize song list self.songs = SongList(self.directory, self.musicDirectory) self.musicDirectory = self.songs.getDirectory() self.musicDirectory = self.musicDirectory.rstrip(SLASH) + SLASH # Initialize music player self.musicPlayer = Music(self.musicDirectory) # Set up song information path = self.songs.getPath(self.currentSong) title = self.songs.getTitle(self.currentSong) self.musicPlayer.setSongInformation(path, title) # Call method to set up GUI self.setupGUI() # Call method to run app self.runApp()
def loadMusic(self): self.channel1 = pygame.mixer.Channel(0) self.channel2 = pygame.mixer.Channel(1) self.instructionMusic = Music.Music(self.channel1, "instruction.wav") self.click1Music = Music.Music(self.channel2, "click1.wav") self.click2Music = Music.Music(self.channel2, "click2.wav") self.startMusic = Music.Music(self.channel1, "start.wav") self.game1Music = Music.Music(self.channel1, "game1.wav") self.game2Music = Music.Music(self.channel1, "game2.wav") self.endMusic = Music.Music(self.channel1, "victory.wav")
async def _summon(self, ctx: commands.Context, *, channel: discord.VoiceChannel = None): if not channel and not ctx.author.voice: raise Music.VoiceError( 'You are neither connected to a voice channel nor specified a channel to join.' ) destination = channel or ctx.author.voice.channel if ctx.voice_state.voice: await ctx.voice_state.voice.move_to(destination) return ctx.voice_state.voice = await destination.connect()
def searchmusic(self, musicname, pageno): url = "http://y.webzcz.cn/api.php" para = { "types": "search", "count": 10, "source": "netease", "pages": pageno, "name": musicname } musics = requests.post(url, data=para).json() musicslist = list() for musicDic in musics: music = Music(musicDic) musicslist.append(music) return musicslist
def __init__(self, parent): wx.Panel.__init__(self, parent) panel = wx.Panel(self, size=(WINDOW_WIDTH, WINDOW_HEIGHT)) nb = wx.Notebook(panel) sd = Sounds(nb) mu = Music(nb) nb.AddPage(sd, "Sounds") nb.AddPage(mu, "Music") sizer = wx.BoxSizer() sizer.Add(nb, 1, wx.EXPAND) self.SetSizer(sizer)
async def _play(self, ctx: commands.Context, *, search: str): if not ctx.voice_state.voice: await ctx.invoke(self._join) async with ctx.typing(): try: source = await Music.YTDLSource.create_source( ctx, search, loop=self.bot.loop) except Music.YTDLError as e: await ctx.send( 'An error occurred while processing this request: {}'. format(str(e))) else: song = Music.Song(source) await ctx.voice_state.songs.put(song) await ctx.send('Enqueued {}'.format(str(source)))
def image(): name = str(uuid.uuid4()) + ".jpg" i = request.files['image'] # get the image i.save(name) start_time = time.time() p = Network.Predict(name, model_path, "./Utils/cascade.xml", load=model, openCv=cascade) songs = Music.GetByMood(p[0][0]) elapsed_time = time.time() - start_time os.remove(name) p.append(elapsed_time) p.append(songs) j = json.dumps(p, cls=MyEncoder) return Response(j)
octave = musc.pick_octave(img_avg) key = musc.pick_key(most_avg) if musc.pick_major(img_avg, n) == "major": major = True else: major = False print("most_avg: ", most_avg) print("Music Info: ") print("Octave: ", octave) print("Major: ", major) print("Key: ", key) print("Notes: ") track = muscno.create_random_track(key, major) #print(track) print("Track length: ", len(track)) #b = "cegb" #bar = Lilypond.from_Bar(b) #print(bar) #Lilypond.to_png(bar,"my_first_bar") #for bar in track: # print("Bar: ", bar) """ print(track[0][3]) print(track[0][3][2]) print(track[0][3][2][0])
class Main: def __init__(self, width=Settings.SCREEN_WIDTH,height=Settings.SCREEN_HEIGHT): pygame.init() self.width = width self.height = height self.screen = pygame.display.set_mode((self.width, self.height)) self.shooting = False self.shoot_ticker = 0 #Can shoot without waiting self.MAX_SHOOT_TICKER = 30 #One shot every x frames self.spawn_ticker = 1800 #Start spawning 1800 frames in. self.MAX_SPAWN_TICKER = 1800 #Max one new enemy every 1800 frames self.GAME_OVER = False self.END_GAME = False self.END_CREDITS = False self.RESPAWNING = False self.respawn_ticker = 0 self.SCORE = 0################## self.HIGHSCORES = [] self.checkHighscore() self.wave1_pass = False self.wave2_pass = False self.wave3_pass = False self.boss_spawned = False self.enemies_killed = 0 #Number of enemy01 killed self.music = Music("MainLoop") self.clock = pygame.time.Clock() self.LIVES = 3############# def getScores(self): scores = {} count = 0 for line in self.HIGHSCORES: data = line.split("-") name = str(data[0].strip()) data[1] = data[1].strip().strip('\0') score = int(data[1]) scores[Settings.SCORE_FORMAT.format(line, count)] = score count += 1 return scores def getRank(self, key, value, scores): rank = 0 for key2, value2 in scores.iteritems(): if key != key2: if value < value2: rank += 1 return rank def getEntries(self, scores): entries = [] ranks = [] #KNOWN BUG## """ If there are more than two scores that are next to eachother the bump algorithm will move the new value to the next one, but that will also be taken A fix to this is to loop through again to make sure the newly bumped value doesn't already exist, but then you would need n loops, where n is the number of numbers close to eachother To replicate, create a large array of self.HIGHSCORES using random numbers, and it's bound to happen at least once """ for key, value in scores.iteritems(): new_rank = self.getRank(key, value, scores) #print key,value,new_rank##################### bump = False #Doot doot gross code here for rank in ranks: if new_rank == rank:#Find index for bumpin bump = True if bump == True: new_rank += 1 ############ ranks.append(new_rank) count2 = 0 for key, value in scores.iteritems(): entries.append([str(key.split("-")[0].strip()), value, ranks[count2]]) #["nobody", 0, 3] name,score,rank count2 += 1 return entries def sortEntries(self, entries): new_entries = [] #print entries######################## for i in range(len(entries)): new_entries.append(i) for entry in entries: ####3print entry[0],entry[1],entry[2] new_entries[entry[2]] = Settings.SCORE_FORMAT.format(entry[0], entry[1]) return new_entries def setHighscore(self, name): eightcrypt = EightCrypt() new_entry = Settings.SCORE_FORMAT.format(name, self.SCORE) self.HIGHSCORES = self.sortEntries(self.getEntries(self.getScores())) self.HIGHSCORES.append(new_entry) self.HIGHSCORES = self.sortEntries(self.getEntries(self.getScores())) #print self.HIGHSCORES############## eightcrypt.write("highscores.txt", self.HIGHSCORES) def checkHighscore(self): eightcrypt = EightCrypt() if os.path.isfile("highscores.txt") == False: eightcrypt = EightCrypt() self.HIGHSCORES.append("Chuck Norris - 999999") self.HIGHSCORES.append("player 1 - 1001001") self.HIGHSCORES.append("bush - 2001") self.HIGHSCORES.append("John Cena - 10") self.HIGHSCORES.append("Liz Boese - 1") eightcrypt.write("highscores.txt", self.HIGHSCORES) else: eightcrypt = EightCrypt() self.HIGHSCORES = eightcrypt.read("highscores.txt") def explosivifySprite(self, sprite_rect, explosionCount=4): #Explode around a sprite, optional explosions count for i in range(0,explosionCount): x_pos = sprite_rect.x - int(.4 * sprite_rect.width) y_pos = sprite_rect.y - int(.4 * sprite_rect.height) offset_x = random.randint(0,sprite_rect.width + int(.4 * sprite_rect.width)) offset_y = random.randint(0,sprite_rect.height + int(.4 * sprite_rect.height)) #40% increased explosion radius >:) self.explosion_sprites.add(Explosion(x_pos + offset_x, y_pos + offset_y)) def LoadSprites(self): self.ship = Ship() self.ship_sprite = pygame.sprite.RenderPlain((self.ship)) self.bullet_sprites = pygame.sprite.Group() #Make a group of bullets self.en_bullet_sprites = pygame.sprite.Group() self.enemy_sprites = pygame.sprite.Group() #Groups enemies self.backgrounds = pygame.sprite.Group() self.explosion_sprites = pygame.sprite.Group() self.ship_lives_sprites = LivesGroup(self.LIVES) self.last_death_rect = self.ship.rect self.font = pygame.font.Font(None, Settings.FONT_SIZE) #No specific font, size def updateSprites(self): self.ship.update() self.bullet_sprites.update() self.en_bullet_sprites.update() self.backgrounds.update() self.enemy_sprites.update() for enemy in self.enemy_sprites: #Update player pos for all enemies enemy.setPlayerPos(self.ship.rect.x, self.ship.rect.y) if len(enemy.bullet_queue) > 0: #Move bullets from enemy bullet queue to render group for en_bullet in enemy.bullet_queue: self.en_bullet_sprites.add(en_bullet) enemy.bullet_queue.remove(en_bullet) self.explosion_sprites.update() def checkShoot(self): if self.shoot_ticker > 0: self.shoot_ticker -= 1 if self.shooting and self.shoot_ticker == 0: tmp_bullet = Bullet(pygame.Rect(self.ship.rect.x + (self.ship.rect.width/2), self.ship.rect.y, 16, 4)) tmp_bullet.rect.x = tmp_bullet.rect.x - tmp_bullet.rect.height/2 #center (.height cuz flipped) tmp_bullet.image = pygame.transform.rotate(tmp_bullet.image, 90) self.bullet_sprites.add(tmp_bullet) self.shoot_ticker = self.MAX_SHOOT_TICKER def spawnEnemies(self): #Wave 1 if self.enemies_killed < Settings.WAVE1_PASS and self.wave1_pass == False: if self.spawn_ticker > 0: self.spawn_ticker -= 1 elif self.spawn_ticker == 0: new_enemy = Enemy01() self.enemy_sprites.add(new_enemy) self.spawn_ticker = self.MAX_SPAWN_TICKER elif self.enemies_killed >= Settings.WAVE1_PASS and self.wave1_pass == False: self.enemies_killed = 0 self.wave1_pass = True #Wave 2 if self.enemies_killed < Settings.WAVE2_PASS and self.wave2_pass == False and self.wave1_pass == True: if self.spawn_ticker > 0: self.spawn_ticker -= 1 elif self.spawn_ticker == 0: tmp = random.randint(0,1) if tmp == 0: new_enemy1 = Enemy01() self.enemy_sprites.add(new_enemy1) new_enemy = Enemy02() self.enemy_sprites.add(new_enemy) self.spawn_ticker = self.MAX_SPAWN_TICKER elif self.enemies_killed >= Settings.WAVE2_PASS and self.wave2_pass == False: self.enemies_killed = 0 self.wave2_pass = True #Wave 3 if self.enemies_killed < Settings.WAVE3_PASS and self.wave3_pass == False and self.wave1_pass == True and self.wave2_pass == True: if self.spawn_ticker > 0: self.spawn_ticker -= 1 elif self.spawn_ticker == 0: tmp = random.randint(0,2) if tmp == 0: new_enemy1 = Enemy01() self.enemy_sprites.add(new_enemy1) tmp = random.randint(0,3) if tmp == 0: new_enemy2 = Enemy02() self.enemy_sprites.add(new_enemy2) new_enemy = Enemy03() self.enemy_sprites.add(new_enemy) self.spawn_ticker = self.MAX_SPAWN_TICKER elif self.enemies_killed >= Settings.WAVE3_PASS and self.wave3_pass == False: self.enemies_killed = 0 self.wave3_pass = True #Boss if self.wave1_pass and self.wave2_pass and self.wave3_pass and self.boss_spawned == False: self.enemy_sprites.add(Boss()) self.music = Music("Blaze") self.music.play() self.boss_spawned = True def checkCollisions(self): hit_enemies = pygame.sprite.groupcollide(self.enemy_sprites, self.bullet_sprites, False, True) #Check collide between two sprite groups, remove bullet on true collision for enemy in hit_enemies: if enemy.hp - 1 <= 0: self.explosivifySprite(enemy.rect) self.SCORE += enemy.bounty self.enemies_killed += 1 enemy.removeMe = True else: enemy.hp -= 1 self.explosivifySprite(enemy.rect, 1) if self.ship.hasInvincibility() == False: player_isHit = False hit_sprites = pygame.sprite.groupcollide(self.enemy_sprites, self.ship.hitbox_sprite, False, False) #Check between ship and enemies for enemy_sprite in hit_sprites: player_isHit = True self.explosivifySprite(enemy_sprite.rect) enemy_sprite.removeMe = True self.enemies_killed += 1 hit_sprites = pygame.sprite.groupcollide(self.en_bullet_sprites, self.ship.hitbox_sprite, False, False) for enemy_bullet in hit_sprites: player_isHit = True enemy_bullet.removeMe = True if player_isHit == True: self.LIVES -= 1 self.last_death_rect = self.ship.rect self.ship_lives_sprites.loseLife() self.respawn_ticker = Settings.RESPAWN_TIME * 120 * 2 # fps x seconds x 2(for explosion and respawn) = frames to respawn self.RESPAWNING = True if self.LIVES < 1: #Classic game programming 'if' statement :) self.GAME_OVER = True def handleEvents(self): for event in pygame.event.get(): keys = pygame.key.get_pressed() if event.type == pygame.QUIT: sys.exit() elif event.type == KEYDOWN: #Key presses self.ship.move() #Move the ship if keys[Settings.SHOOT]: self.shooting = True elif event.type == KEYUP: if keys[Settings.SHOOT] != True: self.shooting = False def drawSprites(self): self.screen.blit(self.clear_bg, (0,0)) self.backgrounds.draw(self.screen) if self.ship.hasInvincibility(): if self.ship.invincibility_frames % 3 == 0: #Only draw every x frames, respawn "flickering" self.ship_sprite.draw(self.screen) else: self.ship_sprite.draw(self.screen) self.bullet_sprites.draw(self.screen) self.en_bullet_sprites.draw(self.screen) self.enemy_sprites.draw(self.screen) for explosion in self.explosion_sprites: explosion.animated_image.render(self.screen, (explosion.rect.x, explosion.rect.y)) self.ship_lives_sprites.drawLives(self.screen) def cleanupSprites(self): for bullet1 in self.bullet_sprites: #Dem bullets if bullet1.removeMe == True: self.bullet_sprites.remove(bullet1) for explosion in self.explosion_sprites: #Explosionssss if explosion.removeMe == True: self.explosion_sprites.remove(explosion) for enemy in self.enemy_sprites: #Enemies if enemy.removeMe == True: self.enemy_sprites.remove(enemy) for bullet2 in self.en_bullet_sprites: #Enemy bullets if bullet2.removeMe == True: self.en_bullet_sprites.remove(bullet2) def gameOver(self): #GG! self.END_GAME = True pygame.key.set_repeat(120, 60) name = inputbox.ask(self.screen, "GG! Your name?") self.setHighscore(name) def drawScore(self): text = self.font.render("{0:d}".format(self.SCORE), 1, (255, 255, 0)) textpos = text.get_rect() textpos.x = Settings.SCREEN_WIDTH/2 textpos.y = Settings.SCREEN_HEIGHT - Settings.FONT_SIZE self.screen.blit(text, textpos) def MainLoop(self): self.LoadSprites() pygame.key.set_repeat(10, 20)#Input every 20ms, read every 10mss #Clear background self.backgrounds.add(pygame.sprite.RenderPlain(Background(0,0*Settings.BACKGROUND_HEIGHT))) self.backgrounds.add(pygame.sprite.RenderPlain(Background(0,1*Settings.BACKGROUND_HEIGHT))) self.backgrounds.add(pygame.sprite.RenderPlain(Background(0,2*Settings.BACKGROUND_HEIGHT))) self.clear_bg = pygame.Surface(self.screen.get_size()) self.clear_bg = self.clear_bg.convert() self.clear_bg.fill((0,0,0)) self.music.play() while self.END_GAME != True: self.clock.tick(600) #Cap framerate at 60 fps if self.RESPAWNING == True: if self.respawn_ticker % 120 == 0 and self.respawn_ticker > 119: #Periodic explosions, leaving 120 frames for respawn "stillness", but still exploding at frame = 120 self.explosivifySprite(self.last_death_rect) elif self.respawn_ticker < 120: self.ship.resetToStartingPosition() if self.respawn_ticker == 0: if self.GAME_OVER: self.gameOver() else: self.ship.giveInvinciblity() self.RESPAWNING = False self.respawn_ticker -= 1 else: #Event checking self.handleEvents() #Check if player can shoot self.checkShoot() #Collisions self.checkCollisions() ####End RESPAWNING if statement - WARNING!! - anything outside will run during respawn! #Update sprites self.updateSprites() #Spawn enemies self.spawnEnemies() #Drawing sprites self.drawSprites() #Update score self.drawScore() pygame.display.flip() #Clean all entity groups up self.cleanupSprites() ######### credits_ticker = 600 * len(self.HIGHSCORES) * 2 while self.END_CREDITS != True: font = pygame.font.Font(None, 36) #No specific font, size 36 pt text = font.render("GAME OVER!", 1, (255, 0, 0))#Gameover in red -> (255,0,0) textpos = text.get_rect() textpos.centerx = Settings.SCREEN_WIDTH/2 credits_ticker -= 1 if credits_ticker <= 0: self.END_CREDITS = True self.drawSprites() for i in range(len(self.HIGHSCORES)): scores = self.font.render(self.HIGHSCORES[i], 1, (255, 255, 0)) textpos2 = scores.get_rect() textpos2.centerx = Settings.SCREEN_WIDTH/2 textpos2.y = (i+2)*Settings.FONT_SIZE self.screen.blit(scores, textpos2) self.screen.blit(text, textpos) self.explosion_sprites.update() self.cleanupSprites() #Remove explosions pygame.display.flip()
def satisfied(self): key = [Music.P1, Music.M2, Music.M3, Music.P4, Music.P5, Music.M6, Music.M7] tonic = Music.Note(48) # TODO hardcoded C major return all(map(lambda note: Music.octaveReduce(note - tonic) in key, filter(None, self._voice)))
elif "log off" in command or "sign out" in command: LogOff.Logout() elif "where is" in command or "locate" in command: Maps.Maps(command) elif 'shutdown' in command or 'power off' in command: shutdown.Logout() elif 'excel' in command: openExcel.openProgram() elif 'powerpoint' in command: openPowerpoint.openProgram() elif 'word' in command: openWord.openProgram() elif 'one note' in command: openOneNote.openProgram() elif 'settings' in command: openSettings.openProgram() elif 'V S Code' in command or "code" in command: VsCode.OpenCode() elif 'play music' in command or "music" in command: Music.PlayMusic() time.sleep(4)
def listen(): print("Listening...") global bb global p global client_socket server = socket.socket() server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server.bind(('',4329)) server.listen(4) client_socket, client_address = server.accept() while True: try: received_data = client_socket.recv(8192) if not received_data: print("Received empty packet from client") return except socket.error: print("Cannot receive data from client") return #print(received_data) jsonData = received_data try: dataDict = json.loads(jsonData) except ValueError: write('Malformed Data') else: left = 0 #Music right = 0 #Music if 'color' in dataDict: color = dataDict['color'] GlobalSettings.setColor(color) if 'speed' in dataDict: speed = dataDict['speed'] GlobalSettings.setSpeed(speed) if 'Music' in dataDict: left = dataDict['Music'][0] right = dataDict['Music'][1] if 'command' in dataDict: command = dataDict['command'] if command == 'Flash': startRoutine(flash_example.flash,name="Flash") elif command == 'Stop': write("Stopping...") print("Stopping...") stop() GlobalSettings.inProgress = False elif command == 'Clear': startRoutine(flash_example.clear,name="Clear") elif command == 'RoundAndRound': startRoutine(RoundAndRound.start,name="RoundAndRound") elif command == 'Snake': startRoutine(RoundAndRound.startSnake,name="Snake") elif command == 'OutsideIn': startRoutine(RoundAndRound.outsideIn,name="OutsideIn") elif command == 'Random': startRoutine(flash_example.random,name="Random") elif command == "Solid": startRoutine(flash_example.solid,name="Solid") elif command == "Rainbow": startRoutine(flash_example.rainbow,name="Rainbow") elif command == "DCStart": if GlobalSettings.dynaColor is False: startDC(); elif command == "DCStop": stopDC(); elif command == "Music": write("Stopping...") print("Stopping...") stop() write("Showing volume...") print("Showing volume; left: "+str(left)+", right: "+str(right)) Music.showVolume(left,right,bb) elif command == "Show": onLights = dataDict["onLights"] showPixels(onLights) elif command == "OutsideInRemix": startRoutine(OutsideInRemix.start,name="OutsideInRemix") else: write('Unrecognized Command\n')
class SimpleMP3Player(object): currentSong = 0 # Song number def __init__(self, directory): self.directory = directory # Directory of app # Initialize pygame pygame.init() pygame.font.init() self.fps = 60 self.background = pygame.image.load(self.directory + \ "/images/background.jpg") self.header = pygame.image.load(self.directory + \ "/images/header.png") self.footer = pygame.image.load(self.directory + \ "/images/footer.png") self.border = pygame.image.load(self.directory + \ "/images/border.png") # Read config file self.configFile() # Initialize song list self.songs = SongList(self.directory, self.musicDirectory) self.musicDirectory = self.songs.getDirectory() self.musicDirectory = self.musicDirectory.rstrip(SLASH) + SLASH # Initialize music player self.musicPlayer = Music(self.musicDirectory) # Set up song information path = self.songs.getPath(self.currentSong) title = self.songs.getTitle(self.currentSong) self.musicPlayer.setSongInformation(path, title) # Call method to set up GUI self.setupGUI() # Call method to run app self.runApp() # Method sets up GUI def setupGUI(self): # Screen attributes self.screen = pygame.display.set_mode(RESOLUTION) pygame.display.set_caption(TITLE) self.clock = pygame.time.Clock() # For frames per second self.mouse = pygame.mouse.get_pos() # For mouse position # App Icon iconFile = self.directory + self.iconPath self.icon = pygame.image.load(iconFile) pygame.display.set_icon(self.icon) # Setup GUI blocks self.setupButtons() self.setupInformation() self.setupDirectory() self.setupTime() self.volumeBlock = VolumeBlock(self.screen, self.directory) self.musicPlayer.setVolume(self.volumeBlock.getVolume()) self.setupSongsBlock() # Method sets up buttons def setupButtons(self): self.buttonBlock = ButtonBlock(self.screen, self.directory, \ self.mouse) # Method sets up Information Block def setupInformation(self): Title = self.songs.getTitle(self.currentSong) Path = self.songs.getPath(self.currentSong) # Initialize Information Block self.informationBlock = InformationBlock(self.screen, Title, \ Path, self.fps) # Method sets up Directory Block def setupDirectory(self): songDirectory = self.songs.getDirectory() # Initialize Directory Block self.directoryBlock = DirectoryBlock(self.screen, \ self.directory, \ songDirectory, \ self.fps, self.mouse) # Method sets up Time Block def setupTime(self): Time = self.musicPlayer.getPosition() self.timeBlock = TimeBlock(self.screen, Time, self.fps) # Method sets up Song List Block def setupSongsBlock(self): self.songsBlock = SongsBlock(self.screen, self.directory, \ self.songs, self.currentSong) # Method handles a change in song def changeSong(self): title = self.songs.getTitle(self.currentSong) path = self.songs.getPath(self.currentSong) self.informationBlock.setSongTitleAndPath(title, path) self.musicPlayer.setSongInformation(path, title) self.musicPlayer.stop() self.musicPlayer.play() # Method runs app def runApp(self): run = True sliderSelected = None sliderHovered = False mouseDown = False while run == True: self.screen.fill(Colour['BLACK']) self.mouse = pygame.mouse.get_pos() for event in pygame.event.get(): # Handle Quit event if event.type == pygame.QUIT: self.saveFiles() run = False # Handle mouse down events elif event.type == pygame.MOUSEBUTTONDOWN: # Handles volume slider sliderSelected = self.volumeBlock.isInBounds(self.mouse[X], self.mouse[Y]) if sliderSelected: mouseDown = True self.volumeBlock.setDrawPercent(True) # Handles Previous button if self.buttonBlock.previousButton.obj.collidepoint(self.mouse): good = False while not good: try: if (self.currentSong == 0): self.currentSong = self.songsBlock.getSongCount() - 1 else: self.currentSong = self.currentSong - 1 self.changeSong() good = True except: good = False # Handles Play button elif self.buttonBlock.playButton.obj.collidepoint(self.mouse): self.musicPlayer.play() # handles Pause button elif self.buttonBlock.pauseButton.obj.collidepoint(self.mouse): self.musicPlayer.pause() # Handles Stop button elif self.buttonBlock.stopButton.obj.collidepoint(self.mouse): self.musicPlayer.stop() self.timeBlock.update(self.musicPlayer.getPosition()) # Handles Next button elif self.buttonBlock.nextButton.obj.collidepoint(self.mouse): good = False while not good: try: if (self.currentSong == self.songs.getSongCount() - 1): self.currentSong = 0 else: self.currentSong = self.currentSong + 1 self.changeSong() good = True except: good = False # Handles changing directory elif self.directoryBlock.directoryButton.obj.collidepoint(self.mouse): self.songs.chooseDirectory() directory = self.songs.getDirectory() if (self.songs.getChosen() == True): self.musicDirectory = directory self.directoryBlock.mouseDown(self.musicDirectory) self.currentSong = 0 self.musicPlayer.setMusicDirectory(self.musicDirectory) self.changeSong() # Handle mouse up events elif event.type == pygame.MOUSEBUTTONUP: # Handles volume slider mouseDown = False sliderSelected = None # Button Hovers # Previous elif self.buttonBlock.isInBounds(self.mouse, "Previous"): self.buttonBlock.mouseHover("Previous") # Play elif self.buttonBlock.isInBounds(self.mouse, "Play"): self.buttonBlock.mouseHover("Play") # Pause elif self.buttonBlock.isInBounds(self.mouse, "Pause"): self.buttonBlock.mouseHover("Pause") # Stop elif self.buttonBlock.isInBounds(self.mouse, "Stop"): self.buttonBlock.mouseHover("Stop") # Next elif self.buttonBlock.isInBounds(self.mouse, "Next"): self.buttonBlock.mouseHover("Next") # Directory elif self.directoryBlock.isInBounds(self.mouse): self.directoryBlock.mouseHover() # Handle Mouse Hover event for volume slider elif self.volumeBlock.isInBounds(self.mouse[X], self.mouse[Y]): sliderHovered = True self.volumeBlock.setDrawPercent(True) # Handle Mouse not Hover event for volume slider elif not self.volumeBlock.isInBounds(self.mouse[X], self.mouse[Y]): sliderHovered = False # Handles unhover # Previous if not self.buttonBlock.isInBounds(self.mouse, "Previous"): self.buttonBlock.mouseUnHover("Previous") # Play if not self.buttonBlock.isInBounds(self.mouse, "Play"): self.buttonBlock.mouseUnHover("Play") # Pause if not self.buttonBlock.isInBounds(self.mouse, "Pause"): self.buttonBlock.mouseUnHover("Pause") # Stop if not self.buttonBlock.isInBounds(self.mouse, "Stop"): self.buttonBlock.mouseUnHover("Stop") # Next if not self.buttonBlock.isInBounds(self.mouse, "Next"): self.buttonBlock.mouseUnHover("Next") # Directory if not self.directoryBlock.isInBounds(self.mouse): self.directoryBlock.mouseUnHover() # If slider is not hovered or selected, don't show percent if (not mouseDown and not sliderHovered and not sliderSelected): self.volumeBlock.setDrawPercent(False) # If slider is selected, allow mouse to move slider if sliderSelected: if (self.volumeBlock.isValid(self.mouse[X])): self.volumeBlock.changeSlider(self.mouse[X]) self.musicPlayer.setVolume(self.volumeBlock.getVolume()) # Updates all information and buttons self.screen.blit(self.background, (-360, 0)) self.screen.blit(self.header, (1, 7)) self.screen.blit(self.footer, (0, 312)) self.volumeBlock.update() self.informationBlock.update() self.directoryBlock.update() self.timeBlock.update(self.musicPlayer.getPosition()) self.buttonBlock.update() self.songsBlock.update(self.currentSong) self.screen.blit(self.border, (20,15)) pygame.display.update() self.clock.tick(self.fps) # Loop music if (self.musicPlayer.atEnd()): good = False while not good: try: if (self.currentSong == self.songs.getSongCount() - 1): self.currentSong = 0 else: self.currentSong = self.currentSong + 1 self.changeSong() good = True except: good = False # Clean exit pygame.quit() # Method reads in config file def configFile(self): fileObj = FileHandler(self.directory, "config") configArray = fileObj.read() tokenizer = StringTokenizer(NEWLINE) tokenizer.setString(configArray) # Directory token = tokenizer.getToken() index = token.index('=') + 1 self.musicDirectory = token[index:] # Icon token = tokenizer.getToken() index = token.index('=') + 1 self.iconPath = token[index:] # LastSong token = tokenizer.getToken() index = token.index('=') + 1 self.currentSong = int(token[index:]) # Method saves config file and song list def saveFiles(self): # Rewrite config file string = "Directory=" + self.musicDirectory + NEWLINE + \ "Icon=" + self.iconPath + NEWLINE + \ "CurrentSong=" + str(self.currentSong) fileObj = FileHandler(self.directory, "config") fileObj.write(string, "") # Rewrite songs file fileObj = FileHandler(self.directory, "Songs") string = [] for i in range(self.songs.getSongCount()): path = self.songs.getPath(i) title = self.songs.getTitle(i) string.append(path + "," + title) fileObj.write(string, NEWLINE)
def ab_music(self): Music.music_run(self.userpage)
def __init__(self): gr.top_block.__init__(self, "Musichazelpipkin T") Qt.QWidget.__init__(self) self.setWindowTitle("Musichazelpipkin T") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "musicHazelPipkin_t") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 1e6 self.freq = freq = 2.5e9 ################################################## # Blocks ################################################## self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("addr0=192.168.192.31, addr1=192.168.192.51", "")), uhd.stream_args( cpu_format="fc32", channels=range(4), ), ) self.uhd_usrp_source_0.set_clock_source('external', 0) self.uhd_usrp_source_0.set_time_source('external', 0) self.uhd_usrp_source_0.set_clock_source('external', 1) self.uhd_usrp_source_0.set_time_source('external', 1) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_time_unknown_pps(uhd.time_spec()) self.uhd_usrp_source_0.set_center_freq(freq, 0) self.uhd_usrp_source_0.set_gain(10, 0) self.uhd_usrp_source_0.set_antenna('TX/RX', 0) self.uhd_usrp_source_0.set_center_freq(freq, 1) self.uhd_usrp_source_0.set_gain(10, 1) self.uhd_usrp_source_0.set_antenna('TX/RX', 1) self.uhd_usrp_source_0.set_center_freq(freq, 2) self.uhd_usrp_source_0.set_gain(10, 2) self.uhd_usrp_source_0.set_antenna('TX/RX', 2) self.uhd_usrp_source_0.set_center_freq(freq, 3) self.uhd_usrp_source_0.set_gain(10, 3) self.uhd_usrp_source_0.set_antenna('TX/RX', 3) self.qtgui_number_sink_0 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_HORIZ, 1 ) self.qtgui_number_sink_0.set_update_time(0.10) self.qtgui_number_sink_0.set_title("") labels = ['', '', '', '', '', '', '', '', '', ''] units = ['', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, -1) self.qtgui_number_sink_0.set_max(i, 1) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance(self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_win) self.custom_Arg_to_Complex_0_1 = custom.Arg_to_Complex() self.custom_Arg_to_Complex_0_0 = custom.Arg_to_Complex() self.custom_Arg_to_Complex_0 = custom.Arg_to_Complex() self.blocks_multiply_xx_0_1 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_vff((-1, )) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((-1, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((-1, )) self.analog_const_source_x_0_1 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 4.830) self.analog_const_source_x_0_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 4.765) self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 5.965) self.Music_music_0 = Music.music(4, 30000, 1, 0.06, freq/1e6, 0.01) ################################################## # Connections ################################################## self.connect((self.Music_music_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.analog_const_source_x_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.analog_const_source_x_0_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.analog_const_source_x_0_1, 0), (self.blocks_multiply_const_vxx_0_1, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.custom_Arg_to_Complex_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.custom_Arg_to_Complex_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_1, 0), (self.custom_Arg_to_Complex_0_1, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.Music_music_0, 1)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.Music_music_0, 3)) self.connect((self.blocks_multiply_xx_0_1, 0), (self.Music_music_0, 2)) self.connect((self.custom_Arg_to_Complex_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.custom_Arg_to_Complex_0_0, 0), (self.blocks_multiply_xx_0_1, 1)) self.connect((self.custom_Arg_to_Complex_0_1, 0), (self.blocks_multiply_xx_0_0, 1)) self.connect((self.uhd_usrp_source_0, 0), (self.Music_music_0, 0)) self.connect((self.uhd_usrp_source_0, 1), (self.blocks_multiply_xx_0, 0)) self.connect((self.uhd_usrp_source_0, 3), (self.blocks_multiply_xx_0_0, 0)) self.connect((self.uhd_usrp_source_0, 2), (self.blocks_multiply_xx_0_1, 0))
else: webbrowser.open('http://www.google.com/search?q=') elif query[0] == 'ddg' or query[0] == 'duckduckgo': if len(query) > 1: webbrowser.open('http://www.duckduckgo.com/' + query[1]) else: webbrowser.open('http://www.duckduckgo.com/') elif query[0] == 'find': Finder.find(query[1], plat) elif 'run' == query[0] or 'start' == query[0]: Finder.run(query[1], plat) elif query[0] == 'open': Finder.open(query[1], plat) # pass elif 'music' in query or 'songs' in query or 'song' in query: Music.run_query(query, plat) # elif 'login' in query: # subprocess.call("%USERPROFILE%\Documents\MyCyberoam.py",shell=True) elif 'change' == query[0] and 'wallpaper' in query[1].lower(): BingWallpaper.get_Wallpaper(plat) else: print('Unrecognized command. please consider improving me.')