Write a function to set values that are greater than 0 to the maximum positive value (32,767) in a sound, but leave all the negative values the same. Can you still understand any words in the sound?
What will be an ideal response?
```
def allPositiveMax(fileName):
sound = makeSound(fileName)
for sample in getSamples(sound):
value = getSampleValue(sample)
if (value>0):
setSampleValue(sample ,32767)
play(sound)
```
While the sound is now exceptionally grainy, the words are all clearly understandable.
Note: One could pass in a sound or a filename for this question. The important part is checking whether a value is positive and doing a specific operation based on that.
Computer Science & Information Technology
You might also like to view...
A disk _______ speeds up hard drive data access
Fill in the blank(s) with correct word
Computer Science & Information Technology
Many firewalls block ICMP packers, so ping scans are often unsuccessful
Indicate whether the statement is true or false.
Computer Science & Information Technology