SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
MIDP:	
  Music	
  and	
  Sound	
  

            Jussi	
  Pohjolainen	
  
Tampere	
  University	
  of	
  Applied	
  Sciences	
  
Sound	
  and	
  Music,	
  the	
  Basics	
  
•  MIDP	
  2.0	
  includes	
  basic	
  audio	
  capabiliEes	
  
•  Media	
  API	
  in	
  MIDP	
  2.0	
  is	
  a	
  subset	
  of	
  the	
  MMAPI	
  (Mobile	
  
   Media	
  API).	
  
    –  MMAPI:	
  hHp://jcp.org/en/jsr/detail?id=135	
  
•  Subset	
  of	
  the	
  MMAPI	
  that	
  is	
  included	
  in	
  MIDP	
  2.0	
  is	
  called	
  
   Audio	
  Building	
  Block	
  (ABB).	
  
    –  Features:	
  Playing	
  simple	
  tones	
  and	
  sampled	
  audio	
  
•  Media	
  API	
  can	
  also	
  be	
  used	
  as	
  playing	
  all	
  kinds	
  of	
  media,	
  for	
  
   example	
  movies.	
  
MIDP	
  2.0	
  Media	
  Concepts	
  
•  Audio	
  data	
  comes	
  in	
  variety	
  of	
  content	
  types.	
  
•  Content	
  type	
  =	
  file	
  format!	
  
     –  MP3,	
  AIFF,	
  WAF	
  etc.	
  	
  
•  Content	
  types	
  are	
  specified	
  using	
  MIME	
  
   types,	
  which	
  use	
  a	
  string	
  to	
  specify	
  a	
  1)	
  
   primary	
  and	
  2)	
  secondary	
  type.	
  
     –  Example:	
  "audio/x-­‐wav"	
  
•  Content	
  type	
  tells	
  how	
  to	
  translate	
  bits	
  into	
  
   sound.	
  
Different	
  content	
  types	
  
•  Wave	
  audio	
  files:	
  	
  	
  
          –  audio/x-­‐wav	
  
•  AU	
  audio	
  files:	
  	
  	
  	
  	
  	
  
          –  audio/basic	
  
•  MP3	
  audio	
  files:	
  	
  	
  	
  	
  
          –  audio/mpeg	
  
•  MIDI	
  files:	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  
          –  audio/midi	
  
•  hHp://www.iana.org/assignments/media-­‐
   types/	
  	
  
Audio	
  Data	
  Path	
  

            For	
  example:	
               Handles	
  
                                                                                  Interface	
  in	
  	
  
            applause.wa                     transporEng	
  the	
  
                                                                                  javax.microediEon.	
  
                                            data	
  to	
  the	
  
            v	
                                                                   media	
  
                                            player	
  


Audio	
  
                           DataSource	
                              Player	
  
Data	
  


                                                                                               [	
  speaker	
  ]	
  
RelaEonship	
  between	
  classes	
  
                                                Manager	
  creates	
  
                                                a	
  player	
  with	
  
                                                certain	
  content	
  
                                                types	
  and	
  
                                                protocols	
  
                     Manager	
  


                                  creates	
  



    DataSource	
     Player	
  
                                                Controllers	
  can	
  
                                                control	
  tone	
  and	
  
                                                volume	
  

                      Control	
  
Supported	
  Content	
  Types	
  and	
  Protocols	
  

•  MIDP	
  2.0	
  spec:	
  if	
  sampled	
  audio	
  is	
  supported	
  
   at	
  all,	
  then	
  8-­‐bit	
  PCM	
  WAV	
  must	
  be	
  
   supported.	
  
    –  WAV	
  is	
  guaranteed..	
  your	
  mobile	
  phone	
  can	
  
       support	
  other	
  content	
  types,	
  for	
  example	
  mp3.	
  
•  It	
  is	
  possible	
  to	
  ask	
  (runEme)	
  from	
  Manager	
  
   which	
  content	
  types	
  and	
  protocols	
  it	
  can	
  
   handle.	
  	
  
•  Protocol,	
  for	
  example:	
  hCp,	
  file,	
  capture.	
  
Manager-­‐class	
  
•  javac.microedition.media.Manager	
  
   is	
  the	
  access	
  point	
  for	
  obtaining	
  system	
  
   dependent	
  resources	
  such	
  as	
  Players	
  for	
  
   mulEmedia	
  processing.	
  
•  A	
  Player	
  is	
  an	
  object	
  used	
  to	
  control	
  and	
  render	
  
   media	
  that	
  is	
  specific	
  to	
  the	
  content	
  type	
  of	
  the	
  
   data.	
  
•  Manager	
  provides	
  access	
  to	
  an	
  implementaEon	
  
   specific	
  mechanism	
  for	
  construcEng	
  Players.	
  
•  For	
  convenience,	
  Manager	
  also	
  provides	
  a	
  
   simplified	
  method	
  to	
  generate	
  simple	
  tones.	
  	
  
Supported	
  Protocols	
  and	
  Content	
  types	
  

•  To	
  find	
  out	
  at	
  runEme	
  what	
  content	
  types	
  
   and	
  protocols	
  are	
  supported:	
  
    –  Manager-­‐class	
  
         •  public static String[]
            getSupportedContentTypes(String protocol)!
         •  public static String[]
            getSupportedProtocols(String content_type)!

•  See	
  example:	
  MediaInformaEonMIDlet.java	
  
Player	
  Life	
  Cycle	
  
•  Player	
  has	
  detailed	
  life	
  cycle	
  
•  Life	
  cycle	
  has	
  states:	
  
     –  UNREALIZED	
  
             •  Player	
  is	
  created,	
  but	
  it	
  hasn't	
  tried	
  to	
  find	
  audio	
  data.	
  
     –  REALIZED	
  
             •  Media	
  data	
  is	
  located.	
  
     –  PREFETCHED	
  
             •  Audio	
  data	
  is	
  fetched	
  and	
  ready	
  to	
  go	
  
     –  STARTED	
  
             •  Audio	
  data	
  is	
  playing	
  
     –  CLOSED	
  
             •  All	
  resources	
  are	
  released	
  
Player	
  States	
  
CreaEng	
  a	
  Player	
  
•  Player	
  is	
  created	
  using	
  by	
  Manager	
  class	
  
    •  public static Player createPlayer(InputStream stream,
       String type)!

•  Example	
  
    •  Player player = Manager.createPlayer(...);!

•  Parameters	
  
    –  Stream	
  to	
  the	
  data	
  file.	
  
    –  String	
  type	
  =	
  content	
  type,	
  example:	
  "audio/x-­‐
       wav"	
  
Example	
  of	
  creaEng	
  Player	
  
                  instance	
  
•  Example	
  
    •  InputStream in = getClass().getResourceAsStream("/
       relax.wav");!
    •  Player player = Manager.createPlayer(in, "audio/x-wav");!

•  ExcepEon	
  handling	
  is	
  necessary,	
  use	
  try	
  
   catch.	
  
•  Example:	
  SimpleGameWithSounds.java	
  
    –  (Maybe	
  the	
  most	
  irritaEng	
  game	
  of	
  all	
  Eme)	
  
Controlling	
  Players	
  
•  Player	
  has	
  following	
  methods	
  that	
  control	
  
   played	
  sound:	
  
    –  setMediaTime(long now)	
  -­‐	
  jump	
  directly	
  
       to	
  parEcular	
  point	
  in	
  an	
  audio	
  clip	
  
    –  setLoopCount(int count)	
  -­‐	
  loop	
  
Player	
  Controls	
  
•  Control	
  classes	
  can	
  control	
  Players	
  
•  You	
  can	
  obtain	
  a	
  list	
  of	
  Controls	
  for	
  a	
  Player	
  by	
  calling	
  
   getControls().	
  
•  MIDP	
  2.0	
  has	
  only	
  two	
  Controls	
  for	
  the	
  Player:	
  
    –  VolumeControl	
  
    –  ToneControl!
•  Example	
  of	
  usage:	
  
    –  VolumeControl vc = (VolumeControl)
       player.getControl("VolumeControl");!
    –  vc.setLevel(50);	
  
OpEonal	
  APIs	
  
Mobile	
  Media	
  API	
  (JSR	
  135)	
  
•  Playing	
  sounds	
  and	
  tones	
  
•  Also	
  capturing	
  media	
  
    –  MMAPI	
  supports	
  capturing	
  audio	
  and	
  video	
  
       from	
  onboard	
  hardware	
  
    –  Recording	
  sound,	
  video	
  and	
  taking	
  pictures	
  
•  hHp://today.java.net/pub/a/today/
   2005/09/27/j2me4.html	
  
Wireless	
  Messaging	
  API	
  (JSR	
  205)	
  
•  Common	
  API	
  for	
  sending	
  and	
  receiving	
  text	
  
   and	
  binary	
  messages.	
  
•  hHp://developers.sun.com/mobility/midp/
   arEcles/wma/	
  
Bluetooth	
  API	
  (JSR	
  82)	
  
•  ConnecEng	
  via	
  Bluetooth	
  
•  Tutorial	
  
   –  hHp://developers.sun.com/mobility/midp/
      arEcles/bluetooth2/	
  
JAXP	
  XML	
  Parser	
  (JSR	
  172)	
  
•  This	
  JSR	
  is	
  designed	
  to	
  provide	
  a	
  general	
  
   purpose	
  XML	
  API	
  for	
  the	
  next	
  generaEon	
  of	
  
   mobile	
  devices	
  
•  Supports	
  
    –  SAX	
  2	
  event	
  handler-­‐based	
  parsing	
  
LocaEon	
  API	
  (JSR	
  179)	
  
•  Enables	
  developers	
  to	
  write	
  mobile	
  locaEon-­‐
   based	
  applicaEons	
  for	
  resource-­‐limited	
  
   devices	
  
•  Determining	
  device's	
  locaEon	
  (GPS)	
  
•  Tutorial	
  
    –  hHp://developers.sun.com/mobility/apis/
       arEcles/locaEon/	
  
Mobile	
  InternaEonalizaEon	
  API	
  (JSR	
  238)	
  

•  This	
  JSR	
  defines	
  an	
  API	
  that	
  provides	
  
   culturally	
  correct	
  data	
  formakng,	
  sorEng	
  of	
  
   text	
  strings	
  and	
  applicaEon	
  resource	
  
   processing	
  for	
  J2ME	
  MIDlets	
  running	
  in	
  MIDP	
  
   over	
  CLDC.	
  
•  Tutorial	
  
    –  hHp://www.ibm.com/developerworks/wireless/
       library/wi-­‐midapi/	
  
Scalable	
  2D	
  Vector	
  Graphics	
  API	
  for	
  J2ME	
  
                     (JSR	
  226)	
  
•  Scalable	
  2D	
  Vector	
  Graphics	
  API	
  for	
  J2ME	
  
   (JSR	
  226)	
  provides	
  MIDlets	
  with	
  an	
  API	
  for	
  
   displaying	
  SVG	
  content.	
  	
  
•  Tutorial	
  
    –  hHp://developers.sun.com/mobility/midp/
       arEcles/s2dvg/index.html	
  
       	
  

Contenu connexe

Tendances

Multimedia and desktop publishing module 1
Multimedia and desktop publishing module 1Multimedia and desktop publishing module 1
Multimedia and desktop publishing module 1Jason Paul S
 
Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02ElliotBlack
 
IG2 Task 1 Work Sheet Terence Byrne
IG2 Task 1 Work Sheet Terence ByrneIG2 Task 1 Work Sheet Terence Byrne
IG2 Task 1 Work Sheet Terence Byrneterry96
 
Lecture# 7 midi file format
Lecture#  7 midi file formatLecture#  7 midi file format
Lecture# 7 midi file formatMr SMAK
 
Ben white ig2 task 1 work sheet
Ben white   ig2 task 1 work sheetBen white   ig2 task 1 work sheet
Ben white ig2 task 1 work sheetBenWhite101
 
Image and Video formates
Image and Video formatesImage and Video formates
Image and Video formatesPrerak Shirpur
 
Methods and Principles of Sound Design and Production
Methods and Principles of Sound Design and ProductionMethods and Principles of Sound Design and Production
Methods and Principles of Sound Design and ProductionHooaax
 
Multimedia applications
Multimedia applicationsMultimedia applications
Multimedia applicationssmoky_stu
 
Ben white ig2 task 1 work sheet
Ben white   ig2 task 1 work sheetBen white   ig2 task 1 work sheet
Ben white ig2 task 1 work sheetBenWhite101
 
IG2 Task 1 Worksheet
IG2 Task 1 WorksheetIG2 Task 1 Worksheet
IG2 Task 1 WorksheetSamDuxburyGDS
 
3 multimedia elements - audio
3   multimedia elements - audio3   multimedia elements - audio
3 multimedia elements - audioKelly Bauer
 
Audio file format in computer graphic
Audio file format in computer graphicAudio file format in computer graphic
Audio file format in computer graphicIrfan Khan
 
Methods and principles of sound design and production
Methods and principles of sound design and productionMethods and principles of sound design and production
Methods and principles of sound design and productioncameronbailey1996
 

Tendances (20)

Multimedia and desktop publishing module 1
Multimedia and desktop publishing module 1Multimedia and desktop publishing module 1
Multimedia and desktop publishing module 1
 
Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02
 
IG2 Task 1 Work Sheet Terence Byrne
IG2 Task 1 Work Sheet Terence ByrneIG2 Task 1 Work Sheet Terence Byrne
IG2 Task 1 Work Sheet Terence Byrne
 
Thingy editedd
Thingy editeddThingy editedd
Thingy editedd
 
Lecture# 7 midi file format
Lecture#  7 midi file formatLecture#  7 midi file format
Lecture# 7 midi file format
 
Ben white ig2 task 1 work sheet
Ben white   ig2 task 1 work sheetBen white   ig2 task 1 work sheet
Ben white ig2 task 1 work sheet
 
Image and Video formates
Image and Video formatesImage and Video formates
Image and Video formates
 
Methods and Principles of Sound Design and Production
Methods and Principles of Sound Design and ProductionMethods and Principles of Sound Design and Production
Methods and Principles of Sound Design and Production
 
Multimedia applications
Multimedia applicationsMultimedia applications
Multimedia applications
 
Multimedia Object - Audio
Multimedia Object - AudioMultimedia Object - Audio
Multimedia Object - Audio
 
EDM for sounds
EDM for soundsEDM for sounds
EDM for sounds
 
Ben white ig2 task 1 work sheet
Ben white   ig2 task 1 work sheetBen white   ig2 task 1 work sheet
Ben white ig2 task 1 work sheet
 
IG2 Task 1 Worksheet
IG2 Task 1 WorksheetIG2 Task 1 Worksheet
IG2 Task 1 Worksheet
 
Audio formats
Audio formatsAudio formats
Audio formats
 
Ig2 task 1 re edit version
Ig2 task 1 re edit versionIg2 task 1 re edit version
Ig2 task 1 re edit version
 
3 multimedia elements - audio
3   multimedia elements - audio3   multimedia elements - audio
3 multimedia elements - audio
 
Chapter 9
Chapter 9Chapter 9
Chapter 9
 
Sound Editing
Sound EditingSound Editing
Sound Editing
 
Audio file format in computer graphic
Audio file format in computer graphicAudio file format in computer graphic
Audio file format in computer graphic
 
Methods and principles of sound design and production
Methods and principles of sound design and productionMethods and principles of sound design and production
Methods and principles of sound design and production
 

En vedette

En vedette (19)

Intro to HTML5
Intro to HTML5Intro to HTML5
Intro to HTML5
 
Android Location and Maps
Android Location and MapsAndroid Location and Maps
Android Location and Maps
 
Short intro to JQuery and Modernizr
Short intro to JQuery and ModernizrShort intro to JQuery and Modernizr
Short intro to JQuery and Modernizr
 
DOM and SAX
DOM and SAXDOM and SAX
DOM and SAX
 
Introduction to Web Application Course
Introduction to Web Application CourseIntroduction to Web Application Course
Introduction to Web Application Course
 
Introduction to Java ME
Introduction to Java MEIntroduction to Java ME
Introduction to Java ME
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
C++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorC++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operator
 
Java I/O
Java I/OJava I/O
Java I/O
 
C++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphismC++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphism
 
WP7 Motivation
WP7 MotivationWP7 Motivation
WP7 Motivation
 
JavaScript and DOM
JavaScript and DOMJavaScript and DOM
JavaScript and DOM
 
Methods in Java
Methods in JavaMethods in Java
Methods in Java
 
Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDX
 
Quick Start to iOS Development
Quick Start to iOS DevelopmentQuick Start to iOS Development
Quick Start to iOS Development
 
Programming with Java: the Basics
Programming with Java: the BasicsProgramming with Java: the Basics
Programming with Java: the Basics
 
Android 2D Drawing and Animation Framework
Android 2D Drawing and Animation FrameworkAndroid 2D Drawing and Animation Framework
Android 2D Drawing and Animation Framework
 
Intro to PhoneGap
Intro to PhoneGapIntro to PhoneGap
Intro to PhoneGap
 
Java OO Revisited
Java OO RevisitedJava OO Revisited
Java OO Revisited
 

Similaire à MIDP: Music and Sound

Multimedia on android
Multimedia on androidMultimedia on android
Multimedia on androidRamesh Prasad
 
Paris Video Tech #2 - Presentation by Jean-Yves Avenard
Paris Video Tech #2 - Presentation by Jean-Yves AvenardParis Video Tech #2 - Presentation by Jean-Yves Avenard
Paris Video Tech #2 - Presentation by Jean-Yves AvenardErica Beavers
 
Android Multimedia Player Project Presentation
Android Multimedia Player Project PresentationAndroid Multimedia Player Project Presentation
Android Multimedia Player Project PresentationRashmi Gupta
 
OpenMAX Overview
OpenMAX OverviewOpenMAX Overview
OpenMAX OverviewYoss Cohen
 
Android media framework overview
Android media framework overviewAndroid media framework overview
Android media framework overviewJerrin George
 
Media Source Extensions
Media Source ExtensionsMedia Source Extensions
Media Source ExtensionsFITC
 
Audio and video streaming
Audio and video streamingAudio and video streaming
Audio and video streamingRohan Bhatkar
 
Large-Scale Capture of Producer-Defined Musical Semantics - Ryan Stables (Sem...
Large-Scale Capture of Producer-Defined Musical Semantics - Ryan Stables (Sem...Large-Scale Capture of Producer-Defined Musical Semantics - Ryan Stables (Sem...
Large-Scale Capture of Producer-Defined Musical Semantics - Ryan Stables (Sem...sebastianewert
 
Standards' Perspective - MPEG DASH overview and related efforts
Standards' Perspective - MPEG DASH overview and related effortsStandards' Perspective - MPEG DASH overview and related efforts
Standards' Perspective - MPEG DASH overview and related effortsIMTC
 
Multimedia in Higher Education
Multimedia in Higher EducationMultimedia in Higher Education
Multimedia in Higher Educationlearning20
 
Audio and Video streaming.ppt
Audio and Video streaming.pptAudio and Video streaming.ppt
Audio and Video streaming.pptVideoguy
 
Streaming video to html
Streaming video to htmlStreaming video to html
Streaming video to htmljeff tapper
 
01.m3 cms setting-upmediaserver
01.m3 cms setting-upmediaserver01.m3 cms setting-upmediaserver
01.m3 cms setting-upmediaservertarensi
 
Sound recording glossary
Sound recording glossarySound recording glossary
Sound recording glossaryamybrockbank
 
Ig2 task 1 work sheet connor martin
Ig2 task 1 work sheet connor martinIg2 task 1 work sheet connor martin
Ig2 task 1 work sheet connor martinKalen612
 
HTML5 and Timed Media Playback
HTML5 and Timed Media PlaybackHTML5 and Timed Media Playback
HTML5 and Timed Media PlaybackSidra Abbasi
 
Streaming Overview Final.ppt
Streaming Overview Final.pptStreaming Overview Final.ppt
Streaming Overview Final.pptVideoguy
 

Similaire à MIDP: Music and Sound (20)

Multimedia on android
Multimedia on androidMultimedia on android
Multimedia on android
 
Paris Video Tech #2 - Presentation by Jean-Yves Avenard
Paris Video Tech #2 - Presentation by Jean-Yves AvenardParis Video Tech #2 - Presentation by Jean-Yves Avenard
Paris Video Tech #2 - Presentation by Jean-Yves Avenard
 
Android Multimedia Player Project Presentation
Android Multimedia Player Project PresentationAndroid Multimedia Player Project Presentation
Android Multimedia Player Project Presentation
 
OpenMAX Overview
OpenMAX OverviewOpenMAX Overview
OpenMAX Overview
 
Android media framework overview
Android media framework overviewAndroid media framework overview
Android media framework overview
 
Media Source Extensions
Media Source ExtensionsMedia Source Extensions
Media Source Extensions
 
Last videoppt
Last videopptLast videoppt
Last videoppt
 
Audio and video streaming
Audio and video streamingAudio and video streaming
Audio and video streaming
 
Large-Scale Capture of Producer-Defined Musical Semantics - Ryan Stables (Sem...
Large-Scale Capture of Producer-Defined Musical Semantics - Ryan Stables (Sem...Large-Scale Capture of Producer-Defined Musical Semantics - Ryan Stables (Sem...
Large-Scale Capture of Producer-Defined Musical Semantics - Ryan Stables (Sem...
 
Standards' Perspective - MPEG DASH overview and related efforts
Standards' Perspective - MPEG DASH overview and related effortsStandards' Perspective - MPEG DASH overview and related efforts
Standards' Perspective - MPEG DASH overview and related efforts
 
SocialZap
SocialZapSocialZap
SocialZap
 
Multimedia in Higher Education
Multimedia in Higher EducationMultimedia in Higher Education
Multimedia in Higher Education
 
Audio and Video streaming.ppt
Audio and Video streaming.pptAudio and Video streaming.ppt
Audio and Video streaming.ppt
 
Streaming video to html
Streaming video to htmlStreaming video to html
Streaming video to html
 
01.m3 cms setting-upmediaserver
01.m3 cms setting-upmediaserver01.m3 cms setting-upmediaserver
01.m3 cms setting-upmediaserver
 
Sound recording glossary
Sound recording glossarySound recording glossary
Sound recording glossary
 
Ig2 task 1 work sheet connor martin
Ig2 task 1 work sheet connor martinIg2 task 1 work sheet connor martin
Ig2 task 1 work sheet connor martin
 
HTML5 and Timed Media Playback
HTML5 and Timed Media PlaybackHTML5 and Timed Media Playback
HTML5 and Timed Media Playback
 
J2me
J2meJ2me
J2me
 
Streaming Overview Final.ppt
Streaming Overview Final.pptStreaming Overview Final.ppt
Streaming Overview Final.ppt
 

Plus de Jussi Pohjolainen

libGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferenceslibGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferencesJussi Pohjolainen
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationJussi Pohjolainen
 
Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript DevelopmentJussi Pohjolainen
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame AnimationJussi Pohjolainen
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame AnimationJussi Pohjolainen
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDXJussi Pohjolainen
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDXJussi Pohjolainen
 
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesCreating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesJussi Pohjolainen
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platformJussi Pohjolainen
 
Intro to Java ME and Asha Platform
Intro to Java ME and Asha PlatformIntro to Java ME and Asha Platform
Intro to Java ME and Asha PlatformJussi Pohjolainen
 
Quick Intro to JQuery and JQuery Mobile
Quick Intro to JQuery and JQuery MobileQuick Intro to JQuery and JQuery Mobile
Quick Intro to JQuery and JQuery MobileJussi Pohjolainen
 

Plus de Jussi Pohjolainen (20)

Moved to Speakerdeck
Moved to SpeakerdeckMoved to Speakerdeck
Moved to Speakerdeck
 
Java Web Services
Java Web ServicesJava Web Services
Java Web Services
 
Box2D and libGDX
Box2D and libGDXBox2D and libGDX
Box2D and libGDX
 
libGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferenceslibGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and Preferences
 
libGDX: Tiled Maps
libGDX: Tiled MapslibGDX: Tiled Maps
libGDX: Tiled Maps
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame Animation
 
Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript Development
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
libGDX: Scene2D
libGDX: Scene2DlibGDX: Scene2D
libGDX: Scene2D
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame Animation
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame Animation
 
libGDX: User Input
libGDX: User InputlibGDX: User Input
libGDX: User Input
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDX
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDX
 
Android Threading
Android ThreadingAndroid Threading
Android Threading
 
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesCreating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platform
 
Intro to Asha UI
Intro to Asha UIIntro to Asha UI
Intro to Asha UI
 
Intro to Java ME and Asha Platform
Intro to Java ME and Asha PlatformIntro to Java ME and Asha Platform
Intro to Java ME and Asha Platform
 
Quick Intro to JQuery and JQuery Mobile
Quick Intro to JQuery and JQuery MobileQuick Intro to JQuery and JQuery Mobile
Quick Intro to JQuery and JQuery Mobile
 

Dernier

Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxJanEmmanBrigoli
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 

Dernier (20)

Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 

MIDP: Music and Sound

  • 1. MIDP:  Music  and  Sound   Jussi  Pohjolainen   Tampere  University  of  Applied  Sciences  
  • 2. Sound  and  Music,  the  Basics   •  MIDP  2.0  includes  basic  audio  capabiliEes   •  Media  API  in  MIDP  2.0  is  a  subset  of  the  MMAPI  (Mobile   Media  API).   –  MMAPI:  hHp://jcp.org/en/jsr/detail?id=135   •  Subset  of  the  MMAPI  that  is  included  in  MIDP  2.0  is  called   Audio  Building  Block  (ABB).   –  Features:  Playing  simple  tones  and  sampled  audio   •  Media  API  can  also  be  used  as  playing  all  kinds  of  media,  for   example  movies.  
  • 3. MIDP  2.0  Media  Concepts   •  Audio  data  comes  in  variety  of  content  types.   •  Content  type  =  file  format!   –  MP3,  AIFF,  WAF  etc.     •  Content  types  are  specified  using  MIME   types,  which  use  a  string  to  specify  a  1)   primary  and  2)  secondary  type.   –  Example:  "audio/x-­‐wav"   •  Content  type  tells  how  to  translate  bits  into   sound.  
  • 4. Different  content  types   •  Wave  audio  files:       –  audio/x-­‐wav   •  AU  audio  files:             –  audio/basic   •  MP3  audio  files:           –  audio/mpeg   •  MIDI  files:                           –  audio/midi   •  hHp://www.iana.org/assignments/media-­‐ types/    
  • 5. Audio  Data  Path   For  example:   Handles   Interface  in     applause.wa transporEng  the   javax.microediEon.   data  to  the   v   media   player   Audio   DataSource   Player   Data   [  speaker  ]  
  • 6. RelaEonship  between  classes   Manager  creates   a  player  with   certain  content   types  and   protocols   Manager   creates   DataSource   Player   Controllers  can   control  tone  and   volume   Control  
  • 7. Supported  Content  Types  and  Protocols   •  MIDP  2.0  spec:  if  sampled  audio  is  supported   at  all,  then  8-­‐bit  PCM  WAV  must  be   supported.   –  WAV  is  guaranteed..  your  mobile  phone  can   support  other  content  types,  for  example  mp3.   •  It  is  possible  to  ask  (runEme)  from  Manager   which  content  types  and  protocols  it  can   handle.     •  Protocol,  for  example:  hCp,  file,  capture.  
  • 8. Manager-­‐class   •  javac.microedition.media.Manager   is  the  access  point  for  obtaining  system   dependent  resources  such  as  Players  for   mulEmedia  processing.   •  A  Player  is  an  object  used  to  control  and  render   media  that  is  specific  to  the  content  type  of  the   data.   •  Manager  provides  access  to  an  implementaEon   specific  mechanism  for  construcEng  Players.   •  For  convenience,  Manager  also  provides  a   simplified  method  to  generate  simple  tones.    
  • 9. Supported  Protocols  and  Content  types   •  To  find  out  at  runEme  what  content  types   and  protocols  are  supported:   –  Manager-­‐class   •  public static String[] getSupportedContentTypes(String protocol)! •  public static String[] getSupportedProtocols(String content_type)! •  See  example:  MediaInformaEonMIDlet.java  
  • 10. Player  Life  Cycle   •  Player  has  detailed  life  cycle   •  Life  cycle  has  states:   –  UNREALIZED   •  Player  is  created,  but  it  hasn't  tried  to  find  audio  data.   –  REALIZED   •  Media  data  is  located.   –  PREFETCHED   •  Audio  data  is  fetched  and  ready  to  go   –  STARTED   •  Audio  data  is  playing   –  CLOSED   •  All  resources  are  released  
  • 12. CreaEng  a  Player   •  Player  is  created  using  by  Manager  class   •  public static Player createPlayer(InputStream stream, String type)! •  Example   •  Player player = Manager.createPlayer(...);! •  Parameters   –  Stream  to  the  data  file.   –  String  type  =  content  type,  example:  "audio/x-­‐ wav"  
  • 13. Example  of  creaEng  Player   instance   •  Example   •  InputStream in = getClass().getResourceAsStream("/ relax.wav");! •  Player player = Manager.createPlayer(in, "audio/x-wav");! •  ExcepEon  handling  is  necessary,  use  try   catch.   •  Example:  SimpleGameWithSounds.java   –  (Maybe  the  most  irritaEng  game  of  all  Eme)  
  • 14. Controlling  Players   •  Player  has  following  methods  that  control   played  sound:   –  setMediaTime(long now)  -­‐  jump  directly   to  parEcular  point  in  an  audio  clip   –  setLoopCount(int count)  -­‐  loop  
  • 15. Player  Controls   •  Control  classes  can  control  Players   •  You  can  obtain  a  list  of  Controls  for  a  Player  by  calling   getControls().   •  MIDP  2.0  has  only  two  Controls  for  the  Player:   –  VolumeControl   –  ToneControl! •  Example  of  usage:   –  VolumeControl vc = (VolumeControl) player.getControl("VolumeControl");! –  vc.setLevel(50);  
  • 17. Mobile  Media  API  (JSR  135)   •  Playing  sounds  and  tones   •  Also  capturing  media   –  MMAPI  supports  capturing  audio  and  video   from  onboard  hardware   –  Recording  sound,  video  and  taking  pictures   •  hHp://today.java.net/pub/a/today/ 2005/09/27/j2me4.html  
  • 18. Wireless  Messaging  API  (JSR  205)   •  Common  API  for  sending  and  receiving  text   and  binary  messages.   •  hHp://developers.sun.com/mobility/midp/ arEcles/wma/  
  • 19. Bluetooth  API  (JSR  82)   •  ConnecEng  via  Bluetooth   •  Tutorial   –  hHp://developers.sun.com/mobility/midp/ arEcles/bluetooth2/  
  • 20. JAXP  XML  Parser  (JSR  172)   •  This  JSR  is  designed  to  provide  a  general   purpose  XML  API  for  the  next  generaEon  of   mobile  devices   •  Supports   –  SAX  2  event  handler-­‐based  parsing  
  • 21. LocaEon  API  (JSR  179)   •  Enables  developers  to  write  mobile  locaEon-­‐ based  applicaEons  for  resource-­‐limited   devices   •  Determining  device's  locaEon  (GPS)   •  Tutorial   –  hHp://developers.sun.com/mobility/apis/ arEcles/locaEon/  
  • 22. Mobile  InternaEonalizaEon  API  (JSR  238)   •  This  JSR  defines  an  API  that  provides   culturally  correct  data  formakng,  sorEng  of   text  strings  and  applicaEon  resource   processing  for  J2ME  MIDlets  running  in  MIDP   over  CLDC.   •  Tutorial   –  hHp://www.ibm.com/developerworks/wireless/ library/wi-­‐midapi/  
  • 23. Scalable  2D  Vector  Graphics  API  for  J2ME   (JSR  226)   •  Scalable  2D  Vector  Graphics  API  for  J2ME   (JSR  226)  provides  MIDlets  with  an  API  for   displaying  SVG  content.     •  Tutorial   –  hHp://developers.sun.com/mobility/midp/ arEcles/s2dvg/index.html