[Sound] Read In From System Out

I've written a Java program to take sound input from a microphone and run an FFT on it for frequency analysis. It works, and works smashingly well, I might add.
Now, I need it for a different purpose. I'm looking to run it against the sound currently coming OUT of my computer. My current solution is to quite literally take my microphone and put it up against my speaker. It works, but is a rather silly way of doing it. I'm looking to do the same thing in software. The sound that I'm looking to gather is NOT coming from Java, it's coming from another application in Windows.
I don't know how to phrase the question in more tech-speak, sorry. Probably something about piping a TargetDataLine to a SourceDataLine or vice-versa. I'm more than willing to poke around in the API for hours on end, but I'm going to feel awfully silly if my answer ends up being "You can't do it any other way than what you're already doing."

Ahhh...I figured out how to do it in Windows, when you double-click on the Speaker icon and go to Properties, Recording, and select the right source. I actually knew how to do it before, but when I tried it and it didn't work, I figured Java was too smart for that and was still looking at the microphone. Turns out, I just didn't have all the different "sources" available (in the Properties) menu, and hadn't picked the right one. Works flawlessly.
I am, however, still very much curious if there is a way to achieve the same effect entirely within Java.
Thanks.

Similar Messages

  • Read Year from System Date & Compare - Assistance required

    Hi All,
    I am trying to read only the year part from the system date & then checking if any entry exists in EKKO table (EKKO-BEDAT) for the year. I think i am making an error in my data declaration for V_YEAR & in my select statement (EKKO~BEDAT LIKE V_YEAR), not sure how to compare only the year part, can someone help.
    DATA:
        V_EBELN TYPE EKPO-EBELN,
        V_YEAR  TYPE SY-DATUM.
    CLEAR: V_EBELN, V_YEAR.
    *Read year from system date
    V_YEAR = SY-DATUM+0(4).
    CONCATENATE '%' '%' '%' '%' V_YEAR INTO V_YEAR.
    *Select section
    SELECT SINGLE EKPO~EBELN INTO V_EBELN
    FROM EKPO
      INNER JOIN EKKO
        ON EKPOEBELN = EKKOEBELN
      INNER JOIN LFM1
        ON EKKOLIFNR = LFM1LIFNR
       WHERE EKKO~LIFNR = LFM1-LIFNR
         AND EKKO~BEDAT LIKE V_YEAR
         AND EKPO~LOEKZ = SPACE.

    Hi Sougata,
    Thanks for the inputs, but it is not working:
    Move:      sy-datum(4) to v_begda, -> This reads the system year 2008
            '0101'     to v_begda,  -> This changes 2008 to 0101
            sy-datum(4) to v_endda, -> This reads system year i.e. 2008
            '1231'     to v_endda. -> This changes 2008 to 1231
    Also in the select statement
    AND EKKO~BEDAT between v_begda and v_endda 
    This would not work, as EKKO-BEDAT is in year month date format.
    So can you please clarify why we are assigining 0101 & 1231 & also how we can compare only the year in EKKO-BEDAT with System Year
    Update
    I tried to
    concatenate '0101 into v_begda.
    concatenate '1231' into v_endda.
    but system prompts "charlike-field" expected after "'0101'"
    Can you please advice?
    Edited by: Vivek on Jan 5, 2008 7:59 PM

  • Using System.out.println() in Scrapbook

    I am working through some tutorials on formatting numbers:
    http://docs.oracle.com/javase/tutorial/java/data/numberformat.html
    I am trying to use scrapbook. I can't seem to get the result I am wanting from System.out.println("Hello world")...I get null. To be specific I am trying to inspect:
    int i = 461012;
    System.out.format("The value of i is: %d%n", i)In this case I get:
    java.io.PrintStream@46b372
    Something tells me that System.out.format can't work in a scrapbook. Is there a way without writing a main and running as java?

    It seems that the format method returns the PrintStream (allowing you to chain method calls), and the return value is being printed.
    You would get the output you're looking for, if you use the String.format() method, since that'll return the formatted String.

  • How to re-read email from Gmail?

    Guys another question from me.
    I have 2 account, Yahoo and Gmail. I access the 2 of them with a JavaMail application.
    my question is:
    1. Why Gmail's POP3 protocol can't retrieve my newest message, e.g the one with today's date. I've set it to download all message from the inbox, but from what i read, It download the latest messages only from the ones dated back to 2006. Here's my sample code:
    Folder folder = reader.getFolder();
    result = folder.getMessages();
    //Read Through Email
    System.out.println(result.length);
    for(int i =result.length-1;i>=0;i--)
    String subject = result.getSubject();
    Date tgls = result[i].getSentDate();
    System.out.println(subject+ " Send Date: " + tgls);
    2. Why can't i Redownload an email from Gmail account? How to prevent it? is the FetchProfile class has anything to do with it? Yahoo can do it for sure without it. So i wonder, how to do it with Gmail (or others with the same POP3 behaviour)?
    3. If i really need FetchProfile for Gmail, is Yahoo! (or other email provider) can use it too?
    4. Can somebody explain to me what is the FetchProfile for?
    Thanks in advance.
    Edited by: hansip87 on May 12, 2008 8:55 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Yeah I've checked it, changed it to the first option - "     Enable POP for all mail (even mail that's already been downloaded)"
    And still it can't re-download the downloaded once.
    Well I've got my reason for this, it's because my program does something like this:
    1. Fetch the message
    2. Take all the message except attachment, insert it into a new class called LightMessage that represent a structure like Messages but without Folder or Session pointer in it.
    3. We as user review it.
    4. If desired, we'll call the receiver again to search with MessageNumberTerm that was taken from the first Pop3 fetch to take the attachment.
    But that was resulting in error i've posted, saying that the message array is empty though the message is still in the inbox.
    Should I just download all the Message info and then just take the attachment from the downloaded ones? Thanks in advance.

  • Saving System.out text into array of Strings

    I've got a lot of strings, which are being inputed into System.out
    Is it possible to transfer symbols from System.out into array of strings?

    Do you mean in real time or after the fact parsing it?
    For a realtime solution you may want to look at creating a class that extends PrintStream, which rather than actually printing anywhere, creates this Array that you want. Then call System.setOut(PrintStream s) and give it your special PrintStream. Provide some methods to get at the Array data and you're off!

  • What is the different  between System.out.println and out.print

    we move a project , jsp form to servlet to mysql db
    suddenly we get Chinese input problem
    on meantime only Thing I know is
    if( chineseName!=null) {
                           chineseName= new String( chineseName.getBytes("ISO-8859-1"),"UTF-8");
                         out.print(chineseName); //display Chinese
                          System.out.println("Hello1"+chineseName ); // display unread symbol
                 }I don't know why when we insert the value into db by StudentInsert(university_ID, surName, english_Name, chineseName, Address)
    the db get the value from System.out.println
    what setting decide my out put through System.out.println

    Thank you for the reply!
    after two days of search and guess.... I found out
    for Web application , which under glassfish , you need to put your jsp page under WEB-INF,
    other wise the server jsp turn your Chinese character that come from jsp request form to UTF8 symbol.
    not ideal how to change the configuration in glassfish yet!

  • Redirecting System.out?

    I am working with a team, and I am testing a standalone Java application using separate unit tests. The program takes text input and outputs some text results, but the way it is set up, it will output directly to System.out as soon as it needs it. I am not in control of the way it outputs the results.
    I need to capture all of the results from System.out, and compare them to what I know should be printed out. How do I do this without touching the original source files? Is there a way to do it purely in Java (my backup is to use shell scripts, but I really don't want to)?

    Well, you don't need to change all the source files, but you will need to
    change the source file with your main method.You don't even have to do that: build a Wrapper class with its own main
    that redirects System.out to a file and calls the Application.main afterwards.
    Instead of starting the Application, start the Wrapper.
    kind regards,
    Jos

  • System.out.write() vs System.out.println()

    what is the difference between .write and .println?

    okay. explain to me how the following works. because
    Im getting lost.
    import java.net.*;
    import java.io.*;
    public class getData{
         private URL url;
         private InputStream n;
         public static void main(String[] args){
              URL url = null;
              try{
                   url = new URL("http://myhost.com/index.html");
                   InputStream n = url.openStream();
                   int b;
                   while ((b = n.read()) != -1){
                        System.out.write(b);
    //System.out.println(b);
              }catch(Exception x){
                   System.out.println("Error: Bad Url");
    }System.out.write(b) writes the bytes? so shouldn't
    it just print out the number of bytes read by
    n.read() ? instead it will print the content of
    f index.html.
    however, System.out.println(b) will display integers.
    I dont really understand the connection between
    n those numbers and the content of index.html.The read is returning an int that corresponds to the code representing the letter in the file. The write() writes this out as a byte corresponding to the character also. println() sees it is an int, converts it to a String, and prints the String corresponding to the int value, appending a line separator.

  • Hi , I suhail khan from india and i am user of iMac system 10,1.These days i am facing the sound enabling issue with my iMac system I am not able to hear sound in my iMac system.So kindly suggest me how to enable sound in my iMac . Please no the needful.

                      Hi , I suhail khan from india and i am user of iMac system 10,1.These days i am facing the sound enabling issue with my iMac system I am not able to hear sound in my iMac system.So kindly suggest me how to enable sound in my iMac . Please no the needful.

    Take each of the following steps that you haven't already tried.
    1. If you've recently plugged anything into the audio-out (headphone) port, plug and unplug it a couple of times.
    2. From the menu bar, select
     ▹ System Preferences ▹ Sound ▹ Output
    Check the settings. The internal speakers should be selected as the output device, the Mute box should not be checked, and the volume slider should be at least halfway to the right.
    3. Look inside the headphone port. If a red light is coming from the port, the internal switch is stuck in the position for digital output. You may be able to free it by inserting and removing a headphone mini-stereo jack of the proper size.Inserting any kind of tool in the port may cause damage that won't be covered by your warranty.
    4. Boot in safe mode by holding down the shift key at the startup chime. It will take much longer than usual. You don't have to log in; just reboot as usual (without holding any keys) when the login screen appears. (Note: If FileVault is enabled under OS X 10.7 or later, or if a firmware password is set, or if the boot volume is a software RAID, you can’t boot in safe mode.)
    5. Reset the NVRAM.
    6. Reset the SMC.
    7. Reinstall OS X after backing up all data as a precaution. You won't need your backup unless something goes wrong.
    8. Make a "Genius" appointment at an Apple Store.
    Back up all data on the internal drive(s) before you hand over your computer to anyone. If privacy is a concern, erase the data partition(s) with the option to write zeros* (do this only if you have at least two complete, independent backups, and you know how to restore to bare metal from any of them.) Don’t erase the recovery partition, if present.
    *An SSD doesn't need to be zeroed.

  • Cannot map sound through it from another system?

    I have two systems, the mac mini and a thinkpad notebook. I initially setup the mac speaker output to go to the input on my thinkpad dock, worked like a charm, I could hear both the sounds on the mac (itunes for instance) while still being able to hear sounds on my thinkpad when I'm working through the same speakers.
    I just tried this in reverse as the family would like the mac to have sound when I'm out of the house with my laptop. It doesn't work.
    When I am looking at the input for sound on the mac and I play a sound on the thinkpad the mac KNOWS the sound is being played, the input level shows it, but it just will not actually play it through the speakers.
    What am I missing here? Sound does play from the mac through the speakers though.

    Well, this worked and didn't work. It did pass sound through, but it always had an annoying "buzz" in the speakers, like a mic hooked up to an amp etc. Also, the sound wasn't clean and crisp, was kind of choppy I guess...Tried it even at the lowest levels I could set everything to, the buzz was always there and the sound just wasn't quite right.
    Thanks for the suggestion though!
    It's just too bad a mac can't do this natively and clean like my thinkpad does...on the thinkpad no buzz and sound is clear as a bell...Guess the family will just have to get use to plugging the speakers into the mac when I've taken my laptop with me and left for the day.

  • Error While reading CLOB from Oracle using WebLogic Connection Pool, Works fine with out using pool

    PROBLEM DESCRIPTION :
         When I try to read a clob from Oracle, I receive "ORA-03120: two-task
    conversion routine: integer overflow" Error.
         This error occurs only for CLOB Type and only if I try to connect to
    Oracle using WebLogic JDriver/Oracle POOL.
         IMPORTANT NOTE: I can read CLOB or any other data using direct JDBC
    connection to ORacle with out any problem.
         Below Please find the JAVA CODE for Both Working and NON Working .
    Created a Connection Pool as:
    Name: MyJDBCConnectionPool
    URL : jdbc:weblogic:oracle
    DIRVER:weblogic.jdbc.oci.Driver
    NON WORKING JAVA CODE (USES WEBLOGIC JDBC CONNECTION POOL TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:weblogic:pool:MyJDBCConnectionPool",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    WORKING JAVA CODE (USES DIRECT THIN JDBC CONNECTION TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:oracle:thin:@server:1521:DB",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    ERROR MESSAGE:
         ORA-03120: two-task conversion routine: integer overflow
    I appreciate your help on this problem.

    PROBLEM DESCRIPTION :
         When I try to read a clob from Oracle, I receive "ORA-03120: two-task
    conversion routine: integer overflow" Error.
         This error occurs only for CLOB Type and only if I try to connect to
    Oracle using WebLogic JDriver/Oracle POOL.
         IMPORTANT NOTE: I can read CLOB or any other data using direct JDBC
    connection to ORacle with out any problem.
         Below Please find the JAVA CODE for Both Working and NON Working .
    Created a Connection Pool as:
    Name: MyJDBCConnectionPool
    URL : jdbc:weblogic:oracle
    DIRVER:weblogic.jdbc.oci.Driver
    NON WORKING JAVA CODE (USES WEBLOGIC JDBC CONNECTION POOL TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:weblogic:pool:MyJDBCConnectionPool",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    WORKING JAVA CODE (USES DIRECT THIN JDBC CONNECTION TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:oracle:thin:@server:1521:DB",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    ERROR MESSAGE:
         ORA-03120: two-task conversion routine: integer overflow
    I appreciate your help on this problem.

  • Reading in from File w/out path name

    Does anyone know why netbeans requires an entire path name to read from a file? I am trying to read from a file and I want the program to just look in the directory that the jar file is in to find the file to read from. I do not want the file to be IN the jar file, just inside that directory...

    As I understand it, when your code runs, it does not run relative to the folder that the jar file that contains it exists in. If you want to know where the code is running from in order to use relative path instead of absolute path, put this in your code and examine the output it generates:
    File file =new File("");
    System.out.println( file.getAbsolutePath() );
    Example: if the print out shows your code is running in:
    c:/ dir1 /dir2 / dir3
    and your file is in
    c: / dir2 /dirN / myFile.txt
    then your relative path would be:
    ../dirN/myFile.txt
    where starting from c:/ dir1 /dir2 / dir3, ../ means go one folder level "up" (to c:/ dir2 ), and dirN/ means from there, go down into the folder dirN (which would be c: / dir2 /dirN )

  • Large file read in, system out error!

    the following method simply reads 6MB text file by each line.
    After reading a line, separate the line with '\t', and obtain 2 tokens.
    After getting 2 tokens, synthesis the 2 tokens into another string token.
    Sythesized token is displayed with System.out.println().
    However, I can't have all contents from the input file, and I can't dispaly all of them in monitor screen, either.
    What's wrong with my code?
    PS: each line of the input file is structured by "key\tcontent\n" , and the number of lines is 400000.
    ===========
    public void makeDictionary(){
    String line;
    try{
    BufferedReader in = new BufferedReader( new FileReader(filePath));
    while( (line = in.readLine()) != null ){
    String key;
    String content;
    int index = line.indexOf('\t');
    key = line.substring(0, index);
    content = line.substring(index+1, line.length());
    System.out.println( key + "\t" + content );
    System.out.flush();
    in.close();
    catch( Exception e){}
    }

    Thank you for your answer.
    I can't enough thank you.
    Actually, I used try..catch structure for my code, however I didn't get any message from catch block. In addition to this, the process didn't stop; in other word, the process was going on while doing nothing. I monitored the utilizaton of CPU and memory. The utilization of CPU was 100%, but after a while, it was 0%, even though process was still alive. The state which the process was doing nothing continued forever.
    Frankly speaking, I used this code for constructing my own data structure from a large text file. While debugging my code, I realized that the method, readLine() of BufferedReader class didn't load all the data of the input file, so I made the code for testing.
    Anyway, I am just fully depending on your answer. Please help me!!!!
    Your quick response will be appreciated.

  • System.out from Java class not output to JSP

    I am using JSP to make a Java API web accessible. I include (package) java classes that write error messages to standard out when they catch an error. Works fine on the command line. Problem occurs when using in JSP. I include them with a page directive (importing the package) rather than use them as beans, since they do so much more than beans do, and since I use many of the classes in a single page.
    i.e.
    <%@ page import="OPS.*" %>
    When errors occur, messages to "standard out" (system.out) don't appear in the html output of the JSP. I don't know where they are going (they aren't in the web server's error log), but they aren't going where I expected them to (browser window).
    I figured that standard out was the browser (httpServletResponse). Where am I going wrong here?
    Basically, I have a class that connects to a database (call it db) and does queries/updates. I have a class (call it employee) that uses the db class. I have a jsp page that instantiates the employee class and executes method calls. The code in the db class that outputs SQL error messages (db class instantiated by employee class) never gets put in the browser window. Nor in the server log, nor the console.
    How can I get system.out calls in classes db and employee to get output to the browser? The JSP outputs all other code and is not freezing nor not flushing the buffer.
    Thanks!

    I also use an Iplanet over which I have little control. But I can log on via telnet. If I log on (I use Reflection) and run my pages, the errors show in the Reflection window. If you have telnet access to the server, you might want to give this a try.
    Another alternative would be to add a few lines to your classes that allow you to pass a reference to the jsp StringWriter from your jsp and use that to output the errors to the browser.

  • System.in.read and System.out.print questions

    On the following code, two questions:
    1. the output is not what I expected. Why doesn't the System.out.println(i+" "+(char)i); print everytime i press enter a character? It seems to print all at once after everything is entered.
    package stars;
    import java.io.*;
    public class Stars {
      public static void main (String[] args) throws IOException {
        String U="";
        System.out.print("What is your name: ");
        while (true) {
          int i=System.in.read();
          U+=(char)i;
          System.out.println(i+" "+(char)i);
          System.out.flush();
          if (i==10||i==13) break;
        System.out.println("\rHello "+U);
    }C:\>java -cp . stars/Stars
    What is your name: blah
    98 b
    108 l
    97 a
    104 h
    13
    Hello blah
    2. What is the most natural way to check for the press of an enter key? Is there a java attribute or method for the "Enter key" since it is different on unix and ms-dos? Thanks

    On the following code, two questions:
    1. the output is not what I expected. Why doesn't
    the System.out.println(i+" "+(char)i); print
    everytime i press enter a character? From:
    http://scv.bu.edu/Doc/Java/tutorial/java/nutsandbolts/input.html
    ================
    "The read() method provided by System.in reads a single character and returns either the character that was read or, if there are no more characters to be read, -1.
    When a program reads from the standard input stream, the program blocks waiting for you to type something in. The program continues to wait for input until you give it some indication that the input is complete. To indicate to any program that reads from the standard input stream that you have finished entering characters, type the end-of-input character appropriate for your system at the beginning of a new line"
    ================
    In other words, Java can't do what you want to do.
    <snip>
    >
    2. What is the most natural way to check for the
    press of an enter key? Is there a java attribute or
    method for the "Enter key" since it is different on
    unix and ms-dos? Thanks
    System.getProperty("line.separator");Jim S.

Maybe you are looking for

  • Where can i find edited adobe photoshop files in time machine after update?

    i was having issues with my computer, brought it in to apple store. they suggested i back everything up on external using time machine before doing a erase/re-write. i did so. HOWEVER, my edited photos in photoshop & bridge are gone. after the re-wri

  • Unable to open the Project web app Instnace , giving STS error

    I am unable to open the Project server web app instance from CA- Proejctserver application service -- Manage , it is giving error and I am unable to open the instance as well http://intranet.cmpy.com/pwa also giving error . LOg is showing as below An

  • Is there a way to change the icloud email address associated with your Apple ID?

    I had an Apple ID long before iCloud came around.  Naturally, my username was my email address, let's say [email protected]  I signed up for an @me email address when they started just to try it out, but never used it.  Either by default or by my own

  • Duplex Printing Problem in Adobe Reader X (Mac)

    My normal printer setting is for duplex printing. However, Adobe Reader X will only print on one side of the paper.. This is on a MacPro under Mac OSX 10.6.6 and Adobe Reader X Version 10.0.1 printing to a Canon IP4500 inkjet printer. Other applicati

  • Exporting to SWF

    I'm new to AE, so forgive me if this is a dumb question. But I would really appreciate some help. How can I convert 12 second .mov loop with transparency into a 15 second .swf with a transparent background for use in an Adobe Captivate project? What