CS 111 Lecture 12: LabNotes3 Decrease the pitch of a sound

48 views2 pages
30 Nov 2016
School
Course
Professor

Document Summary

Def main(): fname = pickafile() s1 = makesound (fname); soundresult = increasepitch ( s1 ) explore (soundresult) def increasepitch ( sound ): # get a samplem list from the sound and the total number of samples samplelist = getsamples(sound) length = getlength(sound) sresult = makeemptysound ( length/2 ) sresultlength = getlength(sresult) sresultlist = getsamples(sresult) # loop for all samples in the sound for i in range (0, sresultlength): # access the sample from position i in the sample list origi = i * 2 sample = samplelist[origi] # store the new amplitude value back into the sound modi = i rsample = sresultlist[modi] setsamplevalue (rsample, value) return sresult def reverse ( sound ): # get a samplem list from the sound and the total number of samples samplelist = getsamples(sound) length = getlength(sound) sresult = makeemptysound ( length ) sresultlist = getsamples(sresult)

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Questions