Write a function that inputs a frequency, a maximum amplitude, a percentage of blend (e.g., 0.25 to represent 25%), and length in seconds. Create two sounds, one a square and one a triangle, using the same inputs. Add the sounds together, with the blend percentage of the square and 100—blend of the triangle. How does the sound change if you try 0.25, 0.5, and 0.75 as the blend percentages?
What will be an ideal response?
The sounds don’t sound all that different with different blend percentages, they largely just sound louder the larger the percentage gets. However, the sound also does sound more “warbly” with the lower blend percentages, as there’s more of a difference between the two sounds.
```
def combineShapeSounds(freq, amplitude, percentBlend, seconds):
square = squareWave(freq, amplitude, seconds)
triangle = triangleWave(freq, amplitude, seconds)
canvas = makeEmptySoundBySeconds(seconds)
for index in range(0, getLength(canvas)):
triSample = getSampleValueAt(triangle, index)
squareSample = getSampleValueAt(square, index)*percentBlend
newSample = triSample + squareSample
setSampleValueAt(canvas, index, newSample)
play(canvas)
return canvas
```
You might also like to view...
The “per inch” in the units dots per inch and pixels per inch is in _____.
A. square inches B. linear inches
A hotfix is never included in a service pack; they are only available as separate, stand-alone fixes
Indicate whether the statement is true or false
The ____________________ element should contain the rows of data that make up the body of a table.
Fill in the blank(s) with the appropriate word(s).
Specify the Android Testcase class used to test the correctness of
1. ActivityUnitTestCase 2. SingleLaunchActivityTestCase 3. ApplicationTestCase 4. InstrumentationTestCase