New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Intro Media Computation

by: Alayna Veum

Intro Media Computation CS 1315

Alayna Veum

GPA 3.81


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in ComputerScienence

This 0 page Class Notes was uploaded by Alayna Veum on Monday November 2, 2015. The Class Notes belongs to CS 1315 at Georgia Institute of Technology - Main Campus taught by Staff in Fall. Since its upload, it has received 7 views. For similar materials see /class/234117/cs-1315-georgia-institute-of-technology-main-campus in ComputerScienence at Georgia Institute of Technology - Main Campus.

Similar to CS 1315 at

Popular in ComputerScienence


Reviews for Intro Media Computation


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 11/02/15
651315 Introduction to Media Computation Sound 2 Sound volume Sound manipulations 39 1 Advanced Sound I Increasing and decreasing volume Clipping I Splicing sounds and echo effects I Processing parts of sounds Sample indexing I Playing sounds backward Copying samples I Changing pitch of sounds Sampling Decreasing the volume def decreaseV olume sound for sample in getSamples sound value getSample sample setSample sample value 05 I Try this with any sound I Use openSoundT 001 from the command pane to play a sound and View its waveform Recipe to Increase the Volume def increaseV39olume sound for sample in getSamples sound value getSample sample setSample sample value 2 Turn your computer s volume down before playing this Recognize some similarities I or n in value getSample sample ltgt value getRed p setSample sample value 0 5 setRedp value 0 5 V for 3 for n in value getsample sample 4 value getRed p satsample sample value 3 setRed p value 18 But What if the sound now has Ivaluel gt 32k Maximizing volume I How do we get maximal volume I It s a threestep process nd the current loudest Value largest sample nd how much we can increasedecrease that Value fill the available space I We Want to nd the ampli cation factor amp Where amp loudest 32 767 I In other Words amp 327 6 7loudest amplify each sample by multiplying it by amp Maxing normalizing the sound def 110111131153 sound This 100 nds the loudest largest 0 value for s in getSamples sound largest getSample s ampli cation 387670 4 largest NWquot Refd 393 quot Integer dIVIslun print quotLargest sample value in original sound wasquot largest print quotAmpli cation multiplier isquot ampli cation for s in getSamples sound lo er ampli cation getSample s setSample s louder This 00 actually ampli es the sound 39 max I maxO is a function that takes any number parameters and returns the largest I There is also a function minO which works similarly but returns the minimum 39 it Or use if instead of max def normalize sound Check 2 h 39 largest 0 an In turn to see if it s the largest so far gest print Largest sample value in original sound wasquot largest print quotAmpli cation factor isquot ampli cation for s in getSamples sound louder ampli cation getSample s setSample s louder for s in getSamples sound Aside positive and negative extremes assumed to be equal I We re making an assumption here that the maximum positive value is also the maximum negative value That should be true for the sounds we deal with but isn t necessarily true I Try adding a constant to every sample That makes it noncyclic l Ie the compressions and rarefactions in the sound wave are not equal But it s fairly subtle what s happening to the sound 39 Avoiding clipping I Why are we being so careful to stay within range What if we just multiplied all the samples by some big number and let some of them go over 32767 I The result then is clipping Clipping The awful buzzing noise whenever the sound volume is beyond the maximum that your sound system can handle Making more complex sounds I We know that natural sounds are o en the combination ofmultiple sounds I Adding waves is easy Simply addthe samples at the same index in the two waves You may need to normalize both first to avoid clipping Dr instead of adding the sounds you can average them for srcSample in range 1 getLength source 1 destValue getSampleValueAt dest srcSample srcValue getSampleValueAt source srcSa ple m setSampleValueAt source srcSample rcValuedestValue D Adding sounds The rst two are sine waves generated in Exce The third is just the sum of E the rst two columns Uses for adding sounds I We can mix sounds We even know how to change the volumes ol the two sounds even over time eg lading in or lading out I We can create echoes i Just add a sound to itsell after a delay Or do this multiple times with the later copies at reduced amplitude I We can add sine or other Waves together to create kinds of instrumentssounds that do not physically exist but Which sound interesting and complex 39 o A function for adding two sounds def addSoundInto sound 1 sounds for ssmpleNmr in range 1 getLength sound 1 1 sample 1 getSampleVslueAt sound 1 sampleNmr p setSampleValueAt sounds sampleNmr samplel samples Notice that this adds soundl and sound by adding soundl inta sound2 Adding sounds with a delay def mksmwrdcsoundl sound2 sounds for index in rongea getLengtheound1 s ISImple gesSomplevuuemeound1 index it index gt 1000 sasnmple getsumpleVIllleAthoundz index 1000 in ow 533 1 it index gt 2000 sasnmple getSompievuuemeounds index 2000 inn 533 Note that in this sAdd ln sound2 after 1000 samples version were sAdd in sound3 after 2000 samples adding into soundl Processing only part of the sound I What if we wanted to increase or decrease the volume of only part of the sound I Q How would we do it I A We d have to use a range function with our for loop Just like when we manipulated only part of a picture by using range in conjunction with getPixels Knowing where we are in the sound I More complex operations require us to know where we are in the sound which sample Not just process all the samples exactly the same I Examples Reversing a sound It s just copying amplitude from one location in the sound to another changing the frequency of a sound Copying every nth sample cornpresses the mve amp so increases pitch Splicing sounds Adding sounds to asound canvas Increasing volume by sample index def increaseVolumeByRange sound for sampleNumber in range 1 getLengthsound 1 1 value quot 1 sound value 2 This really is the same as def increaseV39olume sound for sample in getSamples sound value getSample sample setSample samplevalue 2 Recipe to play a sound backwards Trace it def playBackward lename on s rce makeSound lename dest makeSound lename Start at end of sound srcIndex getLengtlL source w rainfall dean 1 srcSample getSampleValueAt source srcIndex setSampleValueAt dest destIndex srcSample srcIndex srcIndex Work backward return den Return the processed sound for further use in the function that calls playBackWard How does this work Starting out 3 samples here def playBaekwardmlename We make two copies ofthe sound mm makeSWHdmlenme I quot L 4 C 1 to the end dest makeSoundUilename I Each time through the loop we copy the sample value from the srcIndex to the destmdex You are here srcIndex getLenglMsource for destlndex m mgeu getLengtldest 1 def Phynukmwemm srcSample getSam 1eVa1ueAtsouree sreIndex N019 Huh 0 maksnd 1nam setSampleValueAudest destIndex srcSample dastIndax ls dest makeSoumr lename sreIn ex srelndex 1 increasin b 1 each time thr 01f hyme 100 snlndex getLeng msome Mum dest g P for destlndex in mge getLengddest 1 but srcIndax IS srcSample getSampleValueAdsome snlndex decreasing by 1 each setSampleValueAttdesg destlndex srcSamp e methmugh me 100p snlndexsnlndexl return dest source dest Ready for the copy Do t he copy def playnae kwad 1ename def playnae kwad 1ename some makeSound lename some make und 1eame dest make Sonnd lename dest make Sound lename snlndex getLengcmsome snlndex getLengdsome for destlndex in mngeu getLeng 1dest 1 You are here for destlndex in mngea getLeng 1dest 1 m Sample getSampleValueAdsome snlndex m Sample getSampleVaJueAdsome snlndex setSampleValueAddest destlndex srcSamp e setSamyleVaJueAddest destlndex src Sample Y are here n1ndexsnlndex l n1ndexsnlndex 1 return dest return dest sreIudex destIndex sreIudex destIndex snurce dest source dest Ready for the next one defplayBMkwaxd lename some makeSound lename dest make Sound lename mlndex getLengtl1soune or destlndex in mngea getLengthdest 1 m Sample geeSempleValueAmme mlndex seeSempleValueAwese destlndex src Sample m Index srcIn 1 Ynu are here return dost sreIndex destIndex snuree dest How we end u p def playBMkwaxd lename some makeSound lename dost makeSonnd lename mlndex getLengtMsource for destlndex in mngeu getLengthdest 1 m Sample etSam leValue somem1ndex seeSempleValueAwesg destlndex srcSamp e e d d x 1 In ex snln e return dest You are here sreIndex destIndex snuree dest Moving them together def playBMkwaxd lename some makeSound lename dest make Solmdlilename mlndex getLengthsource or destlndex in mngeu getLengthdest 1 You are here m Sample geeSempleValueAqsome mlndex seeSemyleValueAwese destlndex src Sample m Index mlndex 1 return do st sreIndex destIndex snuree dest Recipe for halving the frequency of a sound This is hnw a sampling synthesizer def half lename s me k So our ma 3 Imd lename dest makeSoImd lename smIndex 1 for destIndex in range 1 getLength dest 1 Sam 3 getSampleV neAt souroe int dex setSampleValueAtdest destIndex srcIndex 51 Intim PlSk IOiest Here are the return dest pieces that do it samp e Recipe to double the frequency Of a sound Here s the critical piece deg doublemlenme We skip every other Source mll eS llMC JBnlm0 sample in the source target makesauml lename targetlmlex 1 for sourcelndex in range1 getLengthQsource 1 7 value getsampleanueAthource sourcelndex setsampleValueAt target targetlmiex value targetlndex targetlmlex 1 o Eros are silent for seamlde in ruge getLeng th target3 genengnm target setsampleanueAttarget targetlndex o hrgetlndex targeuuae l pWCmg return target What happens if we don t quotzero outquot the end Try this out def double lenune source makesouml lenune target makesolmd mename hrgetlndex l for sourcelndex in rangel getLengthsource1 2 value getsunpleValueAtho urce sourcelndex setsampleValueAt target targethulex value targetlndex targetmdex l nor seamlde in range gemength target 2 getLength target it setSampleValueAttargettargetlualexo it targeuudex targetlmlex l PWC H E Switch aft these lines 0f return target cmle by cammentlng them nut 39 I Splicing Sounds l Splicing gets its name from literally cutting and pasting pieces of magnetic tape together I Doing it digitally is easy in principle but painstaking I Say we want to splice pieces of speech together Use SnundTnnl to find the end points of w nrds n Copy the samples into the right places to make the words come out as w w We can also change the volume of the words as we move them to increase or decrease emphasis and make it sound more natural Now it s all about copying I We have to keep track of the source and target indices srcIndex and destIndex destIndex Wheretheincnmingsnundshnuldstart fur srcIndex in rangestartinanint endinanint sampleValue getSampleValueAMsnurce srcIndex setSampleValueAt iest destIndex sampleValue destIndex destIndex 1 CS 1315 Final Review The final is cumulative This review is a good guideline to what topics will be covered There will be 3 review sessions over the next week where TA s will solve this and answer questions Details are posted on the coweb Answers will not be posted If you have questions please post on the coweb or visit a TA s office hours or go to a review session PICTURES Write a function that takes in a picture and sets all the blue values of a pixel to 0 if the red value of that pixel is greater than 100 2 Write a function that creates an empty canvas of size 500x500 and makes the right half of the picture black 3 Write a function that takes in a picture and returns the negative of that picture 4 Write a function that takes in a picture and grayscales it 5 Theory a If a picture is composed of rgb values why don39t we see red green and blue spots at every position in our picture b Why is the maximum value of any color channel 255 SOUNDS 6 Write a function to increase the volume of a sound doesn39t matter by how much 7 Write a function that takes in a sound and silences the third quarter 8 Write a function that takes in a sound and reverses it 9 The following function doubles the frequency of a sound def doubleFreqfilename source makeSoundfilename target makeSoundfilename srcIndex l for targetlndex in rangelgetLengthsource2z this value getSampleValueAtsourceintsrclndex setSampleValueAttargettargetlndexvalue srcIndex srcIndex 2 return target Why does the line marked quotthisquot only go from 1 to getLengthsource2 Why doesn t it go all the way to getLengthsource m wsntmssxamwswntEha lf39mlmemmthatratumsthi lsfhaUthEmvmsmm s nws dawn m haw wt dngmamedmmy Moms 9 RememharhxspartafthemnwemugWhat nesxt n dzi wxlceanmELrum dummy fxamEplc menumsmudmw u dud lt m mmymmwdmmepm dummy quotfoame quot framenum quotqu39w u dud gt m and mud lt mu mmmmammmm dummy quotHirame quot framenum quotWUH39W u dud gt mu mmydcmmmmepm dummy quotfoamequot framenum quot1de 1n Wntea mmnnth and n 5 Wm make 1w frameswhxth maves a renang efmm E tn mm The m framsx a me 34mm mermangxesndmdsmamm n mnvaSer sDar The wmthnfthe rettang exsw anathehaghhslw ttanheanvm nr m an thavatnwnta hsframss mumsum 11 Wnteamnmnnthattakesml strmgsan thetksxfthev asttharansrsariinua fthivare 2mm nntatenatethe 1 52m and ramm n w nm return ha revarsa nfthe rst strmg 11 Wm H mnmm aHe amen Wm nntatanatastha rst and 35 mm m ha 52mg and mum ram 1 Wnteafunmnnthata samhenumbersmahst 1 mmgavdmmv 1 Usmgrsmm n MODULES mm wwwa 14 mnsx srthifnhwmgadsthatwasmnmthsmmman arsaDUES gtgtgt mm a 7 le ileiuu Asvmm thinvih nmszismannthDmkAanzvnin mzvzwismzismnzmzmw mm mm 4m mum mmg My mm mm anmg may m2 u m bay Whitmnbimimmitmn mm m EXDEEIID mm wvw Wm m um meinunwmg mmmin nzxt mman 15 wmzamnmnmhauakzsmamvznbwand tmmumz numbzv Mum125m w Wmvzshivz m 2 2mm mg m we 15 sza mmtinszWmEnwmthnkzsmimvztmw Thzwnmnnshwmtvzitzimz mg ann 2 mnn WNW at D Dzskmp and 5mm Wm m mg quotmp wmmquot mmm kzcuksmN 17 whimmhzianwmgvztvvwzmnnmnmw xeunn 1 Clscxxn l mm m Whitmimmitmngbzs b2m22nltmmban ltmmgtgt 1a Whitmimmitmn gm bzthzn ltbbdvgtin 4mm 20 hammmmmmxmmmmmbnmmwmmnwmpwma g OOP 21 What39s the difference between an instance and a class 22 How are functions and methods different 23 How is objectoriented programming different from procedural programming 101110101101101110101101 24 For each of the below see if you can figure out the representation in terms of bits a Internet addresses are four numbers each between 0 and 255 How many bits are in an Internet address b In networking computer port numbers range from 1 to 65536 How many bits are needed to represent a port number c Each pixel39s color has three components red green and blue each of which can be between 0 and 255 How many bits are needed to represent a pixel39s color TRACING 25 Give the output for the following function when it is run with gtgtgt check7 def checkvalue for i in range1 value if i 5 gt value print quotTruequot 26 Give the output for the following function when it is run with gtgtgt output120 3 12 def output1num1 num2 num3 count 0 if numl lt 20 and num2 gt 10 print quotlst onequot strnum1 10 for i in range1 numl 3 count 1 count 2 print count print count num3 TURTLES 27 If we do ask this it ll be something that involves tracing the path of the turtle SPEED NETWORKING 28 If there are slides posted on Speed on the coweb go over that If not don t worry about it


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Amaris Trozzo George Washington University

"I made $350 in just two days after posting my first study guide."

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.