Over 10 Million Study Resources Now at Your Fingertips


Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Language:EN
Pages: 47

Applet programming with the java sound api

Applet Programming
With the Java™ Sound API

Florian Bomers
Software Engineer

2

Overall Presentation Goal

Learn how to create applets that use the Java™ Sound API for recording and playing audio data

3

As a result of this presentation, you will know how to

– Play and record streamed audio data

1378, Applet Programming with the Java™ Sound API

4

• Both have been programming with the Java Sound API since its very beginning

• Both are leading the Tritonus project—an open

5

• Demo of the example application: a web-based answering machine

• General architecture and program details

6

Answering Machine Demo

1378, Applet Programming with the Java™ Sound API

• Applet records audio data from soundcard• Applet sends it to the server
• Server receives audio data
• Server saves data in a file

7

Caller Applet

General Architecture

Owner Data Flow

8 Server
9

General Architecture

Streams

• Playback uses a subclass of OutputStream that writes to a SourceDataLine

1378, Applet Programming with the Java™ Sound API

10

Read

Synchronizer Write

Net Output

Flow Flow
Synchronizer Write

Net Input

Flow Flow

1378, Applet Programming with the Java™ Sound API

11
GSM Encoder

Read

Synchronizer

Flow Flow
GSM Decoder Write

Net Input

Flow Flow

1378, Applet Programming with the Java™ Sound API

12

Program Details

public void run() {
while (true) {
int bytesRead =
inStream.read( buffer, 0, buffer.length);
outStream.write(buffer, 0, bytesRead); }

13

(org.jsresources.am.audio.Synchronizer)

14

Program Details

15

Program Details
Caller: get AudioInputStream
AudioInputStream pcmAIS =
newAudioInputStream(line); • AudioInputStream is an InputStream with
– Audio format definition
– Optional length definition

16

(org.jsresources.am.audio.AudioCapture)

• Codecs are plug-ins to the Java™
Sound API using the Extension Mechanism

(Service Providers)

17

Program Details

18

AudioSystem retrieves the GSM codecs from the list of installed plug-ins

(org.jsresources.am.CallerClient)

• Network may be slower than audio data coming in

➔ network connection is buffered
– The network output stream is cascaded in an OutputStream that queues all data written to it
– In a thread, it writes all data to the network output stream

19

Program Details
Caller: Using the Synchronzer
Synchronizer sync = newSynchronizer(

gsmAIS,

// input stream

20 (org.jsresources.am.CallerClient)
How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Payment
Make payment
Document download
Download File
PageId: ELI223BC47
img
Uploaded by :
9EeVe0bz
Page 1 Preview
applet programming with the java sound api
Sell Your Old Documents & Earn Wallet Balance