1st CSCI EXAM

1st CSCI EXAM - window.setCoords(0,-32000,999,32000) for...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 st CSCI EXAM: Things to know: Read WAV files: song=readwave(“name.wav”).getLeft() song=list(readwave(“name.wav”).getLeft() for i in range(10): print song[i] Read txt files: noteFileName=raw_input(“What files are the ___ in?” ) noteFile=open(noteFileName, ‘r’) for line in notefile: print line noteFile.close() Make a sound louder or softer: softerSong=[.5*e for e in song] for i in range(10): print softerSong[i] softerSong= < 1 louderSong= >1 Play two sounds together: newSong=[sound1[i] +sound2[i] for i in range(len(sound1))] Play one sound after another: newSong=sound1+sound2 Make Silence: secondOfSilence=int(1*44100)*[0] Plot points: window=Graphwin(“Sound Visualizer”,1000,500)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: window.setCoords(0,-32000,999,32000) for col in range(1000): index=int((col/999.0)*(len(sound)-1)) Point(col,sound[index]).draw(window) x1=window.getMouse().getx() x2=window.getMouse().getx() Check for letters in a file: for line in file: for letter in line: if letter==C: freq=261.63 elif letter==D: freq=293.66 else:freq=0 for line in file: if line[0]==X print found X Accumulate a song from separate tones: LENGTH=0.5 chord=int(LENGTH*44100)*[0] tone=[10000*sin(i*freq*2*pi/44100) for i in range(int(LENGTH*44100))] chord=[chord[i]+tone[i] for i in range(int(LENGTH*44100))] song=song+chord...
View Full Document

This note was uploaded on 04/02/2008 for the course CSCI 1300 taught by Professor Lewis,clay during the Spring '08 term at Colorado.

Page1 / 2

1st CSCI EXAM - window.setCoords(0,-32000,999,32000) for...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online