Quick Exercise What kind of sound does this method ... public Sound - - PowerPoint PPT Presentation

quick exercise
SMART_READER_LITE
LIVE PREVIEW

Quick Exercise What kind of sound does this method ... public Sound - - PowerPoint PPT Presentation

Quick Exercise What kind of sound does this method ... public Sound makeSound1( int seconds ) { int length = framesFor(seconds); Sound result = new Sound( length ); for (int i = 0; i < length; i++ ) result.setSampleValueAt( i, X );


slide-1
SLIDE 1

Quick Exercise

What kind of sound does this method ...

public Sound makeSound1( int seconds ) { int length = framesFor(seconds); Sound result = new Sound( length ); for (int i = 0; i < length; i++ ) result.setSampleValueAt( i, X ); return result; }

... produce for these values of X: i 10*i i*i

slide-2
SLIDE 2

Open Problem #1

Eugene the Chipmunk

slide-3
SLIDE 3

Changing a Sound's Frequency

How can we recreate the top curve?

slide-4
SLIDE 4

Solution #1

slide-5
SLIDE 5

Solution #2

slide-6
SLIDE 6

Open Problem #2

Negating an image was easy. We inverted an image, but...

slide-7
SLIDE 7

Exercise

Let's try inverting at the middle value between the maximum and minimum values, rather than at 0. Write Java statements to...

  • 1. ... find that midpoint.
  • 2. ... for a given sample in slot i,

find the corresponding value

  • n the other side of the midpoint.

You may assume the existence of methods maximumValue() and minimumValue().

slide-8
SLIDE 8

Ack!

Still no change in the sound.

slide-9
SLIDE 9

Ack!

Still no change in the sound

BECAUSE

still no change in shape of waves!

slide-10
SLIDE 10

Last Exercise for a While

Write a method called reverse() that creates a new sound, copies this into, but in reverse order, and returns the new sound as its answer.

slide-11
SLIDE 11

Upcoming Days

THU Finish reading Chapter 9. Begin work on Homework 5. TUE No class — Mike Volz in the lab WED Lab as usual — bring headphones THU No class — Mike Volz in the lab TUE Submit Homework 5. Read Chapter 10.