|
The documentation for getLevel [^] suggests that -1 means that no value can be obtained, or that it has not been set. It is difficult to suggest anything that would help solve this issue, but maybe you should use your debugger to try and collect some more information.
Veni, vidi, abiit domum
|
|
|
|
|
Do you have any suggestion on another way that I could get the amplitude of the sound?
|
|
|
|
|
I'm afraid not, I do not have experience of these classes. Did you write all this code yourself, and if so, what reference guides or tutorials did you use?
Veni, vidi, abiit domum
|
|
|
|
|
No,I've found the complete code and I'm trying to modify it to do some more things that I need for my project.If you have a better piece of code to suggest me,feel free to do it
|
|
|
|
|
xchris00 wrote: No,I've found the complete code and I'm trying to modify it As I said before, I have not used these classes, so I guess you need to go back to the place where you found it originally and seek help there.
Veni, vidi, abiit domum
|
|
|
|
|
|
Ok,I managed to make it capture audio and print on a xls file the timestamp and the value of the current sample,but there is a problem : even I've put some spaces between the time and the value and it seems that they are in different columns,they are actualy on the same column of the xls,it's just expanded and covers the next column (I can put a print screen if you don't understand).How can I make it print the data of time and amplitude in two different columns?Here's my code of the class which creates the file and saves the data on xls :
package soundRecording;
import java.io.File;
import java.util.Formatter;
public class Save {
static Formatter y;
public static void createFile() {
Date thedate = new Date();
final String folder = thedate.curDate();
final String fileName = thedate.curTime();
try {
String name = "Time_"+fileName+".csv";
y = new Formatter(name);
File nof = new File(name);
nof.createNewFile();
System.out.println("A new file was created.");
}
catch(Exception e) {
System.out.println("There was an error.");
}
}
public void addValues(byte audio) {
Date d = new Date();
y.format("%s " + " %s%n",d.curTime(), audio);
}
public void closeFile() {
y.close();
}
}
|
|
|
|
|
I want to draw bezier cubic curves by retrieving data from MySQL database and then display the shape on JFrame I have table has 3 columns (ID, ObjectID, Points) Points column is coordinates of cubic curves, the statement is
SELECT * FROM DB.TABNAME WHERE OBJECTID=1; ObjectID=1 has 11 ID's, each ID contains a shape if i combine all ID`s together will form composite shape How can i retrieve data from MySQL database, that data are path to draw bezier cubic curves in java GUI?
modified 9-Dec-13 5:36am.
|
|
|
|
|
ابو عبدالله wrote: How can i retrieve data from MySQL database Read all records and build a collection of the points as you read them; as I suggested in my previous answer[^].
Veni, vidi, abiit domum
|
|
|
|
|
can I convert a string token into a char array or string array
|
|
|
|
|
At best the question is not precise.
A "string token" doesn't mean anything in terms of the java language.
Now you might write a program that uses a "string token" but in general computer science jargon a "token" is a small non-dividable entity. There would be no point in converting it to a char array and even less point of creating a string array from it. And at best the latter would be nothing more than taking each character and making it into a string.
But then you might mean something different for "string token". If so you need to explain what you actually meant.
|
|
|
|
|
Have a look at String.toCharArray() ? See here[^]
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
so please tell me about that source code about that main window in auto mobile spare part in java project
|
|
|
|
|
Read the forum guidelines again, and try a more specific question. If you want source code then you need to search with Google, Bing etc.
Veni, vidi, abiit domum
|
|
|
|
|
Member 10449243 wrote: so please tell me about that source code about that main window in auto mobile spare part in java project
You do this in the following order
1 - Gather requirements, figure out what the 'main' window does.
2 - Learn basic java programming
3 - In general learn about web/internet server functionality how it works (presumably that is the goal)
4 - Learn the basics of implementing a web application in java
5 - Probably will need to learn about databases and how to access them in java
6 - Starting with 1, use what you learned in 2-5 to implement a java solution.
7 - Test it until there are no more bugs (or ones you can live with.)
|
|
|
|
|
tell me any advice about the mcs studies and how i can make my self good in developing
|
|
|
|
|
|
I'm not able to see content on JFrame ,when JFrame shows up.
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class GraphicUse extends JPanel
{
public void PaintComponent(Graphics gr)
{
super.paintComponents(gr);
this.setBackground(Color.BLUE);
gr.setColor(Color.WHITE);
gr.fillRect(50, 50, 100, 100);
gr.setColor(new Color(139,38,190));
gr.fillRect(50, 70, 100, 100);
gr.setColor(Color.RED);
gr.drawString("This is a new String", 50, 90);
}
public static void main(String[] args)
{
}
}
And displaying it in another class which extends Frame
JFrame newframe = new JFrame("Color Frame");
newframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GraphicUse gu = new GraphicUse();
newframe.add(gu);
newframe.setSize(250,300);
newframe.setVisible(true);
|
|
|
|
|
Why does your main method not do anything?
Veni, vidi, abiit domum
|
|
|
|
|
I'm calling this class from another class so it is using that main class main method.
modified 5-Dec-13 6:26am.
|
|
|
|
|
Well you need to provide some more detail about your problem.
Veni, vidi, abiit domum
|
|
|
|
|
what other details you need?
|
|
|
|
|
No idea; but you need to provide enough to help people to understand the problem. Remember, we have never seen your code before so we cannot guess what each part is supposed to do or how it fits together. Having a blank main method in the code you showed above just serves to confuse.
Veni, vidi, abiit domum
|
|
|
|
|
Your frame is covered by a gray frame thats why paint method do not show anything.
|
|
|
|
|
Hello,
I have a code which checks some variable which has to be changed from false to true in other class, but, even if it changes it does not appears.
More details, I have the code:
ms.isDataReady = false;
...
while(!ms.isDataReady);
the loop while waits forever in my main method even if
ms.isDataReady becomes true in
ms 's appropriate method.
What I should do?
|
|
|
|