Download presentation

Presentation is loading. Please wait.

Published byGabriel Unwin Modified over 3 years ago

1
CS 102 Computers In Context (Multimedia) 04 / 13 / 2009 Instructor: Michael Eckmann

2
Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Today’s Topics Questions/comments? Creating multiple Echoes Backwards sounds

3
Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Echoing sounds In one of the labs I had you add sounds together. An echo can be created by adding the same sound to itself but shifted in time. We can create an echo from a sound by doing the following: –Make a new sound containing the original sound plus the original sound at lower volume shifted in time Let's take a look at the idea on the board. Just like in splicing, we need to keep track of two indices –The source index in the original sound (where we'll getSampleValueAt) –The target index in the newly created sound (where we'll setSampleValueAt)

4
Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Backwards sounds Any ideas on how we could create backwards version of a sound? Just like in splicing and echoing, we'll need to keep track of two indices –The source index in the original sound (where we'll getSampleValueAt) –The target index in the newly created sound (where we'll setSampleValueAt)

5
Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Backwards sounds Any ideas on how we could create backwards version of a sound? Just like in splicing and echoing, we'll need to keep track of two indices –The source index in the original sound (where we'll getSampleValueAt) –The target index in the newly created sound (where we'll setSampleValueAt)

6
Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Generating Sine Wave sounds Suppose we would like to generate sine waves of a particular frequency and amplitude: –Example: 440 Hz (= 440 cycles (complete sine waves) per second) 5000 amplitude (largest positive sample value) We also need to know the sampling rate (the number of samples per second). The default value in JES is 22050 samples per second. So for this example, we'll need to create 440 sine waves, each of which takes up 1/440 of a second. How many samples do we want in that 1/440 of a second?

7
Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Generating Sine Wave sounds Suppose we would like to generate sine waves of a particular frequency and amplitude: –Example: 440 Hz (= 440 cycles (complete sine waves) per second) 5000 amplitude (largest positive sample value) We also need to know the sampling rate (the number of samples per second). The default value in JES is 22050 samples per second. So for this example, we'll need to create 440 sine waves, each of which takes up 1/440 of a second. How many samples do we want in that 1/440 of a second? Answer: 22050/440 samples.

8
Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Generating Sine Wave sounds There is a sin function in python that we can use. It takes in radians. (2*pi radians = 360 degrees) Recall that the sin(x) results in a value in [-1,1]. If we want the amplitude to be something other than 1, then we can multiply the desired amplitude by the sin value.

Similar presentations

OK

12.7 Graphing Trigonometric Functions Day 1: Sine and Cosine.

12.7 Graphing Trigonometric Functions Day 1: Sine and Cosine.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google