Problems


[Page 289 (continued)]

8.1

What are each of the following:

  • Clipping

  • Normalize

  • Amplitude

  • Frequency

  • Rarefactions

  • WAV

  • Iterate

  • for-each loop

  • A sine wave

8.2

Modify Program 65 (page 272) to use a for loop. If you are using Java 1.5 or above modify it to use a for-each loop.

8.3

If you are using Java 1.5 or above modify Program 7 (page 108) to use a for-each loop.

8.4

In Section 8.3.1, we walked through how Program 65 (page 272) worked. Draw the pictures to show how Program 66 (page 277) works, in the same way.

8.5

Create a new method that will halve the volume of the positive values and double the volume of the negative values. You can use Program 65 (page 272) as a starting point.

8.6

What will be output from the following code:

public void test1() {   int x = 0;   while (x < 3)   {      x = x + 1;      System.out.println(x);   } }



[Page 290]
8.7

What will be output from the following code:

public void test2() {   int x = 3;   while (x > 0)   {      x = x + 1;      System.out.println(x);   } }


8.8

What will be output from the following code:

public void test3() {   int x = 2;   while (x >= 2)   {      x = x + 1;      System.out.println(x);   }   System.out.println("x is " + x); }


8.9

What will be output from the following code:

public void test4() {   int x = 2;   int y = 0;   while (x < 10 && y < 1)   {      x = x + 1;      y = y + 1;      System.out.println(x + ", " + y);   } }


8.10

What will be output from the following code:

public void test5() {   int x = 2;   int y = 0;   while (x < 10 || y < 1)   {      x = x + 1;      y = y + 1;      System.out.println(x + ", " + y);   } }


8.11

What will be output from the following code:

public void test6() { 
[Page 291]
int x = 12; int y = 0; while (x < 10 && y < 1) { x = x + 1; y = y + 1; System.out.println(x + ", " + y); } }


8.12

What will be output from the following code:

public void test7() {   int x = 12;   int y = 0;   while (x < 10 || y < 1)   {      x = x + 1;      y = y + 1;      System.out.println(x + ", " + y);   } }


8.13

What will be output from the following code:

public void test8() {   int x = 12;   int y = 0;   while (x !< 10 || y < 1)   {      x = x + 1;      y = y + 1;      System.out.println(x + ", " + y);   } }


8.14

What will be output from the following code:

public void test9() {   int x = 12;   int y = 0;   while (!(x < 10 || y < 1))   {      x = x + 1;      y = y + 1;      System.out.println(x + ", " + y);   } }


8.15

What will be output from the following code:

public void test10() { 
[Page 292]
int x = 2; int y = 0; while (!(x < 10 && y < 1)) { x = x + 1; y = y + 1; System.out.println(x + ", " + y); } }


8.16

In method normalize on page 281, we found the largest value in the sound. Write a method that will find the smallest value in the sound and print it out.

8.17

What happens if you increase a volume too far? Explore that by creating a Sound object, then increase the volume once, and again, and again. Does it always keep getting louder? Or does something else happen? Can you explain why?

8.18

Instead of multiplying samples by a multiplier (like 2 or 0.5), try adding a value to them. What happens to a sound if you add 100 to every sample? What happens if you add 1,000 to every sample?

8.19

Try sprinkling in some specific values into your sounds. What happens if you set the value of a few hundred samples in the middle of a sound to 32,767? Or a few hundred -32,768? Or a bunch of zeroes? What happens to the sound?

8.20

Open up the SONOGRAM view and say some vowel sounds. Is there a distinctive pattern? Do "Oh's" always sound the same? Do "Ah's"? Does it matter if you switch speakersare the patterns the same?

8.21

Get a couple of different instruments and play the same note on them into MediaTool application's sound editor with the sonogram view open. Are all "C's" made equal? Can you see some of why one sound is different than another?

8.22

Try out a variety of WAV files as instruments, using the piano keyboard in the MediaTools application sound editor. What kinds of recordings work best as instruments?



Introduction to Computing & Programming Algebra in Java(c) A Multimedia Approach
Introduction to Computing & Programming Algebra in Java(c) A Multimedia Approach
ISBN: N/A
EAN: N/A
Year: 2007
Pages: 191

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net