Rewrite increase volume so that it takes two inputs: a sound to increase in volume and a multiplier. Use the multiplier as how much to increase the amplitude of the sound samples. Can we use the same function to both increase and decrease the volume? Demonstrate commands that you would execute to do each.

What will be an ideal response?


```
def increaseVolume(sound, multiplier):
for sample in getSamples(sound):
value = getSampleValue(sample)
setSampleValue(sample ,value * multiplier)
```

Yes you can use the same method to increase and decrease the volume. Values above 1 will increase the sound, while values below 1, but above zero will decrease the sound.
Increase Sound: increaseVolume(sound, 2)
Decrease Sound: increaseVolume(sound, 0.5)

Computer Science & Information Technology

You might also like to view...

A(n) ________ provides a method for unidirectional communication between one server process and many client processes.

a) named pipe b) unnamed pipe c) region of shared memory d) mailslot

Computer Science & Information Technology

In Access, macros can be created using the Macro Builder

Indicate whether the statement is true or false

Computer Science & Information Technology

Match each item with a statement below.

A. Computers with two network adapters B. A combination of hardware and software that is used to detect malicious traffic on a network, such as a denial of service attack, worms, and network-based exploits C. Can be used to combine the bandwidth of two network adapters D. The ability of a computer or a computer network to keep operating in the event of a hardware failure E. The process of making a server more secure by turning off un-necessary protocols and services, applying up-to-date patches, and securing the applications that run on the server

Computer Science & Information Technology

A __________ attack occurs when an attacker continually bombards a wireless access point or some other accessible wireless port with various protocol messages designed to consume system resources.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology