CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä...

20
CompSci 001 5.1 Today’s topics Sound Upcoming Sound splicing Intellectual property Network analysis Reading Introduction to Computing & Programming in Python: Chapters 6, 7

Transcript of CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä...

Page 1: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.1

Today’s topics

Sound

Upcoming Sound splicing Intellectual property Network analysis

ReadingIntroduction to Computing & Programming in

Python: Chapters 6, 7

Page 2: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.2Georgia Institute of Technology

How does Hearing Work?

The outer ear “catches” sounds The eardrum vibrates The inner ear translates the vibrations to nerve

impulses for the brain to interpret

Page 3: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.3Georgia Institute of Technology

Acoustics, the physics of sound Sounds are

waves of air pressure Sound comes in

cycles The frequency of a

wave is the number of cycles per second (cps), or Hertz• (Complex sounds

have more than one frequency in them.)

The amplitude is the maximum height of the wave

Page 4: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.4Georgia Institute of Technology

Volume and Pitch

Our perception of volume is related (logarithmically) to changes in amplitude If the amplitude doubles, it’s about a 3 decibel (dB)

change. A decibel is a ratio between two intensities: 10 *

log10(I1/I2) As an absolute measure, it’s in comparison to

threshold of audibility• 0 dB can’t be heard. • Normal speech is 60 dB. • A shout is about 80 dB

Our perception of pitch is related (logarithmically) to changes in frequency Higher frequencies are perceived as higher pitches We can hear between 5 Hz and 20,000 Hz (20 kHz) A above middle C is 440 Hz

Page 5: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.5Georgia Institute of Technology

Digitizing Sound In calculus you

learn to estimate a curve by creating rectangles

We can do the same to estimate the sound curve Analog-to-digital

conversion (ADC) will give us the amplitude at an instant as a number: a sample

How many samples do we need?

Page 6: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.6

What is digital? What’s the difference between

Phonograph and CD? VCR tape and DVD?

Why digitize sound?

How is ripping to a mp3 different from recording to a tape? Reproduction: immediate and future Distribution Modification

Why do digital media present new challenges from analog media? Is copyright infringement new?

Page 7: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.7

Nyquist Theorem We need twice as many samples as the maximum

frequency in order to represent (and recreate, later) the original sound.

The number of samples recorded per second is the sampling rate If we capture 8000 samples per second, the

highest frequency we can capture is 4000 Hz• That’s how phones work

If we capture more than 44,000 samples per second, we capture everything that we can hear (max 22,000 Hz)• CD quality is 44,100 samples per second

Call a friend on a phone and play some music over the phone How does it sound? Why does it work for voice but not for music?

Page 8: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.8Georgia Institute of Technology

Playing a Sound We can create a Sound object just as we created

a Picture object Get a file name and save a reference to it

– Pick a file that ends in .wav Create the sound object by asking the class to

create a new Sound object and initialize it by reading data from the given file name• sound1 = makeSound(fileName);

Play the Soundplay(sound1);

Page 9: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.9Georgia Institute of Technology

Play Sound Exercise Try creating a Sound object and

playing it by Specifying it in steps Specifying it all at once

How would you play the same sound twice?

Page 10: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.10Georgia Institute of Technology

Digitizing Sound in the Computer

Each sample is stored as a number (two bytes)

What’s the range of available combinations? 16 bits, 216 = 65,536 But we want both positive and negative values

• To indicate compressions and rarefactions. What if we use one bit to indicate positive (0)

or negative (1)? That leaves us with 15 bits 15 bits, 215 = 32,768 One of those combinations will stand for zero

• We’ll use a “positive” one, so that’s one less pattern for positives so the range is from -32,768 to 32,767

Page 11: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.11Georgia Institute of Technology

The Sound Tool Not all of the

sound is shown when you explore a sound Skips values to fit

in the window You can zoom in

To see all sample values

You can zoom out To fit the sound in

the window again

Page 12: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.12Georgia Institute of Technology

Getting the Sound Sample Values

A Sound has many values in it Numbers that represent the sound at that time

in the sample You can get an list of SoundSample objects

samples = getSamples(sound1);

Page 13: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.13Georgia Institute of Technology

Print the Sound Sample Value

You can get the SoundSample object from the list at an index sample = samples[0];

And then get the value from that print sample

What are the first 10 values of the Sound created from the file croak.wav?

Page 14: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.14

You can set the value of a SoundSample setSample(sample, value); This will change the value in the Sound object

as well So how would you change the value of the

first sample to the original value * 2?

How could you double all of the samples? By hand?

• How many samples are there? Using a loop?

Georgia Institute of Technology

Changing the Value of a Sound Sample

Page 15: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.15Georgia Institute of Technology

Tracing Execution The index is set to 0 The value is set to

the value in the array at that index (59)

The sample value at the current index is set to 2 * value

The index changes to the next index (1)

We check if the index is less than the length of the array and If so do the loop again Else jump to the first

statement after the loop

Page 16: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.16Georgia Institute of Technology

Memory versus Disk

When we read from a file we read from disk into memory Computers only do calculations on memory

We change the values in memory The file on the disk hasn’t changed To save our new sound we need to write a file to

the disk writeSoundTo(sound1, fileName);

Page 17: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.17Georgia Institute of Technology

Copyright US Constitution (Article I, Section 8, Clause 8):

“To promote the Progress of Science and useful Arts” What can you copyright?

• Fixed, tangible medium of expression with a modicum of originality

How do you copyright?• Don’t need anything. Registration necessary for copyright

infringement suits Authors given limited monopoly so they will disclose to

public Concessions

1. Fair use2. First sale3. Limited Time

Evolving Bargain: Copyright holder may profit from works and public has access and can build upon them

What would happen if information could only be shared if the owner provided permission?

Page 18: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.18Georgia Institute of Technology

Fair use

Use copyrighted works without permission if the use does not unduly interfere with the copyright owner’s market for a work

Include personal, noncommercial uses 4 prong test

1. Purpose and character of use (commercial vs. non-profit or educational)

2. Nature of copyrighted work3. Amount and substantiality of the portion used4. Effect of the copying upon market

Example: using a VCR to time-shift a broadcast program

Reverse engineering OK when extracting unprotected elements Connectix Virtual PlayStation

Page 19: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.19Georgia Institute of Technology

Digital rights management

Idea: copying is hard to control, so make the copying process itself difficult Restrict the use of digital files in order to protect

interest of copyright holders Control file access Implemented in operating system, program

software, or in the actual hardware of a device Digital watermarking

Make information so that unauthorized copying can be detected

Serial Copy Management System (Audio Home Recording Act 92)

Dystopian and utopian results? Privacy issues?

Page 20: CompSci 001 5.1 Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.

CompSci 001 5.20Georgia Institute of Technology

Test Case

Artist Def Jeff creates a new song that includes a four-bar percussion sample from a Rolling Stones song. He uses the sample without receiving permission from the copyright holder, His DJ overlays the track containing the sample with 40 tracks of original music and puts the song on his latest CD.

Were Def Jeff’s actions within the limits of fair use?

Would he lose a lawsuit? Were his actions ethical?