Sounds in Jython 16 bit samples : -32,768 and 32,767

Slides:



Advertisements
Similar presentations
Russell Taylor. Sampling Sampled a file from an on-line/on-board source Edited that file by Deleting a section of the original file Added a Fade-in section.
Advertisements

Georgia Institute of Technology Introduction to Processing Digital Sounds.
What is Pro Tools? I.Multi-track digital recording and editing system. Hard-disk audio recording Graphic audio editing MIDI sequencing Digital signal processing.
Chapter 4: Representation of data in computer systems: Sound OCR Computing for GCSE © Hodder Education 2011.
BMP Hide ‘n’ Seek What is BMP Hide ‘n’ Seek ? –It’s a tool that lets you hide text messages in BMP files without much visible change in the picture. –Change.
Sound, Part 3. Multiple Echoes Here is a recipe to create multiple echoes: def echoes(sndfile, delay, num): s1 = makeSound(sndfile) ends1 = getLength(s1)
Chapter 8: Making Sounds by Combining Pieces. Chapter Objectives.
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 8: Making Sounds by Combining Pieces.
From Sound to Music CSC 161: The Art of Programming Prof. Henry Kautz 11/16/2009.
Computer Science 101 Introduction to Programming with Sounds.
Games and Simulations O-O Programming in Java The Walker School
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 6: Modifying Sounds Using Loops.
Simple Guide to Movie Maker By Peter Huang. Opening up movie maker This is what you should see when you open Windows Movie Maker.
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 7: Modifying Samples in a Range.
Problem Solving with Data Structures using Java: A Multimedia Approach Chapter 5: Arrays: A Static Data Structure for Sounds.
CompSci Today’s topics Sound Upcoming ä Intellectual property ä Network analysis ä Security Reading.
ITEC 109 Lecture 26 Sound (2). Sound Review Sound –How does it work in real life? –What are the different types of waves that represent sounds? –How are.
POWERPOINT 2007 TUTORIAL Features you must know. Adding a new slide  Using the same topic of interest. On Slide 1 make a Title Page.  Right click on.
Calculating and Interpreting Error in AS Chemistry Click on the speaker icon on the right to hear the sound file You will need to be able to here the.
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 8: Making Sounds by Combining Pieces.
Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: Text
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.
Analogue & Digital. Analogue Sound Storage Devices.
CS 102 Computers In Context (Multimedia)‏ 03 / 30 / 2009 Instructor: Michael Eckmann.
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 6: Modifying Sounds Using Loops.
CS1315: Introduction to Media Computation Sound Encoding and Manipulation.
Chapter 8: Modifying Samples in a Range. Chapter Objectives.
Sound Processing Arithmetic on Sound Sound is an array of amplitudes (numbers) –Adding two sounds together –Make a sound louder or softer –Blends of.
Sounds in Jython 16 bit samples : -32,768 and 32,767 Sound object holds all samples file = pickAFile() sound = makeSound( file ) SoundSample objects store.
1 CS 177 Week 8 Recitation Slides JES Sound functions and Modifying Sounds Increasing/Decreasing Volume Maximizing (Normalizing) Splicing Reversing Mirroring.
Session 18 The physics of sound and the manipulation of digital sounds.
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.
Working with Sounds Barb Ericson College of Computing Georgia Institute of Technology
Animations & Multimedia LESSON 9 #2.09 USING ANIMATION AND MULTIMEDIA.
Data Representation: Sound
3.3 Fundamentals of data representation
For those who hate computers.
Сабақтың тақырыбы: Music
Multimedia: making it Work
ROCK N’ ROLL The Beatles.
CPSC 231 Organizing Files for Performance (D.H.)
ENEL 111 Digital Electronics
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
What are Computers? G Use this tutorial alongside the numbers coded in your workbook and answer the related questions in each section.
Chapter 8: Making Sounds by Combining Pieces
SOUND ORGANIZED IN TIME
Georgia Institute of Technology
Analogue & Digital.
Step by step guide to music video (3mins)
Processing Sound Ranges part 3
Chapter 6: Modifying Sounds Using Loops
Creating a PowerPoint Presentation
Chapter 7: Modifying Samples in a Range
Introduction to Processing Digital Sounds part 2
Processing Sound Ranges part 1
How sound works: Acoustics, the physics of sound
Chapter 7: Modifying Samples in a Range
Parameter Passing in Java
Chapter 4: Representing sound
FUNCTION PRACTICE !!!.
Processing Sound Ranges
Number Systems Instructions, Compression & Truth Tables.
Image #1 Getting Started
Windows Movie Maker Tutorial
CS1315: Introduction to Media Computation
Creative Quotations from Paul Newman Born on Jan 26, 1925 U. S
ENEL 111 Digital Electronics
Presentations Using Microsoft PowerPoint
Presentation transcript:

Sounds in Jython 16 bit samples : -32,768 and 32,767 Sound object holds all samples file = pickAFile() sound = makeSound( file ) SoundSample objects store a single sample Two ways of playing sounds play (sound ) #spawns process to play sound blockingPlay( sound ) #no spawning Slides available at: courses.cs.vt.edu/~cs1004/cs4hs/

Sound Samples Samples retrieved either as: collection/array of SoundSample objects #collection____________________________________ for sample in getSamples( sound): setSampleValue( sample, getSampleValue(sample)*2) #array_______________________________________ samples = getSamples( sound) for s in range(0, getNumSamples(sound)): half = getSampleValue( samples[s] ) / 2 setSampleValue( samples[s], half ) single SoundSample objects sample = getSampleObjectAt( sound, 100 )

Normalize a Sound Normalizing sounds involves making them as loud as possible def driver(): file = pickAFile() sound = makeSound( file ) blockingPlay( sound ) normalize( sound ) blockingPlay( sound ) def normalize( source ): large = 0 for snd in getSamples(source): large = max(large, abs(getSample(snd)) ) scaler = 32767.0 / large loud = scaler*getSample(snd) setSample(snd, loud) Code available at: courses.cs.vt.edu/~cs1004/cs4hs/ 32767 -32767

Reverse a sound In late 1969 a rumor started circulating that Paul McCartney of the Beatles had died in 1966 and had been replaced by a double. To support this urban legend many reported that if one played the song "Revolution 9" from the white album backwards one could hear "Turn me on, dead man". Reverse the last 15 seconds of the song "Revolution 9" from the white album:  rev9.wav Modify the normalize code by adding a reverse() function that swaps all the samples in a sound, (first & last, second & next-to-last, etc.). Extra-credit: do not modify the original sound.

Fade Outs Create a new sound from copies of a sound, where the copies fade out with a delay between the copies: def fadeOut( snd1, delay, num ) : s1rate = getSamplingRate(snd1) ends1 = getLength( snd1 ) snd2 = makeEmptySound( ends1 * (num + 1) + num * int(delay * s1rate) ) ends2 = getLength( snd2 ) fadeAmplitude = 1.0 posn2 = 0 for echoCount in range( 0, num + 1 ) : for posn1 in range( 0, ends1-1 ) : values1 = getSampleValueAt( snd1, posn1) * fadeAmplitude setSampleValueAt( snd2, posn2, values1 ) posn2 = posn2 + 1 if (echoCount < num): for pause in range(0, int(s1rate * delay)): setSampleValueAt( snd2, posn2, 0 ) fadeAmplitude = fadeAmplitude * 0.6 # each fade is 60% of previous return snd2 Code available at: courses.cs.vt.edu/~cs1004/cs4hs/

Blending Sounds Creates a new sound from existing sounds. Corresponding samples from the sounds are blended together. Blending involves adding percentages (50%) of each sample together. Lab/class activity: download a reading of the Gettysburg address and an instrumental recording of God Bless America and create a blending of the two, (i.e. sound mix).

ALVIN! Lurch? Sounds can be speeded up or slowed down by under-sampling or over-sampling. Here is a famous line from the classic Paul Newman movie "Cool Hand Luke" as spoken by the inimitable character actor Strother Martin:  FailureToCommunicate.wav Code a function to speed up the sound by creating a new sound half as long as the original using every other sample from the original. Code a function to slow down the sound by creating a new sound twice as long as the original using every sample from the original twice.

Interpolation Under-sampling or over-sampling are just specific instances of linear interpolation (the same as nearest neighbor in image scaling). Given a length (sampling) factor, e.g., 0.80, 1.15, return a new sound of the new length and sampling using linear interpolation. Linear Interpolation: x For any new sound sample s the corresponding sample x from the original sound = s / (length of new sound) * length of original sound

Sound Projects Simple Telephony Given sound clips for each spoken digit, combine them to speak any given number. Sound Steganography Hide a message inside a sound file http://www.cs.uic.edu/~i101/projects/proj4.html Mozart’s Dice Game Create a waltz by pasting together pre-composed minuet & trio clips. http://www.cs.cornell.edu/courses/cs1110/2008fa/assignments/a6/a6.html