Skip to content

Commit faf0fd1

Browse files
authoredMay 28, 2023
Add files via upload
1 parent 8a998c0 commit faf0fd1

18 files changed

+2249
-0
lines changed
 

‎javasound.wav

20 KB
Binary file not shown.

‎playAudio/build.xml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- You may freely edit this file. See commented blocks below for -->
3+
<!-- some examples of how to customize the build. -->
4+
<!-- (If you delete it and reopen the project it will be recreated.) -->
5+
<!-- By default, only the Clean and Build commands use this build script. -->
6+
<!-- Commands such as Run, Debug, and Test only use this build script if -->
7+
<!-- the Compile on Save feature is turned off for the project. -->
8+
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
9+
<!-- in the project's Project Properties dialog box.-->
10+
<project name="playAudio" default="default" basedir=".">
11+
<description>Builds, tests, and runs the project playAudio.</description>
12+
<import file="nbproject/build-impl.xml"/>
13+
<!--
14+
15+
There exist several targets which are by default empty and which can be
16+
used for execution of your tasks. These targets are usually executed
17+
before and after some main targets. They are:
18+
19+
-pre-init: called before initialization of project properties
20+
-post-init: called after initialization of project properties
21+
-pre-compile: called before javac compilation
22+
-post-compile: called after javac compilation
23+
-pre-compile-single: called before javac compilation of single file
24+
-post-compile-single: called after javac compilation of single file
25+
-pre-compile-test: called before javac compilation of JUnit tests
26+
-post-compile-test: called after javac compilation of JUnit tests
27+
-pre-compile-test-single: called before javac compilation of single JUnit test
28+
-post-compile-test-single: called after javac compilation of single JUunit test
29+
-pre-jar: called before JAR building
30+
-post-jar: called after JAR building
31+
-post-clean: called after cleaning build products
32+
33+
(Targets beginning with '-' are not intended to be called on their own.)
34+
35+
Example of inserting an obfuscator after compilation could look like this:
36+
37+
<target name="-post-compile">
38+
<obfuscate>
39+
<fileset dir="${build.classes.dir}"/>
40+
</obfuscate>
41+
</target>
42+
43+
For list of available properties check the imported
44+
nbproject/build-impl.xml file.
45+
46+
47+
Another way to customize the build is by overriding existing main targets.
48+
The targets of interest are:
49+
50+
-init-macrodef-javac: defines macro for javac compilation
51+
-init-macrodef-junit: defines macro for junit execution
52+
-init-macrodef-debug: defines macro for class debugging
53+
-init-macrodef-java: defines macro for class execution
54+
-do-jar: JAR building
55+
run: execution of project
56+
-javadoc-build: Javadoc generation
57+
test-report: JUnit report generation
58+
59+
An example of overriding the target for project execution could look like this:
60+
61+
<target name="run" depends="playAudio-impl.jar">
62+
<exec dir="bin" executable="launcher.exe">
63+
<arg file="${dist.jar}"/>
64+
</exec>
65+
</target>
66+
67+
Notice that the overridden target depends on the jar target and not only on
68+
the compile target as the regular run target does. Again, for a list of available
69+
properties which you can use, check the target you are overriding in the
70+
nbproject/build-impl.xml file.
71+
72+
-->
73+
</project>

‎playAudio/build/built-jar.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#Tue, 16 May 2023 15:50:36 +0530
2+
3+
4+
C\:\\Users\\suw\\Documents\\NetBeansProjects\\playAudio=
776 Bytes
Binary file not shown.
Binary file not shown.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
3+
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
4+
<Properties>
5+
<Property name="defaultCloseOperation" type="int" value="3"/>
6+
</Properties>
7+
<SyntheticProperties>
8+
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
9+
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
10+
</SyntheticProperties>
11+
<AuxValues>
12+
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
13+
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
14+
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
15+
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
16+
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
17+
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
18+
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
19+
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
20+
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
21+
</AuxValues>
22+
23+
<Layout>
24+
<DimensionLayout dim="0">
25+
<Group type="103" groupAlignment="0" attributes="0">
26+
<Group type="102" alignment="0" attributes="0">
27+
<EmptySpace min="-2" pref="39" max="-2" attributes="0"/>
28+
<Component id="jButton1" min="-2" pref="261" max="-2" attributes="0"/>
29+
<EmptySpace pref="100" max="32767" attributes="0"/>
30+
</Group>
31+
</Group>
32+
</DimensionLayout>
33+
<DimensionLayout dim="1">
34+
<Group type="103" groupAlignment="0" attributes="0">
35+
<Group type="102" alignment="1" attributes="0">
36+
<EmptySpace pref="165" max="32767" attributes="0"/>
37+
<Component id="jButton1" min="-2" pref="72" max="-2" attributes="0"/>
38+
<EmptySpace min="-2" pref="63" max="-2" attributes="0"/>
39+
</Group>
40+
</Group>
41+
</DimensionLayout>
42+
</Layout>
43+
<SubComponents>
44+
<Component class="javax.swing.JButton" name="jButton1">
45+
<Properties>
46+
<Property name="text" type="java.lang.String" value="PLAY Audio"/>
47+
</Properties>
48+
<Events>
49+
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
50+
</Events>
51+
</Component>
52+
</SubComponents>
53+
</Form>
420 Bytes
Binary file not shown.

‎playAudio/manifest.mf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Manifest-Version: 1.0
2+
X-COMMENT: Main-Class will be added automatically by build
3+

‎playAudio/nbproject/build-impl.xml

Lines changed: 1771 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
build.xml.data.CRC32=d3b46f65
2+
build.xml.script.CRC32=819c8446
3+
build.xml.stylesheet.CRC32=f85dc8f2@1.102.0.48
4+
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5+
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6+
nbproject/build-impl.xml.data.CRC32=d3b46f65
7+
nbproject/build-impl.xml.script.CRC32=a50b974a
8+
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.102.0.48

‎playAudio/nbproject/private/config.properties

Whitespace-only changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
compile.on.save=true
2+
do.depend=false
3+
do.jar=true
4+
do.jlink=false
5+
javac.debug=true
6+
javadoc.preview=true
7+
jlink.strip=false
8+
user.properties.file=C:\\Users\\suw\\AppData\\Roaming\\NetBeans\\13\\build.properties
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
3+
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
4+
</project-private>
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
annotation.processing.enabled=true
2+
annotation.processing.enabled.in.editor=false
3+
annotation.processing.processors.list=
4+
annotation.processing.run.all.processors=true
5+
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
6+
application.title=playAudio
7+
application.vendor=suw
8+
build.classes.dir=${build.dir}/classes
9+
build.classes.excludes=**/*.java,**/*.form
10+
# This directory is removed when the project is cleaned:
11+
build.dir=build
12+
build.generated.dir=${build.dir}/generated
13+
build.generated.sources.dir=${build.dir}/generated-sources
14+
# Only compile against the classpath explicitly listed here:
15+
build.sysclasspath=ignore
16+
build.test.classes.dir=${build.dir}/test/classes
17+
build.test.results.dir=${build.dir}/test/results
18+
# Uncomment to specify the preferred debugger connection transport:
19+
#debug.transport=dt_socket
20+
debug.classpath=\
21+
${run.classpath}
22+
debug.modulepath=\
23+
${run.modulepath}
24+
debug.test.classpath=\
25+
${run.test.classpath}
26+
debug.test.modulepath=\
27+
${run.test.modulepath}
28+
# Files in build.classes.dir which should be excluded from distribution jar
29+
dist.archive.excludes=
30+
# This directory is removed when the project is cleaned:
31+
dist.dir=dist
32+
dist.jar=${dist.dir}/playAudio.jar
33+
dist.javadoc.dir=${dist.dir}/javadoc
34+
dist.jlink.dir=${dist.dir}/jlink
35+
dist.jlink.output=${dist.jlink.dir}/playAudio
36+
endorsed.classpath=
37+
excludes=
38+
includes=**
39+
jar.compress=false
40+
javac.classpath=
41+
# Space-separated list of extra javac options
42+
javac.compilerargs=
43+
javac.deprecation=false
44+
javac.external.vm=true
45+
javac.modulepath=
46+
javac.processormodulepath=
47+
javac.processorpath=\
48+
${javac.classpath}
49+
javac.source=18
50+
javac.target=18
51+
javac.test.classpath=\
52+
${javac.classpath}:\
53+
${build.classes.dir}
54+
javac.test.modulepath=\
55+
${javac.modulepath}
56+
javac.test.processorpath=\
57+
${javac.test.classpath}
58+
javadoc.additionalparam=
59+
javadoc.author=false
60+
javadoc.encoding=${source.encoding}
61+
javadoc.html5=false
62+
javadoc.noindex=false
63+
javadoc.nonavbar=false
64+
javadoc.notree=false
65+
javadoc.private=false
66+
javadoc.splitindex=true
67+
javadoc.use=true
68+
javadoc.version=false
69+
javadoc.windowtitle=
70+
# The jlink additional root modules to resolve
71+
jlink.additionalmodules=
72+
# The jlink additional command line parameters
73+
jlink.additionalparam=
74+
jlink.launcher=true
75+
jlink.launcher.name=playAudio
76+
main.class=playaudio.NewJFrame
77+
manifest.file=manifest.mf
78+
meta.inf.dir=${src.dir}/META-INF
79+
mkdist.disabled=false
80+
platform.active=default_platform
81+
run.classpath=\
82+
${javac.classpath}:\
83+
${build.classes.dir}
84+
# Space-separated list of JVM arguments used when running the project.
85+
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
86+
# To set system properties for unit tests define test-sys-prop.name=value:
87+
run.jvmargs=
88+
run.modulepath=\
89+
${javac.modulepath}
90+
run.test.classpath=\
91+
${javac.test.classpath}:\
92+
${build.test.classes.dir}
93+
run.test.modulepath=\
94+
${javac.test.modulepath}
95+
source.encoding=UTF-8
96+
src.dir=src
97+
test.src.dir=test

‎playAudio/nbproject/project.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://www.netbeans.org/ns/project/1">
3+
<type>org.netbeans.modules.java.j2seproject</type>
4+
<configuration>
5+
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
6+
<name>playAudio</name>
7+
<source-roots>
8+
<root id="src.dir"/>
9+
</source-roots>
10+
<test-roots>
11+
<root id="test.src.dir"/>
12+
</test-roots>
13+
</data>
14+
</configuration>
15+
</project>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
3+
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
4+
<Properties>
5+
<Property name="defaultCloseOperation" type="int" value="3"/>
6+
</Properties>
7+
<SyntheticProperties>
8+
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
9+
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
10+
</SyntheticProperties>
11+
<AuxValues>
12+
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
13+
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
14+
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
15+
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
16+
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
17+
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
18+
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
19+
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
20+
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
21+
</AuxValues>
22+
23+
<Layout>
24+
<DimensionLayout dim="0">
25+
<Group type="103" groupAlignment="0" attributes="0">
26+
<Group type="102" alignment="0" attributes="0">
27+
<EmptySpace min="-2" pref="39" max="-2" attributes="0"/>
28+
<Component id="jButton1" min="-2" pref="261" max="-2" attributes="0"/>
29+
<EmptySpace pref="100" max="32767" attributes="0"/>
30+
</Group>
31+
</Group>
32+
</DimensionLayout>
33+
<DimensionLayout dim="1">
34+
<Group type="103" groupAlignment="0" attributes="0">
35+
<Group type="102" alignment="1" attributes="0">
36+
<EmptySpace pref="165" max="32767" attributes="0"/>
37+
<Component id="jButton1" min="-2" pref="72" max="-2" attributes="0"/>
38+
<EmptySpace min="-2" pref="63" max="-2" attributes="0"/>
39+
</Group>
40+
</Group>
41+
</DimensionLayout>
42+
</Layout>
43+
<SubComponents>
44+
<Component class="javax.swing.JButton" name="jButton1">
45+
<Properties>
46+
<Property name="text" type="java.lang.String" value="PLAY Audio"/>
47+
</Properties>
48+
<Events>
49+
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
50+
</Events>
51+
</Component>
52+
</SubComponents>
53+
</Form>
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/*
2+
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3+
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
4+
*/
5+
package playaudio;
6+
7+
import java.io.File;
8+
import java.io.IOException;
9+
import javax.sound.sampled.AudioInputStream;
10+
import javax.sound.sampled.AudioSystem;
11+
import javax.sound.sampled.Clip;
12+
import javax.sound.sampled.LineUnavailableException;
13+
import javax.sound.sampled.UnsupportedAudioFileException;
14+
15+
/**
16+
*
17+
* @author suw
18+
*/
19+
public class NewJFrame extends javax.swing.JFrame {
20+
21+
/**
22+
* Creates new form NewJFrame
23+
*/
24+
public NewJFrame() {
25+
initComponents();
26+
}
27+
28+
/**
29+
* This method is called from within the constructor to initialize the form.
30+
* WARNING: Do NOT modify this code. The content of this method is always
31+
* regenerated by the Form Editor.
32+
*/
33+
@SuppressWarnings("unchecked")
34+
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
35+
private void initComponents() {
36+
37+
jButton1 = new javax.swing.JButton();
38+
39+
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
40+
41+
jButton1.setText("PLAY Audio");
42+
jButton1.addActionListener(new java.awt.event.ActionListener() {
43+
public void actionPerformed(java.awt.event.ActionEvent evt) {
44+
jButton1ActionPerformed(evt);
45+
}
46+
});
47+
48+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
49+
getContentPane().setLayout(layout);
50+
layout.setHorizontalGroup(
51+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
52+
.addGroup(layout.createSequentialGroup()
53+
.addGap(39, 39, 39)
54+
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)
55+
.addContainerGap(100, Short.MAX_VALUE))
56+
);
57+
layout.setVerticalGroup(
58+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
59+
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
60+
.addContainerGap(165, Short.MAX_VALUE)
61+
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
62+
.addGap(63, 63, 63))
63+
);
64+
65+
pack();
66+
}// </editor-fold>//GEN-END:initComponents
67+
68+
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
69+
// Play Audio File
70+
try {
71+
72+
String filepath = "C:\\Dappcode.wav" ;
73+
AudioInputStream aui = AudioSystem.getAudioInputStream(new File(filepath).getAbsoluteFile());
74+
75+
try {
76+
77+
Clip clip = AudioSystem.getClip() ;
78+
clip.open(aui);
79+
clip.start(); //start Clip
80+
clip.stop(); //Stop Clip
81+
clip.loop(10); // 10 time loop clip
82+
83+
clip.close();
84+
85+
} catch (IOException | LineUnavailableException e) {
86+
}
87+
88+
89+
90+
91+
92+
93+
} catch (IOException | UnsupportedAudioFileException e) {
94+
}
95+
96+
97+
98+
99+
100+
101+
102+
}//GEN-LAST:event_jButton1ActionPerformed
103+
104+
/**
105+
* @param args the command line arguments
106+
*/
107+
public static void main(String args[]) {
108+
/* Set the Nimbus look and feel */
109+
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
110+
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
111+
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
112+
*/
113+
try {
114+
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
115+
if ("Nimbus".equals(info.getName())) {
116+
javax.swing.UIManager.setLookAndFeel(info.getClassName());
117+
break;
118+
}
119+
}
120+
} catch (ClassNotFoundException ex) {
121+
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
122+
} catch (InstantiationException ex) {
123+
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
124+
} catch (IllegalAccessException ex) {
125+
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
126+
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
127+
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
128+
}
129+
//</editor-fold>
130+
131+
/* Create and display the form */
132+
java.awt.EventQueue.invokeLater(() -> {
133+
new NewJFrame().setVisible(true);
134+
});
135+
}
136+
137+
// Variables declaration - do not modify//GEN-BEGIN:variables
138+
private javax.swing.JButton jButton1;
139+
// End of variables declaration//GEN-END:variables
140+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3+
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
4+
*/
5+
package playaudio;
6+
7+
/**
8+
*
9+
* @author suw
10+
*/
11+
public class PlayAudio {
12+
13+
/**
14+
* @param args the command line arguments
15+
*/
16+
public static void main(String[] args) {
17+
// TODO code application logic here
18+
}
19+
20+
}

0 commit comments

Comments
 (0)
Please sign in to comment.