Georgia Institute of Technology

Slides:



Advertisements
Similar presentations
Georgia Institute of Technology Introduction to Processing Digital Sounds.
Advertisements

Pass by Value. COMP104 Pass by Value / Slide 2 Passing Parameters by Value * A function returns a single result (assuming the function is not a void function)
ManipulatingPictures-Mod6-part21 Manipulating Pictures, Arrays, and Loops part 2 Barb Ericson Georgia Institute of Technology.
Intro-Sound-part31 Introduction to Processing Digital Sounds part 3 Barb Ericson Georgia Institute of Technology Oct 2009.
Chapter 6: User-Defined Functions I
Lesson 6 Functions Also called Methods CS 1 Lesson 6 -- John Cole1.
Ordered Arrays An array is ordered if the elements are in ascending or descending order. The array may be ordered numerically or alphabetically (which.
Intro-Sound-part21 Introduction to Processing Digital Sounds part 2 Barb Ericson Georgia Institute of Technology Oct 2009.
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 7: Modifying Samples in a Range.
CompSci Today’s topics Sound Upcoming ä Intellectual property ä Network analysis ä Security Reading.
Chapter 6: User-Defined Functions I Instructor: Mohammad Mojaddam
Chapter 7: Modifying Samples in a Range. Chapter Objectives.
Georgia Institute of Technology Processing Sound Ranges Barb Ericson Georgia Institute of Technology July 2005.
UsingSoundRanges-part21 Processing Sound Ranges part 2 Barb Ericson Georgia Institute of Technology Oct 2009.
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 7: Modifying Samples in a Range.
AP Computer Science edition Review 1 ArrayListsWhile loopsString MethodsMethodsErrors
CPSC1301 Computer Science 1 Chapter 8 Introduction to Processing Digital Sounds part 3.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 6: User-Defined Functions I.
CHAPTER 6 USER-DEFINED FUNCTIONS Made By- Kartik Belwal.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 6 Functions.
Chapter 8: Modifying Samples in a Range. Chapter Objectives.
Functions Chapter 6. Modular Programming Modular programming: breaking a program up into smaller, manageable functions or modules Function: a collection.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 6: User-Defined Functions I.
Chapter 3: User-Defined Functions I
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 6: User-Defined Functions I.
Functions Structured Programming. Topics to be covered Introduction to Functions Defining a function Calling a function Arguments, local variables and.
1 CS 177 Week 8 Recitation Slides JES Sound functions and Modifying Sounds Increasing/Decreasing Volume Maximizing (Normalizing) Splicing Reversing Mirroring.
COSC 1P02 Introduction to Computer Science 5.1 Cosc 1P02 Week 5 Lecture slides Psychiatrist to patient "You have nothing to worry about - anyone who can.
Intro-Sound-Mod10-part31 Introduction to Processing Digital Sounds part 3 while loop, tracing, for loop, parameters Barb Ericson Georgia Institute of Technology.
04-ManipulatingPictures-part21 Manipulating Pictures, Arrays, and Loops part 2 Barb Ericson Georgia Institute of Technology June 2008.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 7A Arrays (Concepts)
Chapter 6: User-Defined Functions I
Manipulating Pictures, Arrays, and Loops part 2
Manipulating Pictures, Arrays, and Loops part 2
Manipulating Pictures, Arrays, and Loops part 3
Foundations of Programming: Arrays
Processing Sound Ranges part 1
Processing Sound Ranges part 3
Manipulating Pictures, Arrays, and Loops part 2
Manipulating Pictures, Arrays, and Loops part 2
Strings, Line-by-line I/O, Functions, Call-by-Reference, Call-by-Value
Arrays.
For Loops October 12, 2017.
Arrays, For loop While loop Do while loop
Chapter 7: Modifying Samples in a Range
Introduction to Processing Digital Sounds part 2
Manipulating Pictures, Arrays, and Loops part 5
Chapter 6: Functions Starting Out with C++ Early Objects Ninth Edition
Arrays versus ArrayList
Processing Sound Ranges part 1
Pointer Data Type and Pointer Variables III
Chapter 7: Modifying Samples in a Range
Manipulating Pictures, Arrays, and Loops part 3
Introduction to Processing Digital Sounds part 3
Manipulating Pictures, Arrays, and Loops
Manipulating Pictures, Arrays, and Loops
Chapter 6: User-Defined Functions I
Introduction to Processing Digital Sounds
Processing Sound Ranges part 2
Arrays ICS2O.
Processing Sound Ranges
Suggested self-checks: Section 7.11 #1-11
Arrays.
Manipulating Pictures, Arrays, and Loops
Processing Sound Ranges part 3
Creating and Modifying Text part 3
Templates Generic Programming.
Learning Plan 5 Arrays.
Corresponds with Chapter 5
Creating Sounds and MIDI
Presentation transcript:

Georgia Institute of Technology Normalize Sounds Make the whole sound as loud as possible How loud can it be? The max positive value is 32767 The max negative value is -32768 First we need to find the largest value (positive or negative) in the current sound Create a variable to hold the max What should it be when we start looping? And loop through the array and if the absolute value of the current value is greater Store that one instead Georgia Institute of Technology

Georgia Institute of Technology Creating a Sound Clip To clip the “This” out of “This is a test”. Determine where it starts and stops Using the sound explorer: String file = FileChooser.getMediaPath(“thisisatest.wav”); Sound s = new Sound(file); s.explore(); Georgia Institute of Technology

Georgia Institute of Technology To Create a Sound Clip Create a new Sound object Of the appropriate size Ending value – starting value + 1 Loop from start to end (inclusive) for (int x = start; x <= end; x++) Use getSampleValueAt(index) And setSampleValueAt(index,value); Return the new sound object Georgia Institute of Technology

Georgia Institute of Technology Clip Method public Sound clip(int start, int end) { // calc the num samples int numSamples = end - start + 1; Sound target = new Sound(numSamples); int value = 0; int targetIndex = 0; // copy from start to end for (int i = start; i <= end; i++, targetIndex++) { value = this.getSampleValueAt(i); target.setSampleValueAt(targetIndex, value); } return target; Georgia Institute of Technology

Returning a Value from a Method To return a value from a method Include a return statement in the body of the method The type of the thing being returned must match the declared return type The clip method declared that it returned a Sound object The return statement returned the target Sound object If the types don’t match you will get a compile error Georgia Institute of Technology

Splicing Sounds Together Originally meant cutting the sound tape into segments and then assembling them in the right order Easy to do digitally Copy more then one sound into a target sound Track the source index and target index Georgia Institute of Technology

Georgia Institute of Technology Splice Method public void splice() { Sound sound1 = new Sound(FileChooser.getMediaPath(“guzdial.wav”)); Sound sound2 = new Sound(FileChooser.getMediaPath("is.wav")); int targetIndex = 0; // the starting place on the target int value = 0; // copy all of sound 1 into the current sound (target) for (int i = 0; i < sound1.getLength(); i++, targetIndex++) value = sound1.getSampleValueAt(i); this.setSampleValueAt(targetIndex,value); } Georgia Institute of Technology

Splice Method - Continued // create silence between words by setting values to 0 for (int i = 0; i < (int) (this.getSamplingRate() * 0.1); i++, targetIndex++) { this.setSampleValueAt(targetIndex,0); } // copy all of sound 2 into the current sound (target) i < sound2.getLength(); value = sound2.getSampleValueAt(i); this.setSampleValueAt(targetIndex,value); Georgia Institute of Technology