0% found this document useful (0 votes)
21 views13 pages

Sandy AJP Micro

Uploaded by

SandyKing31
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views13 pages

Sandy AJP Micro

Uploaded by

SandyKing31
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

A

PROJECT REPORT

ON

“MUSIC PLAYER USING JAVA”

SHIVAJI POLYTECHNIC, ATPADI

IN THE PARTIAL FULFILLMENT OF THE REQUIREMENTS OF

DIPLOMA IN COMPUTER TECHNOLOGY


SUBMITTED BY

ENROLLMENT NO. NAME OF STUDENT EXAM SEAT NO.

2212090011 Mr. Sandip Tukaram Babar 248453

UNDER THE GUIDENCE OF

Mr. Landage P.S.

SHRIRAM BAHUUDDESHIYA SEVABHAVI SANSTHA

SHIVAJI POLYTECHNIC, ATPADI


DEPARTMENT OF COMPUTER

TECHNOLOGY (2024-2025)
SHIVAJI POLYTECHNIC, ATPADI

CERTIFICATE
This is to certify that,

ENROLLMENT NO. NAME OF STUDENT EXAM SEAT


NO

2212090011 Mr. Sandip Tukaram Babar 248453

Of Class TY (Computer Technology) as per the curriculum laid down by the Maharashtra
State Board of Technical Education, Mumbai have successfully completed entitled

“Music Player using Java”

Under our guidance in satisfactory manner as a part of academic syllabus during the
academic year 2024-2025
Date:

Place: Atpadi

Prof. Landage P.S. Prof. Belasare .A.T. Prof. Kulkarni

O.G. (Guide) (HOD) (Principal)


Acknowledgments
I would like to express my sincere gratitude to my Guide & HOD
(COMPUTER TECHNOLOGY) Prof. Miss. Belasare A.T. For the continuous
support of my project for his patience, motivation, enthusiasm, and immense
knowledge. His guidance helped me in all the time of project and writing of this
project report. I could not have imagined having a better adviser and mentor for
my project.

I am equally indebted to guide Prof. Mr. Landage P.S. for extending


necessary help, providing facilities and time to time valuable guidance. I also
take this opportunity to convey my sincere thanks to all my teachers and
faculties of computer department. I would like to thanks our respected principal
Prof. Mr. Kulkarni O.G. For his kind blessings, inspiration and the necessary
support whenever needed.

Last but not the least; I would like thank my family for supporting me spiritually
through out my life.

ENROLLMENT EXAM SEAT


NAME OF STUDENT SIGNATURE
NO. NO.

2212090011 MR. SANDIP. T. BABAR 248453


Evolution sheet for Micro Project

Academic Year :- 2024-25 Name of Faculty :- Mr. Landage P.S.

Course :- Computer Technology Course Code :- CM5I


Subject : Advance Java Programming Subject Code :- 22517
Semester :- 5 Scheme :- I
Title of
"Music Player using Java"
Project :-
CO’s addressed by the Micro Project

A :- Develop programs to handle events in Java Programming.


B :- Develop programs using GUI Framework (AWT and Swing).
C :- Practical Implementation of Java I/O Operations.

Major Learning Outcomes Achieved by Students by Doing the


Project
PO 1 Design/Development of Solutions.

PO 2 Understanding Java Programming Concepts.

PO 3 Application of Java Libraries.

Comments/Suggestions about team work/leadership/inter-personal communication (if any)

Roll No. Name of Students Marks out Marks out of 4 Total


of 6 for for performance marks out
performance in of 10
in Group Oral/Presentation
Activity

05 Sandip Tukaram Babar


Name and
Signature of
Faculty Mr. Landage P.S.
INDEX

SR.NO TITLE

1. Introduction

2. Abstract

3. Code

4. Output

5. Conclusion

6. References
MUSIC PLAYER USING JAVA

INTRODUCTION

Java is a class-based, object-oriented programming language that is created to have as little execution
reliance as possible. It is a general-purpose programming language planned to let application developers
write once, and run anywhere (WORA), meaning that compiled Java code can run on all platforms that
support Java without the requirement for recompilation. Java applications are generally compiled to
bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer
architecture. The syntax of Java is identical to C and C++ but has fewer low-level facilities than either of
them. The Java runtime delivers dynamic abilities (such as reflection and runtime code modification) that
are generally not available in traditional compiled languages.

Java was initially developed by James Gosling at Sun Microsystems (which has since been accepted by
Oracle) and released in 1995 as a core component of Sun Microsystems' Java platform. The actual and
reference implementation of Java compilers, virtual machines, and class libraries were initially released
by Sun under proprietary licenses. As of May 2007, in compliance with the specifications of the Java
Community Process, Sun had relicensed most of its Java technologies under the GNU General Public
License. Oracle offers its own HotSpot Java Virtual Machine, however, the official reference
implementation is the OpenJDK JVM which is free open source software utilized by most developers
and is the default JVM for almost all Linux distributions.

Music Player lets you control all your music files fast and easily. This audio player supports nearly all
kinds of mp3, midi,wav, FLAC raw aac files, and additional audio formats . Easily browse and play music
songs by genres, albums, artists, songs, and folders. Media is a crucial factor in our lives. We are making
a media player using java to handle all the music requirements of the user.

James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991.
Java was initially developed for interactive television, but it was too advanced for the digital cable
television industry at the time. The language was originally called Oak after an oak tree that stood outside
Gosling's office. Later the project went by the name Green and was eventually renamed Java,

from Java coffee, the coffee from Indonesia. Gosling designed Java with a C/C++-style syntax that system
and application programmers would find familiar.
CODE

import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.advanced.AdvancedPlayer;
import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileInputStream;
import java.io.IOException;

public class MusicPlayer extends JFrame


{
private JButton playButton, pauseButton, stopButton, openButton;
private JFileChooser fileChooser;
private AdvancedPlayer player;
private FileInputStream fileInputStream;
private Thread playerThread;
private volatile boolean isPlaying = false;
private volatile boolean isPaused = false;
private String currentFile;

public MusicPlayer()
{
setTitle("Java Music Player");
setSize(400, 200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLayout(new FlowLayout());
getContentPane().setBackground(new Color(60, 63, 65));
openButton = createStyledButton("Open", new Color(102, 205, 170));
playButton = createStyledButton("Play", new Color(135, 206, 235));
pauseButton = createStyledButton("Pause", new Color(255, 160, 122));
stopButton = createStyledButton("Stop", new Color(240, 128, 128));
playButton.setEnabled(false);
pauseButton.setEnabled(false);
stopButton.setEnabled(false);
add(openButton);
add(playButton);
add(pauseButton);
add(stopButton);
fileChooser = new JFileChooser();
openButton.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
int returnValue = fileChooser.showOpenDialog(null);
if (returnValue == JFileChooser.APPROVE_OPTION)
{
currentFile = fileChooser.getSelectedFile().getPath();
playButton.setEnabled(true);
pauseButton.setEnabled(false);
stopButton.setEnabled(false);
}
}
});
playButton.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
if (isPaused)
{
isPaused = false;
synchronized (playerThread)
{
playerThread.notify();
}
} else
{
playMusic(currentFile);
}
playButton.setEnabled(false);
pauseButton.setEnabled(true);
stopButton.setEnabled(true);
}
});
pauseButton.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
isPaused = true;
pauseButton.setEnabled(false);
playButton.setEnabled(true);
}
});
stopButton.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
stopMusic();
playButton.setEnabled(true);
pauseButton.setEnabled(false);
stopButton.setEnabled(false);
}
});
}
private JButton createStyledButton(String text, Color color)
{
JButton button = new JButton(text);
button.setBackground(color);
button.setForeground(Color.WHITE);
button.setFont(new Font("Arial", Font.BOLD, 14));
button.setFocusPainted(false);
button.setBorder(new LineBorder(Color.DARK_GRAY, 2));
button.setPreferredSize(new Dimension(80, 40));
button.setCursor(new Cursor(Cursor.HAND_CURSOR));
button.setToolTipText(text + " button");
button.addMouseListener(new java.awt.event.MouseAdapter()
{
public void mouseEntered(java.awt.event.MouseEvent evt)
{
button.setBackground(button.getBackground().darker());
}
public void mouseExited(java.awt.event.MouseEvent evt)
{
button.setBackground(color);
}
});
return button;
}

private void playMusic(String filePath)


{
playerThread = new Thread(() ->
{
try
{
fileInputStream = new FileInputStream(filePath);
player = new AdvancedPlayer(fileInputStream);
isPlaying = true;
player.play();
isPlaying = false;
SwingUtilities.invokeLater(() ->
{
playButton.setEnabled(true);
pauseButton.setEnabled(false);
stopButton.setEnabled(false);
});
} catch (JavaLayerException | IOException ex)
{
ex.printStackTrace();
}
});
playerThread.start();
}
private void stopMusic()
{
if (player != null)
{
player.close();
isPlaying = false;
}
if (fileInputStream != null)
{
try
{
fileInputStream.close();
} catch (IOException ex)
{
ex.printStackTrace();
}
}
playerThread = null;
}

public static void main(String[] args)


{
SwingUtilities.invokeLater(() ->
{
MusicPlayer musicPlayer = new MusicPlayer();
musicPlayer.setVisible(true);
});
}
}
OUTPUT
CONCLUSION

One of the most important benefits of Java is its capacity to move easily from one

computer system to another. The capability to run the same program on many

different systems is essential to World Wide Web software, and Java grows at this

by being platform-independent at both the source and binary levels.


REFERENCES

1. "Java Programming" by E. Balagurusamy - If you're building your music player using Java, this

book provides excellent foundational concepts.

2. "Python Programming: An Introduction to Computer Science" by John Zelle - If Python is the

language of choice, this book can guide you through the coding concepts.

3. "Multimedia Systems" by Ralf Steinmetz and Klara Nahrstedt - This book discusses the theory

behind multimedia applications, including sound and audio.

You might also like