Receive Data From Midi Device With Java Sound API
Mar 15, 2014
I haven't been able to find a cut and paste working example of how to receive MIDI data from a MIDI device, like my piano, and display something to System.out.There are all sorts of examples for synthesizers, sequencers and sending data to a MIDI device, but I have not been able to find a single example of how to receive MIDI data and just display a simple message.
I just need something simple that works to start playing with it, and understanding how it works. Having a working example would also support understanding the Sound API descriptions. They read like differential equations texts books to me, i.e. not clear at all.
I have a working example of how to poll all devices and getDevice.info, which is supposed to then be used to address a specific MIDI device.
I've also looked at a number of books, in the store and on line.I haven't seen a single example anywhere.the closest I found to working examples was on StackOverflow, but I didn't understand some of the other code in the examples, which may or may not have been working correctly anyway.
View Replies
ADVERTISEMENT
Sep 9, 2014
Using JVM under OSX 10.9.4?:
Receive input events from a MIDI interface device.
This has suddenly stopped working for me after years of using the Java MIDI software.
I have tested this on two different macbook pro's.
I have a variety of MIDI interfaces from different manufacturers. I can find the devices using MidiSystem.getMidiDevice. But I cannot get them to see any input MIDI events.
I can create events in code and send them to output devices and have them seen by those devices. It's just the input that seems to be broken.
I have tried using previously working software I having been developing for years and I have tried with a very simple test program.
View Replies
View Related
Apr 16, 2014
I got my first project in which i need to receive some data from multiple client on network regularly(say every second) and then process that data and stored it to the database and then GUI needs to be created which display data accordingly.
While thinking for the design i thought blocking queue to implement the same. Like producer receive data from the port into a string builder and put that into the LinkedBlockingQueue. Consumer will take this data , process some work on it and store it into the database.I am using sybase ase 15 as a database.
My question is as i am receiving data very frequently which require insertion , updation and search almost every second into the database. What is the best way to improve the performance.
say i have 2 types of data is coming one having keyword 'Alarm' and other having 'ceased' so i need to use something like this
common fields in both is name and number.
if (ceased)
search into the database for particular event for which this ceased receive using name and numbe rand update the another field into it Also make separate entry for it
else
make a entry
Also as i am using 2-3 thread for consumers and thread = Number of client for the producer. So i thought to use synchronization at the consumer side which writes data into the database such that only 1 thread can write it.
View Replies
View Related
Mar 2, 2014
I'm using netbeans to develop an application to send and receive data via RS 232 standard. I can send data but I can't read it.what can I do? I have this message in the console: Underlying input stream returned zero bytes. (I must use also threads to have application in real time but I don't understand very well....
View Replies
View Related
Jun 29, 2014
Trying to find a way to use primitive data types to overload sound()method. I can't seem to warp my head around using an int or a double to overload the method. And if I did, how do you call them in the main afterwards?
View Replies
View Related
Aug 7, 2014
how to finds and identifies display devices connected to my computer is monitor or projector. which wmi query to use in windows 7 ?
View Replies
View Related
Jul 27, 2014
I can't get the output to read correctly. I get 0 as the answer.
import java.util.Scanner;
public class TheSpeedofSound777
{
public static void main(String[] args)
{
System.out.println("Gordon Elam Sr July 26, 2014 ");
[code]...
View Replies
View Related
Jan 15, 2015
What I want to do is very clear, just play sound and pause it. The problem is that I can't pause the music. When I click the pause button music keeps playing .I have been working on for 2 hours. I can't find the mistake; what am I doing wrong?
public class MainC extends JFrame implements Runnable,ActionListener {
private JPanel contentPane;
private JTextField txtname;
JButton btnopen;
JButton btnSave;
JButton btnplay;
[code]....
View Replies
View Related
May 23, 2012
I'm trying to create a Servlet that takes input from a form and process it and insert it in database.tablename.
My MAIN ISSUE IS WITH THE NUMBER OF COLUMNS THAT WOULD BE DYNAMIC AND THUS CANT RECEIVE THE PARAMETERS IN STATIC CODE.
Here is the form code
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<form action="Test" method="post" />
<table width="90%" border="1" cellspacing="1" cellpadding="1">
[Code] ....
And here is the Servlet
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.io.*;
public class Test extends HttpServlet {
[Code] ....
This is the basic code structure and I'm trying to figure out this special case with handling the multiple parameters:
I don't want to use String []a=request.getParameterValues("studentname"); as hard code. The reason being the number of rows will be diyamic and I would like to get the column name and then then use an array of string to take values. But how can I connect these to form a query so that the rows goes on inserted one after other.
View Replies
View Related
Jan 30, 2014
I have programmed a Router class which has two methods, receive and send.In receive method it receives the plain text from the server through port 2000.Its now all cool.In send method it sends the message to a client through the port 2001 but at the client i get an exception
connection refused:connect
import java.io.*;
import java.util.*;
import java.net.*;
import java.sql.*;
class Router {
String str;
public void receive()
[code]....
View Replies
View Related
Apr 15, 2015
To read or write to a USB device must use an external library?
Such as this? usb4java - About
View Replies
View Related
Nov 10, 2014
How the server know the device type from which request came from. I have requirement to implement the logic based on the type of the device. Eg: Mobile, TAB, PC or Laptop. Is there any existing API in Jquery to know the details about the client?
View Replies
View Related
Mar 27, 2015
How can I connect my j2ee application to a fingerprint reader...
View Replies
View Related
Oct 21, 2013
Code to receive a SMS using an USB dongle? or else how to write a code? I searched in the internet but couldn't find it.
I'm using Netbeans IDE.
View Replies
View Related
Sep 24, 2014
I created a game but want some music in it, and as I write in the title i want the sound to loop. This is the code fore the sound class i have:
Java Code:
import java.applet.Applet;
import java.applet.AudioClip;
public class Sound {
private AudioClip clip;
//all sounds
public static final Sound ScoreSound = new Sound("/Score.wav");
public static final Sound BounceSound = new Sound("/Bounce.wav");
[code].....
View Replies
View Related
Apr 7, 2015
how to make a simple game. I am having trouble when it comes to adding sound though. It tells me to do this:
package net.game.Game;
import java.applet.Applet;
import java.applet.AudioClip;
public class Sound {
public static final AudioClip BALL = Applet.newAudioClip(Sound.class.getResource("ball.wav"));
public static final AudioClip GAMEOVER = Applet.newAudioClip(Sound.class.getResource("gameover.wav"));
public static final AudioClip BACK = Applet.newAudioClip(Sound.class.getResource("back.wav"));
}
What this does is it gets the sound file then gives it a name(BALL=ball.wav GAMEOVER=gameover.wav ect..) and then there is other code in other classes that call the sound so it will run but it keeps giving me an error and I don't know what to do. How can I get it to import the sound? Here is the error.
PHP Code:
Exception in thread "main" java.lang.ExceptionInInitializerError
at net.game.Game.stuff.<init>(stuff.java:35)
at net.game.Game.stuff.main(stuff.java:62)
Caused by: java.lang.NullPointerException
at sun.applet.AppletAudioClip.<init>(Unknown Source)
at java.applet.Applet.newAudioClip(Unknown Source)
at net.game.Game.Sound.<clinit>(Sound.java:7)
... 2 more
View Replies
View Related
Feb 11, 2015
I have to write a program that asks the user to enter "air", "water", or "steel", and the distance that a sound wave will travel in the medium. The program should then display the amount of time it will take. The amount of time it takes sound to travel in air can be calculated as follows;
Time = Distance/1,100
The amount of time it takes sound to travel in water can be calculated with the following formula:
Time=Distance/4,900
The amount of time it takes sound to travel in steel can be calculated with the following formula:
Time=Distance/16400
Here is my code:
import java.lang.String;
/**
This program displays numbers padded with leading zeros.
*/
public class SpeedofSound {
public static void main(String[] args) {
double D; // declares this as double
D = keyboard.nextDouble();
const double A = 1100; // declares this as a constant
[Code] .....
The following is the error I'm getting:
----jGRASP exec: javac SpeedofSound.Java
error: Class names, 'SpeedofSound.Java', are only accepted if annotation processing is explicitly requested
1 error
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.
View Replies
View Related
Sep 15, 2014
Okay, so I'm looking for a way to synthesize sound, and from what I've found around the interwebs it seems amazingly complex. Is there really not a function like "sound(wavelength, time)"? Alternatively a way to use an integer array to determine the acoutstic pressure at a given time, or some other way to determine the pressure at a given time?
View Replies
View Related
Mar 20, 2014
im trying to play a sound when button is clicked. here is the following code
InputStream in;
try {
in = new FileInputStream(new File("failure1.wav"));
AudioStream audios = new AudioStream(in);
AudioPlayer.player.start(audios);
} catch (Exception e) {
}
just wondering why it does load;
i do get the warning
warning: AudioStream is internal proprietary API and may be removed in a future release
AudioStream audios = new AudioStream(in);
warning: AudioStream is internal proprietary API and may be removed in a future release
AudioStream audios = new AudioStream(in);
warning: AudioPlayer is internal proprietary API and may be removed in a future release
AudioPlayer.player.start(audios);
View Replies
View Related
Aug 4, 2014
I have just taken it upon myself to attempt to develop an application using java that will implement several features for my aircraft maintenance unit. I've taken a few courses in Java and I am a computer science major, so I wanted to use this as a way to improve my coding skills while also improving the effectiveness of my unit.
Anyway my application needs to have these key features:
1. Access a recall roster that is in Excel format and read the names/phone numbers of up to 200 members. The application also needs to be able to update this information and save it.
2. The application also needs to be able to initiate a recall to some or all of the members on the recall roster via text message.
3. The application needs to be able to receive messages back and display them under each name from the recall roster.
My current plan is to set up a GUI that expands JButtons in a scrollable window as members are read in from the excel document. Upon clicking any of the buttons the person will be contacted individually via a custom message that can be typed in via a popup window after clicking it. Alternatively you can check a box next to any persons button to add them to the list of people to be contacted and then click a button that says "Contact those checked" or something along those lines. Finally there will be a button that just says initiate total recall and it will contact everyone.
As for the interface I want each button to be highlighted red until a response has been received from the person associated with that button, which will then be recorded under their contact information.
I've attached an extremely rough picture...
View Replies
View Related
Oct 5, 2014
I wrote the below program to set up and play the game breakout as an assignment for Stanford's CS106 programming class. I wrote it on my old mac running OSX 10.6.8, with the version of Eclipse JDK that works on that machine. When I tested it back on the mac, the program worked normally. But now I am using a Windows 8.1 computer with the corresponding version of eclipse, and when I test the program again, the sound effect I coded does not play. I get the following error message in console when the ball hits the paddle or brick, which previously caused the sound clip to play.
Exception in thread "Thread-4" java.lang.IllegalArgumentException: Requested value -120.0 smaller than allowable minimum value -80.0.
at javax.sound.sampled.FloatControl.setValue(Unknown Source)
at com.sun.media.sound.DirectAudioDevice$DirectDL$Gain.setValue(Unknown Source)
at acm.util.SoundPlayer.setLineVolume(SoundClip.java:909)
at acm.util.SoundPlayer.run(SoundClip.java:860)
at java.lang.Thread.run(Unknown Source)
why my code would request a value below the min. I am using the mediatools class that is part of the ACM libraries we are required to use for the class to play the sound in question, found here: URL....I went ahead and tested all parts of the program and the missing sound effect is the only problem. Here is my complete code:
package Breakout_package;
import acm.graphics.*;
import acm.program.*;
import acm.util.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
[code]....
View Replies
View Related
Feb 23, 2015
The scenario:
* A pop-up menu generates an array of rectangle objects; each rectangle having random x.y coords and colour.
* The number of rectangles in the array is user selected from the popup list.
* The APopUp class has a 'getter' method that returns the array.
* The pop-up object is instantiated in an object of the AFrame class.
* The AFrame object needs to get the array each time the popup changes its state.
The problem:
.
* As I see it, the AFrame object needs to informed of the pop-up's state of change event or does the problem lie in how I have decided
which responsibilities each class is to have? I've tried to be as logical as possible during planning.
In the days of FORTRAN or BASIC we would hammer a solution through with brute force, but I would like to keep to Java's philosophy
of encapsulation and clean interfaces and that it seems to has generated a impasse of brain warping proportions.
import java.awt.Frame;
import java.awt.Label;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public class AFrame extends Frame implements ItemListener {
[code]....
View Replies
View Related
Nov 28, 2014
trying to get into Java and jump into just programming an idea.I want to go through an array of numbers at a certain pace and call different sounds as it goes through.
View Replies
View Related
Mar 6, 2014
I'm using the JOptionPane to display and receive information to/from the user. In addition to this, I am using StringBuilder to receive inputs from the user and then manipulate (append) that input to display the desired output.
//Example
(JOptionPane): "Enter text"
(user input): Java is cool!
(program): *stringBuilder.append(" I love it!")
JOptionPane.showMessageDialog( );
.....
Psuedo-like code. The problem is that showMessageDialog(null, string) and not showMessageDialog(string, string). I want to display the enter text: " Java is cool! I love it! " in the JOptionPane. How do I accomplish this, since showMessageDialog only accepts (null, string).
View Replies
View Related
Jul 6, 2014
I write a Client/Server program,trying to send and receive a object between client and server. I use the ObjectStream but there exists an EOFException on the client side when invoking readObject() .... I've tried many times but couldn't figure it out ...
server-side code
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
try{
ObjectOutputStream out = new ObjectOutputStream(resp.getOutputStream());
ObjectInputStream in = new ObjectInputStream(req.getInputStream());
PersonalData pe = (PersonalData)in.readObject();
System.out.println(pe.getYearlySalary());
[Code] .....
View Replies
View Related
Apr 19, 2014
I wanted to write a simple code that receives information from the user (double-digit number and above) and calculates it's numbers.
For instance- The user wrote a number- 234, the software will return the number 9 (2+3+4 = 9).
Tried to use a loop for that, but I got stuck since I didn't know what to write.
This is what I've wrote so far
Java Code:
import java.util.Scanner;
public class Calculate {
public static void main(String[] args) {
System.out.println("Please type a number larger than 9");
Scanner type = new Scanner(System.in);
String number1 = type.nextLine();
for( int i = 0; i < number1.length(); i++ ){
int calculate = number1.charAt(i);
}
}
} mh_sh_highlight_all('java');
View Replies
View Related