SlideShare a Scribd company logo
1 of 3
Download to read offline
1.playing audio in java
Java sound API(package javax.sound) supports two types of audios:
- sampled audio
- musical instrument digital interface(MIDI)
sampled audio:
In the sampled audio ,the supported file formats are: AIFC,AIFF,WAVE,SND,AU and doesn't
support the audio format MP3.
Provide two ways to play the audio: using clip and using source data line
using clip : (javax.sound.sampled.clip) used to play a short sound file.
In this method the whole audio clip is loaded into the memoryto have control over audio clip
before playing it.
steps for playing the audio file:
1. create an audioInputStream for a given sound file.
2. acquire audio format and create DataLine.Info Object
3.Obtain the clip
4.open the AudioInputStream ,start playing
5.close the resource acquired
using source data line :(javax.sound.sampled.SourceDataLine),used to play the long sound line.
these type of sounds cant be preloaded into the memory so, the data is read into the buffer in the
form of bytes repeatedly.
steps for playing the audio file:
1. open the sorce data file similarly by creating,acquiring and obtaining as in clip.
2. open and start the sound file
3. repeatedly read a chunk of bytes from the AudioInputStream and send it to the
SourceDataLine's buffer untill reaching the end f the file
4.close the resource acquired.
Musical Instrument Digital Interface(MIDI): music is synthesized from special nodes and effects.
steps for playing the audio:
1. allocate a sequence piped from a MIDI file
2. allocate a sequencer to play a MIDI sequence
3. set the current sequence for the sequencer to play
4. open the sequencer to load the sequence.
5. set the loop count by using SetLoopCount() and start playing the music by using start()
6. stop the play using stop().
2. creating a timer:
the Timer is provided in the java.util package.
In which we create an instance for thread like
Thread thread= new Thread();
then using this instance thread we use the sleep() available in the timer class as follows:
thread.sleep();
here the arguments int the sleep() is nothing but the time in milli seconds for example:
thread.sleep(2000) will sleep the process execution or triggering for 20 seconds.
BLanks:
1.
actionPerformed() in the Listener interface
2.
3.
close()
4.
5.
scope
Solution
1.playing audio in java
Java sound API(package javax.sound) supports two types of audios:
- sampled audio
- musical instrument digital interface(MIDI)
sampled audio:
In the sampled audio ,the supported file formats are: AIFC,AIFF,WAVE,SND,AU and doesn't
support the audio format MP3.
Provide two ways to play the audio: using clip and using source data line
using clip : (javax.sound.sampled.clip) used to play a short sound file.
In this method the whole audio clip is loaded into the memoryto have control over audio clip
before playing it.
steps for playing the audio file:
1. create an audioInputStream for a given sound file.
2. acquire audio format and create DataLine.Info Object
3.Obtain the clip
4.open the AudioInputStream ,start playing
5.close the resource acquired
using source data line :(javax.sound.sampled.SourceDataLine),used to play the long sound line.
these type of sounds cant be preloaded into the memory so, the data is read into the buffer in the
form of bytes repeatedly.
steps for playing the audio file:
1. open the sorce data file similarly by creating,acquiring and obtaining as in clip.
2. open and start the sound file
3. repeatedly read a chunk of bytes from the AudioInputStream and send it to the
SourceDataLine's buffer untill reaching the end f the file
4.close the resource acquired.
Musical Instrument Digital Interface(MIDI): music is synthesized from special nodes and effects.
steps for playing the audio:
1. allocate a sequence piped from a MIDI file
2. allocate a sequencer to play a MIDI sequence
3. set the current sequence for the sequencer to play
4. open the sequencer to load the sequence.
5. set the loop count by using SetLoopCount() and start playing the music by using start()
6. stop the play using stop().
2. creating a timer:
the Timer is provided in the java.util package.
In which we create an instance for thread like
Thread thread= new Thread();
then using this instance thread we use the sleep() available in the timer class as follows:
thread.sleep();
here the arguments int the sleep() is nothing but the time in milli seconds for example:
thread.sleep(2000) will sleep the process execution or triggering for 20 seconds.
BLanks:
1.
actionPerformed() in the Listener interface
2.
3.
close()
4.
5.
scope

More Related Content

Similar to 1.playing audio in javaJava sound API(package javax.sound) support.pdf

IG2 Task 1 Work Sheet
IG2 Task 1 Work SheetIG2 Task 1 Work Sheet
IG2 Task 1 Work SheetNathan_West
 
What Shazam doesn't want you to know
What Shazam doesn't want you to knowWhat Shazam doesn't want you to know
What Shazam doesn't want you to knowRoy van Rijn
 
Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02ElliotBlack
 
Building Modern Audio Apps with AVAudioEngine
Building Modern Audio Apps with AVAudioEngineBuilding Modern Audio Apps with AVAudioEngine
Building Modern Audio Apps with AVAudioEngineBob McCune
 
Core audio
Core audioCore audio
Core audioscussen
 
Ig2 task 1 work sheet 12378
Ig2 task 1 work sheet 12378Ig2 task 1 work sheet 12378
Ig2 task 1 work sheet 12378CallumDrakeCPFC
 
Sound recording glossary tom crook
Sound recording glossary tom crookSound recording glossary tom crook
Sound recording glossary tom crookTomCrook
 
gegerageSound recording glossary tom crook
gegerageSound recording glossary tom crookgegerageSound recording glossary tom crook
gegerageSound recording glossary tom crookTomCrook
 
abra ka dabra.pdf
abra ka dabra.pdfabra ka dabra.pdf
abra ka dabra.pdfdiljots78
 
IG2 Task 1 Worksheet
IG2 Task 1 WorksheetIG2 Task 1 Worksheet
IG2 Task 1 WorksheetSamDuxburyGDS
 
Loading viewing/listening to Image and Audio, Fonts, Colors in Java
Loading viewing/listening to  Image and Audio, Fonts, Colors in JavaLoading viewing/listening to  Image and Audio, Fonts, Colors in Java
Loading viewing/listening to Image and Audio, Fonts, Colors in JavaVishnuMenon59
 
Ig2 task 1 work sheet (revisited)
Ig2 task 1 work sheet (revisited)Ig2 task 1 work sheet (revisited)
Ig2 task 1 work sheet (revisited)Mrrrjones
 
Anthony bowes IG2 task 1
Anthony bowes  IG2 task 1 Anthony bowes  IG2 task 1
Anthony bowes IG2 task 1 bowes96123
 
Sound recording glossary
Sound recording glossarySound recording glossary
Sound recording glossaryBen Atherton
 

Similar to 1.playing audio in javaJava sound API(package javax.sound) support.pdf (20)

Sound recording glossary
Sound recording glossarySound recording glossary
Sound recording glossary
 
Sound recording glossary
Sound recording glossarySound recording glossary
Sound recording glossary
 
IG2 Task 1 Work Sheet
IG2 Task 1 Work SheetIG2 Task 1 Work Sheet
IG2 Task 1 Work Sheet
 
What Shazam doesn't want you to know
What Shazam doesn't want you to knowWhat Shazam doesn't want you to know
What Shazam doesn't want you to know
 
Sound Recording Glossary
Sound Recording GlossarySound Recording Glossary
Sound Recording Glossary
 
Thingy editedd
Thingy editeddThingy editedd
Thingy editedd
 
Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02
 
Building Modern Audio Apps with AVAudioEngine
Building Modern Audio Apps with AVAudioEngineBuilding Modern Audio Apps with AVAudioEngine
Building Modern Audio Apps with AVAudioEngine
 
Core audio
Core audioCore audio
Core audio
 
Ig2 task 1 work sheet 12378
Ig2 task 1 work sheet 12378Ig2 task 1 work sheet 12378
Ig2 task 1 work sheet 12378
 
Sound recording glossary tom crook
Sound recording glossary tom crookSound recording glossary tom crook
Sound recording glossary tom crook
 
gegerageSound recording glossary tom crook
gegerageSound recording glossary tom crookgegerageSound recording glossary tom crook
gegerageSound recording glossary tom crook
 
Multimedia chapter 4
Multimedia chapter 4Multimedia chapter 4
Multimedia chapter 4
 
abra ka dabra.pdf
abra ka dabra.pdfabra ka dabra.pdf
abra ka dabra.pdf
 
IG2 Task 1 Worksheet
IG2 Task 1 WorksheetIG2 Task 1 Worksheet
IG2 Task 1 Worksheet
 
Loading viewing/listening to Image and Audio, Fonts, Colors in Java
Loading viewing/listening to  Image and Audio, Fonts, Colors in JavaLoading viewing/listening to  Image and Audio, Fonts, Colors in Java
Loading viewing/listening to Image and Audio, Fonts, Colors in Java
 
Scmad Chapter12
Scmad Chapter12Scmad Chapter12
Scmad Chapter12
 
Ig2 task 1 work sheet (revisited)
Ig2 task 1 work sheet (revisited)Ig2 task 1 work sheet (revisited)
Ig2 task 1 work sheet (revisited)
 
Anthony bowes IG2 task 1
Anthony bowes  IG2 task 1 Anthony bowes  IG2 task 1
Anthony bowes IG2 task 1
 
Sound recording glossary
Sound recording glossarySound recording glossary
Sound recording glossary
 

More from info30292

Use the Henderson eqn pOH = pKb + log(baseacid).pdf
                     Use the Henderson eqn pOH = pKb + log(baseacid).pdf                     Use the Henderson eqn pOH = pKb + log(baseacid).pdf
Use the Henderson eqn pOH = pKb + log(baseacid).pdfinfo30292
 
The purpose is to protonate the ether present the.pdf
                     The purpose is to protonate the ether present the.pdf                     The purpose is to protonate the ether present the.pdf
The purpose is to protonate the ether present the.pdfinfo30292
 
no reaction since in metal activity series Zn is .pdf
                     no reaction since in metal activity series Zn is .pdf                     no reaction since in metal activity series Zn is .pdf
no reaction since in metal activity series Zn is .pdfinfo30292
 
nuclei can contain different numbers of neutrons..pdf
                     nuclei can contain different numbers of neutrons..pdf                     nuclei can contain different numbers of neutrons..pdf
nuclei can contain different numbers of neutrons..pdfinfo30292
 
KOH is a base as will yield OH-. FeSO4 is a salt.pdf
                     KOH is a base as will yield OH-.  FeSO4 is a salt.pdf                     KOH is a base as will yield OH-.  FeSO4 is a salt.pdf
KOH is a base as will yield OH-. FeSO4 is a salt.pdfinfo30292
 
The vagus nerve is the longest cranial nerve. It contains motor and .pdf
The vagus nerve is the longest cranial nerve. It contains motor and .pdfThe vagus nerve is the longest cranial nerve. It contains motor and .pdf
The vagus nerve is the longest cranial nerve. It contains motor and .pdfinfo30292
 
Solution 3-2Following are the basic users of financial statements.pdf
Solution 3-2Following are the basic users of financial statements.pdfSolution 3-2Following are the basic users of financial statements.pdf
Solution 3-2Following are the basic users of financial statements.pdfinfo30292
 
So, you know that atoms have electrons. But how are they organized a.pdf
So, you know that atoms have electrons. But how are they organized a.pdfSo, you know that atoms have electrons. But how are they organized a.pdf
So, you know that atoms have electrons. But how are they organized a.pdfinfo30292
 
Rutherford model of atom1) The electron cloud of the atom does n.pdf
Rutherford model of atom1) The electron cloud of the atom does n.pdfRutherford model of atom1) The electron cloud of the atom does n.pdf
Rutherford model of atom1) The electron cloud of the atom does n.pdfinfo30292
 
Raising the pH will increase the basicity of the solution.Since su.pdf
Raising the pH will increase the basicity of the solution.Since su.pdfRaising the pH will increase the basicity of the solution.Since su.pdf
Raising the pH will increase the basicity of the solution.Since su.pdfinfo30292
 
Process improvementThe chance for development to either operating.pdf
Process improvementThe chance for development to either operating.pdfProcess improvementThe chance for development to either operating.pdf
Process improvementThe chance for development to either operating.pdfinfo30292
 
Net operating assets = operating assets-operating liabilitiesNet o.pdf
Net operating assets = operating assets-operating liabilitiesNet o.pdfNet operating assets = operating assets-operating liabilitiesNet o.pdf
Net operating assets = operating assets-operating liabilitiesNet o.pdfinfo30292
 
In above scenarion Animator class,Actor pikachu=new Actor (picka.pdf
In above scenarion Animator class,Actor pikachu=new Actor (picka.pdfIn above scenarion Animator class,Actor pikachu=new Actor (picka.pdf
In above scenarion Animator class,Actor pikachu=new Actor (picka.pdfinfo30292
 
import java.util.; public class NaturalNumberTriangle { publi.pdf
import java.util.; public class NaturalNumberTriangle { publi.pdfimport java.util.; public class NaturalNumberTriangle { publi.pdf
import java.util.; public class NaturalNumberTriangle { publi.pdfinfo30292
 
HNO3 is a strong acid pH = -log[H+] = -log[0.05] = 1.3p.pdf
HNO3 is a strong acid  pH = -log[H+] = -log[0.05] = 1.3p.pdfHNO3 is a strong acid  pH = -log[H+] = -log[0.05] = 1.3p.pdf
HNO3 is a strong acid pH = -log[H+] = -log[0.05] = 1.3p.pdfinfo30292
 
From psychological and cognitive perspectives, there are two basic b.pdf
From psychological and cognitive perspectives, there are two basic b.pdfFrom psychological and cognitive perspectives, there are two basic b.pdf
From psychological and cognitive perspectives, there are two basic b.pdfinfo30292
 
Formatting and code conversion occurs in the Presentation layer of t.pdf
Formatting and code conversion occurs in the Presentation layer of t.pdfFormatting and code conversion occurs in the Presentation layer of t.pdf
Formatting and code conversion occurs in the Presentation layer of t.pdfinfo30292
 
Correct answer is option A. As epistasis occurs when the effect of o.pdf
Correct answer is option A. As epistasis occurs when the effect of o.pdfCorrect answer is option A. As epistasis occurs when the effect of o.pdf
Correct answer is option A. As epistasis occurs when the effect of o.pdfinfo30292
 
Cloud computingIt is a kind of net based computing that gives sha.pdf
Cloud computingIt is a kind of net based computing that gives sha.pdfCloud computingIt is a kind of net based computing that gives sha.pdf
Cloud computingIt is a kind of net based computing that gives sha.pdfinfo30292
 
Check listpolicy to be implemented for having controls for purchasi.pdf
Check listpolicy to be implemented for having controls for purchasi.pdfCheck listpolicy to be implemented for having controls for purchasi.pdf
Check listpolicy to be implemented for having controls for purchasi.pdfinfo30292
 

More from info30292 (20)

Use the Henderson eqn pOH = pKb + log(baseacid).pdf
                     Use the Henderson eqn pOH = pKb + log(baseacid).pdf                     Use the Henderson eqn pOH = pKb + log(baseacid).pdf
Use the Henderson eqn pOH = pKb + log(baseacid).pdf
 
The purpose is to protonate the ether present the.pdf
                     The purpose is to protonate the ether present the.pdf                     The purpose is to protonate the ether present the.pdf
The purpose is to protonate the ether present the.pdf
 
no reaction since in metal activity series Zn is .pdf
                     no reaction since in metal activity series Zn is .pdf                     no reaction since in metal activity series Zn is .pdf
no reaction since in metal activity series Zn is .pdf
 
nuclei can contain different numbers of neutrons..pdf
                     nuclei can contain different numbers of neutrons..pdf                     nuclei can contain different numbers of neutrons..pdf
nuclei can contain different numbers of neutrons..pdf
 
KOH is a base as will yield OH-. FeSO4 is a salt.pdf
                     KOH is a base as will yield OH-.  FeSO4 is a salt.pdf                     KOH is a base as will yield OH-.  FeSO4 is a salt.pdf
KOH is a base as will yield OH-. FeSO4 is a salt.pdf
 
The vagus nerve is the longest cranial nerve. It contains motor and .pdf
The vagus nerve is the longest cranial nerve. It contains motor and .pdfThe vagus nerve is the longest cranial nerve. It contains motor and .pdf
The vagus nerve is the longest cranial nerve. It contains motor and .pdf
 
Solution 3-2Following are the basic users of financial statements.pdf
Solution 3-2Following are the basic users of financial statements.pdfSolution 3-2Following are the basic users of financial statements.pdf
Solution 3-2Following are the basic users of financial statements.pdf
 
So, you know that atoms have electrons. But how are they organized a.pdf
So, you know that atoms have electrons. But how are they organized a.pdfSo, you know that atoms have electrons. But how are they organized a.pdf
So, you know that atoms have electrons. But how are they organized a.pdf
 
Rutherford model of atom1) The electron cloud of the atom does n.pdf
Rutherford model of atom1) The electron cloud of the atom does n.pdfRutherford model of atom1) The electron cloud of the atom does n.pdf
Rutherford model of atom1) The electron cloud of the atom does n.pdf
 
Raising the pH will increase the basicity of the solution.Since su.pdf
Raising the pH will increase the basicity of the solution.Since su.pdfRaising the pH will increase the basicity of the solution.Since su.pdf
Raising the pH will increase the basicity of the solution.Since su.pdf
 
Process improvementThe chance for development to either operating.pdf
Process improvementThe chance for development to either operating.pdfProcess improvementThe chance for development to either operating.pdf
Process improvementThe chance for development to either operating.pdf
 
Net operating assets = operating assets-operating liabilitiesNet o.pdf
Net operating assets = operating assets-operating liabilitiesNet o.pdfNet operating assets = operating assets-operating liabilitiesNet o.pdf
Net operating assets = operating assets-operating liabilitiesNet o.pdf
 
In above scenarion Animator class,Actor pikachu=new Actor (picka.pdf
In above scenarion Animator class,Actor pikachu=new Actor (picka.pdfIn above scenarion Animator class,Actor pikachu=new Actor (picka.pdf
In above scenarion Animator class,Actor pikachu=new Actor (picka.pdf
 
import java.util.; public class NaturalNumberTriangle { publi.pdf
import java.util.; public class NaturalNumberTriangle { publi.pdfimport java.util.; public class NaturalNumberTriangle { publi.pdf
import java.util.; public class NaturalNumberTriangle { publi.pdf
 
HNO3 is a strong acid pH = -log[H+] = -log[0.05] = 1.3p.pdf
HNO3 is a strong acid  pH = -log[H+] = -log[0.05] = 1.3p.pdfHNO3 is a strong acid  pH = -log[H+] = -log[0.05] = 1.3p.pdf
HNO3 is a strong acid pH = -log[H+] = -log[0.05] = 1.3p.pdf
 
From psychological and cognitive perspectives, there are two basic b.pdf
From psychological and cognitive perspectives, there are two basic b.pdfFrom psychological and cognitive perspectives, there are two basic b.pdf
From psychological and cognitive perspectives, there are two basic b.pdf
 
Formatting and code conversion occurs in the Presentation layer of t.pdf
Formatting and code conversion occurs in the Presentation layer of t.pdfFormatting and code conversion occurs in the Presentation layer of t.pdf
Formatting and code conversion occurs in the Presentation layer of t.pdf
 
Correct answer is option A. As epistasis occurs when the effect of o.pdf
Correct answer is option A. As epistasis occurs when the effect of o.pdfCorrect answer is option A. As epistasis occurs when the effect of o.pdf
Correct answer is option A. As epistasis occurs when the effect of o.pdf
 
Cloud computingIt is a kind of net based computing that gives sha.pdf
Cloud computingIt is a kind of net based computing that gives sha.pdfCloud computingIt is a kind of net based computing that gives sha.pdf
Cloud computingIt is a kind of net based computing that gives sha.pdf
 
Check listpolicy to be implemented for having controls for purchasi.pdf
Check listpolicy to be implemented for having controls for purchasi.pdfCheck listpolicy to be implemented for having controls for purchasi.pdf
Check listpolicy to be implemented for having controls for purchasi.pdf
 

Recently uploaded

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningMarc Dusseiller Dusjagr
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxCeline George
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of PlayPooky Knightsmith
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfNirmal Dwivedi
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111GangaMaiya1
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17Celine George
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code ExamplesPeter Brusilovsky
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MysoreMuleSoftMeetup
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 

Recently uploaded (20)

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 

1.playing audio in javaJava sound API(package javax.sound) support.pdf

  • 1. 1.playing audio in java Java sound API(package javax.sound) supports two types of audios: - sampled audio - musical instrument digital interface(MIDI) sampled audio: In the sampled audio ,the supported file formats are: AIFC,AIFF,WAVE,SND,AU and doesn't support the audio format MP3. Provide two ways to play the audio: using clip and using source data line using clip : (javax.sound.sampled.clip) used to play a short sound file. In this method the whole audio clip is loaded into the memoryto have control over audio clip before playing it. steps for playing the audio file: 1. create an audioInputStream for a given sound file. 2. acquire audio format and create DataLine.Info Object 3.Obtain the clip 4.open the AudioInputStream ,start playing 5.close the resource acquired using source data line :(javax.sound.sampled.SourceDataLine),used to play the long sound line. these type of sounds cant be preloaded into the memory so, the data is read into the buffer in the form of bytes repeatedly. steps for playing the audio file: 1. open the sorce data file similarly by creating,acquiring and obtaining as in clip. 2. open and start the sound file 3. repeatedly read a chunk of bytes from the AudioInputStream and send it to the SourceDataLine's buffer untill reaching the end f the file 4.close the resource acquired. Musical Instrument Digital Interface(MIDI): music is synthesized from special nodes and effects. steps for playing the audio: 1. allocate a sequence piped from a MIDI file 2. allocate a sequencer to play a MIDI sequence 3. set the current sequence for the sequencer to play 4. open the sequencer to load the sequence. 5. set the loop count by using SetLoopCount() and start playing the music by using start() 6. stop the play using stop(). 2. creating a timer:
  • 2. the Timer is provided in the java.util package. In which we create an instance for thread like Thread thread= new Thread(); then using this instance thread we use the sleep() available in the timer class as follows: thread.sleep(); here the arguments int the sleep() is nothing but the time in milli seconds for example: thread.sleep(2000) will sleep the process execution or triggering for 20 seconds. BLanks: 1. actionPerformed() in the Listener interface 2. 3. close() 4. 5. scope Solution 1.playing audio in java Java sound API(package javax.sound) supports two types of audios: - sampled audio - musical instrument digital interface(MIDI) sampled audio: In the sampled audio ,the supported file formats are: AIFC,AIFF,WAVE,SND,AU and doesn't support the audio format MP3. Provide two ways to play the audio: using clip and using source data line using clip : (javax.sound.sampled.clip) used to play a short sound file. In this method the whole audio clip is loaded into the memoryto have control over audio clip before playing it. steps for playing the audio file: 1. create an audioInputStream for a given sound file. 2. acquire audio format and create DataLine.Info Object 3.Obtain the clip 4.open the AudioInputStream ,start playing 5.close the resource acquired
  • 3. using source data line :(javax.sound.sampled.SourceDataLine),used to play the long sound line. these type of sounds cant be preloaded into the memory so, the data is read into the buffer in the form of bytes repeatedly. steps for playing the audio file: 1. open the sorce data file similarly by creating,acquiring and obtaining as in clip. 2. open and start the sound file 3. repeatedly read a chunk of bytes from the AudioInputStream and send it to the SourceDataLine's buffer untill reaching the end f the file 4.close the resource acquired. Musical Instrument Digital Interface(MIDI): music is synthesized from special nodes and effects. steps for playing the audio: 1. allocate a sequence piped from a MIDI file 2. allocate a sequencer to play a MIDI sequence 3. set the current sequence for the sequencer to play 4. open the sequencer to load the sequence. 5. set the loop count by using SetLoopCount() and start playing the music by using start() 6. stop the play using stop(). 2. creating a timer: the Timer is provided in the java.util package. In which we create an instance for thread like Thread thread= new Thread(); then using this instance thread we use the sleep() available in the timer class as follows: thread.sleep(); here the arguments int the sleep() is nothing but the time in milli seconds for example: thread.sleep(2000) will sleep the process execution or triggering for 20 seconds. BLanks: 1. actionPerformed() in the Listener interface 2. 3. close() 4. 5. scope