Código de Java - Efectos Audio

Imágen de perfil
Val: 231
Ha mantenido su posición en Java (en relación al último mes)
Gráfica de Java

Efectos Audiográfica de visualizaciones


Java

Publicado el 2 de Mayo del 2017 por Yacoobs (17 códigos)
5.841 visualizaciones desde el 2 de Mayo del 2017
Hola amigos, esta vez vamos a crear un programa muy sencillo con un JList que nos ayudara a crear una lista de audios, seguido de tres botones para manejar la lista del Jlist y un botón de reproducción.

El programa consta de una Clase principal llamada InterfaceGrafica. Tiene dos directorios, uno de ellos llamado efecto que es donde se alojan los efectos de audio en mp3 del programa, y otro directorio llamado fondo donde se aloja una imagen de fondo del programa para darle un aspecto mas bonito al programa, el Frame del programa debe de estar en Flaut Layout para poder hacer el JLabel como imagen de fondo del programa...
El programa esta echo con la interface Netbeans 8.1 un aspecto importante a tener en cuenta es que el JLabel fondo debe de estar por debajo de los demás items para que estos sean mostrados...

imagen

Requerimientos

Es necesario disponer de las libreria de Audio Basic Player:
Enlace:

Consulta libreria Basic Player http://www.it.uu.se/edu/course/homepage/devgui/vt07/material/api/basicplayer3.0/javazoom/jlgui/basicplayer/BasicPlayer.html
Descarga de libreria Basic Player http://www.javazoom.net/jlgui/api.html
Descarga y pagina oficial libreria Jaudiotagger http://www.jthink.net/jaudiotagger/

1

Actualizado el 14 de Septiembre del 2017 (Publicado el 2 de Mayo del 2017)gráfica de visualizaciones de la versión: 1
5.842 visualizaciones desde el 2 de Mayo del 2017
estrellaestrellaestrellaestrellaestrella
estrellaestrellaestrellaestrella
estrellaestrellaestrella
estrellaestrella
estrella

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.net.URL;
import javazoom.jlgui.basicplayer.BasicPlayer;
import javazoom.jlgui.basicplayer.BasicPlayerException;
 
public class InterfaceEfecto extends javax.swing.JFrame {
 
 
    public InterfaceEfecto() {
        initComponents();
 
        introArray("efecto0.mp3", 0);
        introArray("efecto1.mp3", 1);
        introArray("efecto2.mp3", 2);
        introArray("efecto3.mp3", 3);
        introArray("efecto4.mp3", 4);
        introArray("efecto5.mp3", 5);
        introArray("efecto6.mp3", 6);
        introArray("efecto7.mp3", 7);
        introArray("efecto8.mp3", 8);
        introArray("efecto9.mp3", 9);
 
        jListCanciones.setListData(lista);
 
        jListCanciones.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
               jLabelRuta.setText("Ruta: " + efecto[jListCanciones.getSelectedIndex()]);
 
            }
        });
    }
 
 
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {
 
        jScrollPane1 = new javax.swing.JScrollPane();
        jListCanciones = new javax.swing.JList<>();
        jButtonAvanzar = new javax.swing.JButton();
        jButtonReproducir = new javax.swing.JButton();
        jButtonRetroceder = new javax.swing.JButton();
        jLabelRuta = new javax.swing.JLabel();
        jLabelfondo = new javax.swing.JLabel();
 
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
 
        jScrollPane1.setViewportView(jListCanciones);
 
        getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 10, 220, 370));
 
        jButtonAvanzar.setText("Arriba");
        jButtonAvanzar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAvanzarActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonAvanzar, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 20, -1, -1));
 
        jButtonReproducir.setText("Reproducir");
        jButtonReproducir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonReproducirActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonReproducir, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 160, -1, -1));
 
        jButtonRetroceder.setText("Abajo");
        jButtonRetroceder.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonRetrocederActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonRetroceder, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 350, -1, -1));
 
        jLabelRuta.setFont(new java.awt.Font("Source Code Pro Black", 1, 10)); // NOI18N
        jLabelRuta.setForeground(new java.awt.Color(255, 255, 255));
        jLabelRuta.setText("Ruta:");
        getContentPane().add(jLabelRuta, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 400, -1, -1));
 
        jLabelfondo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/fondo/music1.png"))); // NOI18N
        getContentPane().add(jLabelfondo, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 660, -1));
 
        pack();
    }// </editor-fold>                        
 
    private void jButtonAvanzarActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        seleccion(-1);
    }
 
    private void jButtonReproducirActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
 
        if (jListCanciones.getSelectedIndex()!=-1){
            int posicion = jListCanciones.getSelectedIndex();
            try{
                player.open(efecto[posicion]);
                player.play();
            }catch(BasicPlayerException ex){
                System.out.println("Error el archivo no existe o la ruta no es correcta...");
            }
        }
    }
 
    private void jButtonRetrocederActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        seleccion(+1);
    }
 
    public void introArray(String ruta,int posicion){
 
        URL rut = getClass().getResource("efecto/"+ruta);
        efecto[posicion]=rut;
 
        File file = new File(ruta);
        String eFFect = file.getName();
        lista[posicion]=eFFect;
    }
 
    public void seleccion(int lo){
        if (jListCanciones.getSelectedIndex()!=-1){
            jListCanciones.setSelectedIndex(jListCanciones.getSelectedIndex()+lo);
        }
    }
 
 
 
    public static void main(String args[]) {
 
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new InterfaceEfecto().setVisible(true);
            }
        });
    }
 
    private URL efecto[]= new URL[10];
    private String lista[] = new String[10];
    private BasicPlayer player = new BasicPlayer();
 
 
    // Variables declaration - do not modify                     
    private javax.swing.JButton jButtonAvanzar;
    private javax.swing.JButton jButtonReproducir;
    private javax.swing.JButton jButtonRetroceder;
    private javax.swing.JLabel jLabelRuta;
    private javax.swing.JLabel jLabelfondo;
    private javax.swing.JList<String> jListCanciones;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration                   
}



Comentarios sobre la versión: 1 (0)


No hay comentarios
 

Comentar la versión: 1

Nombre
Correo (no se visualiza en la web)
Valoración
Comentarios...
CerrarCerrar
CerrarCerrar
Cerrar

Tienes que ser un usuario registrado para poder insertar imágenes, archivos y/o videos.

Puedes registrarte o validarte desde aquí.

Codigo
Negrita
Subrayado
Tachado
Cursiva
Insertar enlace
Imagen externa
Emoticon
Tabular
Centrar
Titulo
Linea
Disminuir
Aumentar
Vista preliminar
sonreir
dientes
lengua
guiño
enfadado
confundido
llorar
avergonzado
sorprendido
triste
sol
estrella
jarra
camara
taza de cafe
email
beso
bombilla
amor
mal
bien
Es necesario revisar y aceptar las políticas de privacidad

http://lwp-l.com/s3971