程序代写代做代考 Hive Java Assignment #1 Due 5pm on Wed, Sep. 30

Assignment #1 Due 5pm on Wed, Sep. 30
Overview
An audio conference, or Voice over IP (VoIP) application, allows people to talk to each other from computers connected across a network. Although networked computers have been able to do audio well for over 10 years, the explosive growth of the Web and other aspects of the Internet has fueled interest in VoIP.
For this assignment, you are to write a basic two-person VoIP application named Speak and explore how some basic system parameters effect the quality of the audio stream.
Speak can have a minimal user interface, but needs to support some command line parameters (or basic menu interface) to allow varying of system parameters. You are free to add any additional features, as you see fit.
Details
You can develop Speak on pretty much any OS: Windows, Mac or Linux. You will have to get it working on two machines, eventually.
Speak will use standard Internet sockets to make connections between the VoIP processes. From any Internet host, a user running Speak should be able to connect to another user
running Speak from any other Internet host, so you need a way to specify the hosts at run-time. You may pick a port numbers of your choice (10000 – 65000).
Speak uses one UDP socket, which you will use to receive and send sound data. Speak should support a variety of samples intervals. Typical VoIP clients take chunks of audio from the audio device every 20, 40 or 60 ms in order to keep latency low. Running Speak at larger sample intervals will give you some insight in how latency makes interactive communication difficult.
In order to evaluate how Internet packet loss affects audio, Speak must be able to randomly drop packets it receives. Loss should be done on a packet level and at various rates specified
when Speak starts.
You will be running Speak with the following command:
java Speak : either IP address or host name : chunk size in ms (20-1000)
: 0.0-1.0 (fraction of lost packets)
For example, if I wanted to connect to with the loss rate of 0.05 (5%) and the chunk size of 100 ms, I will initiate my program by:
hosta.stlawu.edu
java Speak hosta.stlawu.edu 100 0.05
java Speak localhost 100 0.05
You can test Speak on a single machine by connecting to localhost, which makes Speak act as an echo application.

MyAudio
I have written the MyAudio class that will facilitate reading and writing to the sound device in Java. You can download MyAudio.java from the attachment and copy/paste into your Eclipse project. You can find more documentation here: MyAudio Documentation.
Digital audio is represented by taking a sound sample at a consistent interval. MyAudio captures sound samples at 16000 Hz (16000 times per second). Each sound sample is a 2-byte
signed int value. For example, a 1-second of audio is 16000 samples * 2 bytes/sample = 32000 bytes long.
Hints
You need to read and write to the socket at the same time. You can run two threads simultaneously: one to read from the socket and the other to write to the socket. In Java, you can create threads using the Runnable class. Check out the runnableSample.java program in which one thread increases the variable while the other thread decreases the variable. (You can use other concurrent programming techniques if you want.)
You can refer to the UDP socket client and server programs attached in this assignment as reference for UDP communication. (from https://systembash.com/a-simple-java-udp-server-and-udp- client/ )
Submission
You must turn in all source code used in your project via Gradescope. Please do not archive them (zip, etc.) and submit all Java codes as is.
Grading
• Implementation
o Parsing parameters correctly (5)
o Supports variable chunk sizes (5)
o Records and sends sound data correctly (10)
o Receives and plays back sound data correctly (10) o Simulate loss rate correctly (5)
• Documentation (5 points)
o your name and description of the program at the top of the source files o javadoc and other comments that describe blocks of your code
o descriptive variable and constant names
o indentation, spacing, etc. for readability