====================================================================== ===== COMP2720 ===== Semester 2, 2006 ===== Lab sheet ===== ====================================================================== Student name: Dean Dal Broi Student Uni ID: u4222206 Lab goup: Tue 10-12 Tutor: Peter Christen ---------------------------------------------------------------------- Lab number: 4 Date: 20/9/06 ====================================================================== Completed lab pre-liminaries. Ready to move onto part 1. Part 1. Q2. s1 does sound double as loud as s2 as it has double the amplitude. After also playing around with different values for the frequency and amplitude i found that as the frequency value increases the sound becomes higher pitched and as the value decreases it becomes lower pitched. If the amplitude value is increased the sound becomes louder and if it is decreased the sound becomes softer. Q3. the pitch of s2 is double the pitch of s1 as expected. Q4. These two sounds are of course different. s1 has curved flowing sound waves where as s2 has rectangular ridged sound waves. however I'm surprised that s2 doesnt sound more different to s1 than it already does. Q5. s1 sounds a lot softer than s2 which is comparable to the sound of a fire alarm. s3 sounds similar to s1 but with a different tone. Q6. created the sawtoothWave function by modifying the triangleWave function so that it didnt reverse the amplitude at the end of every half-cycle and instead set the sampleValue to the the max value after it had reached the minimum value after a full cycle. the main loop was modified from this: for pos in range(1,getLength(mySound)+1): # if end of a half-cycle if (i > samplesPerHalfCycle): # Reverse the amplitude increment = increment * -1 # And reinitialise the half-cycle counter i = 0 sampleVal = sampleVal + increment setSampleValueAt(mySound, pos, sampleVal) i = i + 1 to this: for pos in range(1,getLength(mySound)+1): sampleVal = sampleVal - decrement setSampleValueAt(mySound, pos, sampleVal) #if the sample has reach the bottom of the sound wave if sampleVal == -amplitude: #set the new sample to be at the top of the wave sampleVal = amplitude + decrement Q7. Had to modify the addSounds function in order for it to work correctly by changing the new sound value to be the addition of the 2 samples divided by 2. I Then created 3 sounds from sounds made from the other functions being added together using addSounds Part 2. Q2. Have run the command "playMIDI('testsong.csv', 'MIDInotes.csv')" and the little tune that plays sounds nice! Q3. the function song() plays the same song as "playMIDI('testsong.csv', 'MIDInotes.csv')" the major difference it that the second function plays the song from a file and and the first plays the song directly from code within the function. Q4. Composed by beautiful random sounding little csv tune. Q5. the benefit of the playMIDI function over song is that it is flexible in the sense that the function doesnt need to be re-coded to play another song. However it also makes the process of playing a song actually longer than song. ======================================================================