def main(): #this is creating the mTable m = open("mTable.txt") mtable = [] row = [] rowCount = 0 for line in m: numbers = line.split() for i in numbers: row.append(i) rowCount = rowCount + 1 if rowCount == 16: mtable.append(row) row = [] rowCount = 0 #minuet measures minuet = [] for j in range(16): minuet.append(mtable[random.randint(0, 10)][j]) music = soundwave.Soundwave() for k in minuet: minuetmeasure = soundwave.Soundwave("../Mfiles/M" + str(k) + ".wav") music.concat(minuetmeasure) #creating tTable t = open("tTable.txt") ttable = [] row = [] rowCount = 0 for line in t: numbers = line.split() for i in numbers: row.append(i) rowCount = rowCount + 1 if rowCount == 16: ttable.append(row) row = [] rowCount = 0 #trio measures trio = [] for j in range(16): trio.append(ttable[random.randint(0, 5)][j]) for k in trio: triomeasure = soundwave.Soundwave("../Mfiles/M" + str(k) + ".wav") music.concat(triomeasure) #minuet measures (one last time) for k in minuet: minuetmeasure = soundwave.Soundwave("../Mfiles/M" + str(k) + ".wav") music.concat(minuetmeasure) music.play()
def main() : dur = 0.0612 music = soundwave.Soundwave() vols = [] for i in range(30) : vols = vols + [soundwave.Soundwave(0,dur,i/20)] for w in range(30) : music.concat(vols[w]) for w in range(29,-1,-1) : music.concat(vols[w]) music.play()
def main(): done = False while not done: scale = input( "Give a mode of a scale (major, minor, blues, or quit): ") if scale == "quit": done = True elif scale == "major": t = input("Give an offset number from middle C: ") try: t = eval(t) intervals = [ t, t + 2, t + 4, t + 5, t + 7, t + 9, t + 11, t + 12 ] dur = .3 music = soundwave.Soundwave() notes = [] for i in intervals: notes.append(soundwave.Soundwave(i, dur)) for j in notes: music.concat(j) music.play() except: print("That is not a number") elif scale == "minor": t = input("Give an offset number from middle C: ") try: t = eval(t) intervals = [ t, t + 2, t + 3, t + 5, t + 7, t + 8, t + 10, t + 12 ] dur = .3 music = soundwave.Soundwave() notes = [] for i in intervals: notes.append(soundwave.Soundwave(i, dur)) for j in notes: music.concat(j) music.play() except: print("That is not a number") elif scale == "blues": t = input("Give an offset number from middle C: ") try: t = eval(t) intervals = [t, t + 3, t + 5, t + 6, t + 7, t + 10, t + 12] dur = .3 music = soundwave.Soundwave() notes = [] for i in intervals: notes.append(soundwave.Soundwave(i, dur)) for j in notes: music.concat(j) music.play() except: print("That is not a number") else: print("Not a valid input")
def event(self, event): """Processes events""" if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: globes.stop_music() globes.Globals.STATE = menu.Menu() elif event.key == pygame.K_RETURN: self.paired_door_collision() self.minidoor_collision() elif event.key == pygame.K_RIGHT: self.player1.moveright(True) elif event.key == pygame.K_LEFT: self.player1.moveleft(True) elif event.key == pygame.K_UP: if self.door_num >= 0 \ and self.door_num <= globes.Globals.LVLS_UNLOCKED: self.player1.y_velocity = 0 self.initialize_lvl(self.door_num) else: self.player1.moveup(True) elif (event.key == pygame.K_SPACE): if self.door_num >= 0 \ and self.door_num <= globes.Globals.LVLS_UNLOCKED: self.player1.y_velocity = 0 self.initialize_lvl(self.door_num) elif (not self.player1.killed): sw = soundwave.Soundwave(self.player1.facing, self.player1.rect) self.soundwaves.add(sw) self.move_chair() elif event.key == pygame.K_c: if globes.Globals.LVL_NUM == 5: for i in self.bosses: i.hit() return self.player1.rect.right = self.endS.rect.left + 2 self.player1.rect.top = self.endS.rect.top + \ self.endS.rect.height / 2 elif event.key == pygame.K_LSHIFT or event.key == pygame.K_RSHIFT: self.player1.shift = True elif event.type == pygame.KEYUP: if event.key == pygame.K_RIGHT: self.player1.moveright(False) elif event.key == pygame.K_LEFT: self.player1.moveleft(False) elif event.key == pygame.K_UP: self.player1.moveup(False) elif event.key == pygame.K_LSHIFT or event.key == pygame.K_RSHIFT: self.player1.shift = False
def event(self, event): """Processes events""" if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: globes.stop_music() globes.Globals.STATE = menu.Menu() elif event.key == pygame.K_RIGHT: self.player.moveright(True) elif event.key == pygame.K_LEFT: self.player.moveleft(True) elif event.key == pygame.K_UP: self.player.moveup(True) elif (event.key == pygame.K_SPACE and not self.player.killed): sw = soundwave.Soundwave(self.player.facing, self.player.rect) self.soundwaves.add(sw) elif event.key == pygame.K_c: pass # put cheat code here elif event.type == pygame.KEYUP: if event.key == pygame.K_RIGHT: self.player.moveright(False) elif event.key == pygame.K_LEFT: self.player.moveleft(False) elif event.key == pygame.K_UP: self.player.moveup(False)
def main(): dur = 0.3 music = soundwave.Soundwave() a = soundwave.Soundwave(9, dur) b = soundwave.Soundwave(11, dur) c = soundwave.Soundwave(12, dur) d = soundwave.Soundwave(14, dur) ds = soundwave.Soundwave(15, dur) e = soundwave.Soundwave(16, dur) music.concat(e) music.concat(ds) music.concat(e) music.concat(ds) music.concat(e) music.concat(b) music.concat(d) music.concat(c) music.concat(a) music.concat(a) music.concat(a) music.play()
def main(): note = soundwave.Soundwave(0, 2, 1) note.play()
minuets = open("mTable.txt", "r").readlines() for index in range(len(minuets)): minuets[index] = " ".join(str(minuets[index])) trios = open("tTable.txt", "r").readlines() for index in range(len(trios)): trios[index] = " ".join(str(trios[index])) snippetList = [] def minuetSequence(): for i in range(16): rand = random.randint(0, 10) snippetList.append(minuets[i][rand]) def trioSequence(): for j in range(17, 32): rand = random.randint(0, 5) snippetList.append(trios[j][rand]) mintrio = soundwave.Soundwave("M" + snippetList[0] + ".wav") for x in range(1, 16): mintrio.concat("M" + snippetList[x] + ".wav") for y in range(16, 32): mintrio.concat("T" + snippetList[y] + ".wav") soundwave.play(mintrio)
def main(): dur = 0.3 music = soundwave.Soundwave() c53 = soundwave.Soundwave(0, 3 * dur) db53 = soundwave.Soundwave(1, 3 * dur) eb52 = soundwave.Soundwave(3, 2 * dur) eb53 = soundwave.Soundwave(3, 3 * dur) f53 = soundwave.Soundwave(5, 3 * dur) gb52 = soundwave.Soundwave(6, 2 * dur) gb53 = soundwave.Soundwave(6, 3 * dur) ab52 = soundwave.Soundwave(8, 2 * dur) ab53 = soundwave.Soundwave(8, 3 * dur) bb63 = soundwave.Soundwave(10, 3 * dur) c63 = soundwave.Soundwave(12, 3 * dur) db63 = soundwave.Soundwave(13, 3 * dur) eb63 = soundwave.Soundwave(15, 3 * dur) f63 = soundwave.Soundwave(17, 3 * dur) f61 = soundwave.Soundwave(17, 1 * dur) gb6h = soundwave.Soundwave(18, dur / 2) ab6h = soundwave.Soundwave(20, dur / 2) ch1 = db53.plus(gb53).plus(bb63).plus(db63) ch2 = eb53.plus(ab53).plus(c63).plus(eb63) ch3 = eb52.plus(gb52).plus(ab52) ch4 = c53.plus(f53).plus(ab53).plus(c63).plus(eb63) ch5 = f53.plus(bb63).plus(db63).plus(f63) ch6 = db53.plus(gb53).plus(bb63).plus(db63) ch7 = c53.plus(eb53).plus(gb53).plus(ab53) music.concat(ch1) music.concat(ch2) music.concat(ch3) music.concat(ch4) music.concat(ch5) music.concat(ab6h) music.concat(gb6h) music.concat(f61) music.concat(ch6) music.concat(ch2) music.concat(ch7) music.play()
def main(): snippet = soundwave.Soundwave("../Mfiles/M55.wav") snippet.play()
import soundwave import sys intervals = [[2, 2, 1, 2, 2, 2, 1], [2, 1, 2, 2, 1, 2, 2], [3, 2, 1, 1, 3, 2]] startNote = sys.argv[1] if sys.argv[2] == "M": scaleSet = intervals[0] elif sys.argv[2] == "N": scaleSet = intervals[1] elif sys.argv[2] == "B": scaleSet = intervals[2] aggregateHalftones = startNote theScale = soundwave.Soundwave(startNote, 0.5, 1, 44100) for note in range(len(scaleSet)): aggregateHalftones += scaleSet[note] newNote = soundwave.Soundwave(startNote + aggregateHalftones, 0.5, 1, 44100) theScale.concat(newNote) soundwave.play(theScale)