Sunday, April 5, 2015

Simple Wave File Player

Introduction

This post presents a simple Wave File Player written in Java, using the sampled sound API. Since we are not using JavaFX, it will not support the mp3 format.

Import

We will be using API from the javax.sound.sampled package. Hence we make the following imports at the beginning of the program.
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.DataLine;


Progress bar

We will use a JSlider as a progress bar. The scale are from 0 to 10000, which is simple to represent 0 to 100% with two decimal place. To update the progress, the following method will be invoked by a Swing Timer on every 30ms.

Sample Wave File

  epic_loop.wav : Orchestral Adventure by RevampedPRO, CC BY 3.0 license 
                  http://opengameart.org/content/orchestral-adventure 

  twoTone2.wav : "63 Digital sound effects" by Kenney, CC0 license, 
    http://opengameart.org/content/63-digital-sound-effects-lasers-phasers-space-etc
The wave files are inside a github project. Follow the following link to download the project as a zip file.
https://github.com/macteki/WavePlayer

Source Code

12 comments:

  1. Poker Kiu Kiu Online Android is a large company based on legal online gambling which is equipped with a high level of security.

    ReplyDelete
  2. Slot Deposit Pulsa is a legal gambling company based in Indonesia with more than 10 million people.

    ReplyDelete
  3. Judi Deposit Pulsa Indonesian gambling companies are on the rise because the security on their website is very strong.

    ReplyDelete
  4. Ceme Online Idnplay a trusted online gambling company from Indonesia.

    ReplyDelete
  5. Daftar Idnplay the largest online gambling company in the world located in the country of Indonesia.

    ReplyDelete
  6. Bola Gelinding a company that comes from Indonesia with the best website system.

    ReplyDelete
  7. Daftar Sbobet gambling company which is one of the largest and most trusted companies in southeast asia.

    ReplyDelete
  8. Judi Deposit Pulsa88 is the largest gambling company in Southeast Asia originating from Indonesia.

    ReplyDelete
  9. Poker Deposit Pulsa88 is an Indonesian gambling company that is well known throughout Southeast Asia.

    ReplyDelete
  10. Dadu Online is a gambling company originating from Indonesia with more than 2 million users from all over the world.

    ReplyDelete
  11. Bola88 a gambling company that originated from Indonesia.

    ReplyDelete
  12. Idnplay Poker medium-sized companies engaged in gambling games and their websites and applications.

    ReplyDelete