CS378 - Mobile Computing Audio.

Slides:



Advertisements
Similar presentations
“The Digital Recorder and Voice Memos” Presented by Maria E. Delgado
Advertisements

Book Port Plus Finding Existing Titles and Sending New Content Presented by Maria E. Delgado.
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.
Simple Audio Recording from your iPhone, PC or Mac.
Using Multimedia on the Web Enhancing a Web Site with Sound, Video, and Applets.
CNIT 132 – Week 9 Multimedia. Working with Multimedia Bandwidth is a measure of the amount of data that can be sent through a communication pipeline each.
Royalty Free Music for Schools Do You Have the To Do a Podcast?
Chapter 11 Media and Interactivity Basics Key Concepts
TouchDevelop Chapter 5-7 Chapter 5 Audio Chapter 6 Camera, Graphics and Video Chapter 7 Sensors Mengfei Ren.
David Meredith Minim David Meredith
Name Matrix No CHIA EE LOON(LEADER) OW CHEE YEE LAURA TIONG UNG KAH CAT200 Integrated Software Development Workshop Storyboard.
Group 8: Dylan Lentini (AE), Mandy Minuti (WSE), Jean Paul Galea (TL)
MXIE overview 5/4/ Update1. MXIE Media Exchange Interface for End Users 5/4/ Update2.
Mobile Computing Lecture#13. Lecture Contents 2 Widgets  Creating App Widget  Unsupported/Supported Views/Layouts  Widget Layout  Widget Settings.
COMPUTER PROGRAMMING 2 Chapter 7 Sound. Objectives Find out how to prepare sounds for inclusion in Microsoft XNA projects. Incorporate sounds into XNA.
Chapter 6 Jam! Implementing Audio in Android Apps.
Chapter 6: Jam! Implementing Audio in Android Apps.
Creating Audio Content for Mobile Games Presented by: Ben Long.
The Android Activity Lifecycle. Slide 2 Introduction Working with the Android logging system Rotation and multiple layouts Understanding the Android activity.
Cannon Game 1 Fall 2014 CS7020: Game Design and Development.
John Meilak Reuben Sant Jason Farrugia Media API Web Science APT 2007/2008.
CS371m - Mobile Computing Audio.
Basic Audio and Video. Audio Primary components – Audio file stored in ‘raw’ folder within ‘res’ folder ‘raw’ directory must be created while many formats.
Multimedia.
CS378 - Mobile Computing Anatomy of an Android App and the App Lifecycle.
Using Audacity Created by: Stephanie Anderson Dublin Unified School District Dublin, California.
CS378 - Mobile Computing What's Next?. Fragments Added in Android 3.0, a release aimed at tablets A fragment is a portion of the UI in an Activity multiple.
CHAPTER 1 XNA Game Studio 4.0. Your First Project A computer game is not just a program—it is also lots of other bits and pieces that make playing the.
WINDOWS APPLICATIONS by Jane Cable Also called Accessories Also called Components.
CS5103 Software Engineering Lecture 08 Android Development II.
Available Technology  MP3 Players – 25 – Oral Testing, Audio Texts / Books  Presenter Mice – 3 – Oral Presentations  Head Phone Extension Kits – 2 –
ACE-HIGH MP3 WAV WMA OGG Converter By :: Natharat Kaewrawang
Rujchai Ung-arunyawee Department of Computer Engineering Khon Kaen University.
 Using Screenr, Jing, and QuickTime Plus some alternatives!
CS378 - Mobile Computing Persistence. Saving State We have already seen saving app state into a Bundle on orientation changes or when an app is killed.
Finding a Music File to Work With From the PUSD student home page, select “Royalty Free Music”
Copyright © 2003 Pearson Education, Inc. Chapter 5 – Slide 1 by Michael Kay The Web Wizard’s Guide to Flash.
11 Adding Sounds Session 7.1. Session Overview  Find out how to capture and manipulate sound on a Windows PC  Show how sound is managed as an item of.
SpotOn Game App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Noname. Conceptual Parts States of Activities Active Pause Stop Inactive.
Workflow: Content (write) Acquisition (record) Produce (edit) Author (compress/export as mp3) Add meta data (ID3 tags) Distribute (ftp to moodle)
Audio Yu Feng CGDD Review 1. Set up 2. IOS sound – Core Audio – Short Sound – Long Sound – Control Sound – Background Sound 3.Cocos2d sound.
CS378 - Mobile Computing Persistence. Saving State We have already seen saving app state into a Bundle on orientation changes or when an app is killed.
1 CMSC 628: Introduction to Mobile Computing Nilanjan Banerjee Introduction to Mobile Computing University of Maryland Baltimore County
Real Audio Real audio is a file format for sound and video files on the web. Real Audio files are files with either a.rm or.ram extention. Real Audio format.
Android. What is Android? A mobile device operating system. Seen primary in tablets and Cellphones. Based on a Linux kernel. Applications are Java Based.
Quick Record (Simple Song) 1. Press the Record Button 2. Press the (F2) Soft Button to select Quick Record 3.Press the Play Button to start the recording.
Multimedia. Audio,vedio and Images End user typically refer to vedio/audio using the respective file format MP4 or AVI(audio vedio interleave) Developer.
CS378 - Mobile Computing Sensing and Sensors Part 2.
Editing Digital AudioLab#7 Audacity is a free, easy-to-use and an open source platform audio editor and recorder for Windows, Mac OS, Linux and other operating.
Using Audacity Let’s get Started Open Audacity. Getting started…
Lecture 7: Media Player Topics: Media Player, Async prepare Date: Mar 3, 2016.
CS371m - Mobile Computing Audio. Audio on Device Devices have multiple audio streams: – music, alarms, notifications, incoming call ringer, in call volume,
Audio and Haptic Feedback
Android Application Audio 1.
Objective % Explain concepts used to create digital audio.
Android Application Data Storage 1.
Sound Music & Sound Effects.
Lecture 7: Service Topics: Services, Playing Media.
Android Boot Camp for Developers Using Java, 3E
Mobile Application Development Chapter 5 [Persistent Data in Android]
Anatomy of an Android App and the App Lifecycle
Lecture 7: Media Player Topics: Media Player, Async prepare
The Android Activity Lifecycle
Objective % Explain concepts used to create digital audio.
Anatomy of an Android App and the App Lifecycle
Cannon Game App Android How to Program
Android Topics Custom ArrayAdapters Creating an Event Listener
Lecture 7: Service Topics: Services, Broadcast Receiver, Playing Media.
Android Development Tools
Presentation transcript:

CS378 - Mobile Computing Audio

Android Audio Use the MediaPlayer class Common Audio Formats supported: MP3, MIDI (.mid and others), Vorbis (.ogg), WAVE (.wav) and others Sources of audio local resources (part of app) internal URIs (Content Provider for other audio available) External URLs (streaming)

MediaPlayer Playback control of MediaPlayer managed as a state machine Idle Initialized Preparing Prepared Started Paused Playback Complete Stopped End Invalid state transitions result in errors

MediaPlayer State Diagram Single arrows are synchronous transitions Double arrows are asynchronous transitions

Simple Sound Demo App audio files local to app placed in res/raw CAUTION large sound files difficult to install on emulator: http://tinyurl.com/3pwljfj better success with dev phones / actual devices

Playing Local Audio To play audio local to the app use the MediaPlayer.create convenience method when complete MediaPlayer in the prepared state start MediaPlayer approach: build listeners for each button to call the playSound method with appropriate song id when clicked

Simple Approach button ids ids for sound files

playSound method okay for short sounds downsides: plays to completion multiple sounds play at same time (desirable in some cases) audio continues to play when app paused

Changing Behavior Add instance variable for MediaPlayer If playing stop and release before creating new Player

Cleaning Up Current version does not end well Audio continues to play if back button pressed and even if home button pressed! Activity Life Cycle on pause we should stop MediaPlayer and release

stopPlayer method Connect app stop button to stopPlayer could use XML onClick and add View parameter or set up listener ourselves in buildListeners method

onPause onPause() should call the stopPlayer method what happens if activity resumed?

Saving State Resume music where we left off if paused or activity destroyed due to orientation change

Saving MediaPlayer State Not a lot of data so used the SharedPreferences

Restarting Audio In onCreate check if audio was interrupted recreate player with same id and move to correct position Can write data to shared preferences or bundle (onSaveInstanceState) and pull out in onCreate Possible fix for orientation changes in app manifest file under activity field android:configChanges="orientation" But now we are responsible for orientation changes http://developer.android.com/guide/topics/resources/runtime-changes.html#HandlingTheChange

Playing Audio from Phone If audio is on device / system, but not local to app use a URI Obtain URIs of Music via a Content resolver Example of simply listing URIs to the logcat

Retrieving Music URIs

MediaPlayer and System Audio After URI retrieved can play audio with MediaPlayer this approach requires calling prepare yourself no convenience method

Playing Audio Via Local URI id obtained via approach from showContent method

Other Audio Other audio for ringtones, notifications, and alarms can be accessed via a RingtoneManager Obtain URIs and play with media player from DDMS:

Listing Other Audio

Playing Other Audio Once the URI is obtained, playing other audio is same as playing song

Playing Audio from Remote URL Straightforward given the URL

Completion of Audio If action required when audio done playing implement the MediaPlayer.onCompletionListener interface could make activity the listener

Looping to loop sound (play over and over) simply set the isLooping method of the MediaPlayer to true

SoundPool Another Android class

Using SoundPool Great for applications with a number of short sound samples maxStreams parameter sets maximum number of sounds that can be played at once via this SoundPool If max is exceeded stream with lowest priority stopped and then by age (oldest) with lowest priority

SoundPool play

Using SoundPool Looping of sounds: frequency (speed) can be changed 0 no looping -1 loop forever >0, play that many times frequency (speed) can be changed range from 0.5 to 2.0 0.5 twice as long to play 2.0 half as long to play