Question: # 4. Write a function to make a new list made up of every element in the # original list with the value of new
# 4. Write a function to make a new list made up of every element in the # original list with the value of new elements set to be within a certain range. # If an element is greater than clip_level, then the element should be set to clip_level. # If an element is less than -clip_level, then the element should be set to -clip_level. # This means that all the new element values should be -clip_level <= value <= clip_level. # For example, if original_samples is [-5, -1, 2, 5, 10] and clip_level is 4, then # the new list would be [-4, -1, 2, 4, 4] (-5 5 and 10 were clipped to the allowed range. # As a hint, use if statements to see if a value is to high or too low. # Return the new list. # Clipping happens in sound when recording equipment cannot capture the full range # of volume the sound makes. The loudest sound gets clipped, or set to that maximum # volume. This function makes the original sound become clipped to an artificially low # level. def make_clipped_samples(original_samples, clip_level): # Add code to make the function work as specified. return [] # Replace this line with your own code
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
