Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Audio Level Meter
#2
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 :

Code:
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();
    }
}
Reply


Messages In This Thread
Audio Level Meter - by xchris00 - 12-10-2013, 12:44 PM
RE: Audio Level Meter - by xchris00 - 12-17-2013, 07:09 AM
RE: Audio Level Meter - by thomasf2220 - 10-15-2016, 03:23 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)