Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Need to print the words

  1. #1
    Junior Member
    Join Date
    Jul 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Need to print the words

    private void playAudio() {
    try {
    byte audio[] = out.toByteArray();

    InputStream input = new ByteArrayInputStream(audio);
    final AudioFormat format = getFormat();
    final AudioInputStream ais = new AudioInputStream(input, format, audio.length / format.getFrameSize());
    DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
    final SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info);
    line.open(format);
    line.start();
    Runnable runner = new Runnable() {
    int bufferSize = (int) format.getSampleRate() * format.getFrameSize();
    byte buffer[] = new byte[bufferSize];

    public void run() {

    try {
    int count;
    while ((count = ais.read(buffer, 0, buffer.length)) != -1) {
    if (count > 0) {
    line.write(buffer, 0, (char)count);
    System.out.print((char)count);

    }
    }
    line.drain();
    line.close();
    } catch (IOException e) {
    System.err.println("I/O problems: " + e);
    System.exit(-3);
    }
    }
    };
    Thread playThread = new Thread(runner);
    playThread.start();
    } catch (LineUnavailableException e) {
    System.err.println("Line unavailable: " + e);
    System.exit(-4);
    }
    }


    //----------------------------------------------------

    In above I mentioned my code.Its about capture the voice from target data line (Line in) and play it. It works fine. What I want to do is I want to print the byte arrays, for example If I say "Hi,good morning to my microphone,my system capture it and play back to me."What I want is I dont want to play it back. I want to print it. (For example I want to show it in a joption pane.)

    Please help me.Urgent.please..

    //--------------------------------------------------


  2. #2
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    589
    My Mood
    Sleepy
    Thanks
    10
    Thanked 87 Times in 80 Posts

    Default Re: Need to print the words

    Then you need to implement a voice recognition module that converts the sound bytes into printable words. Might take you a few years with a good team of developers.

  3. #3
    Junior Member
    Join Date
    Jul 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Need to print the words

    I already done that part. but in that case it converting the mic input voice. Means if i directly say some thing to the microphone it will give the correct word. but I want to do the opposite side. Just assume I am playing a song and capturing it using my software.Then when I perform the play it will only show the words which are recorded. did you get what I want? and I am very honest to say I am the only developer of this system and upto now I only get 30 days.

Similar Threads

  1. Replies: 12
    Last Post: March 17th, 2013, 01:38 AM
  2. Replies: 1
    Last Post: December 3rd, 2012, 01:35 PM
  3. xfa.host.print: print a page + some page range.
    By gammaman in forum Totally Off Topic
    Replies: 2
    Last Post: May 10th, 2012, 08:07 AM
  4. Can't figure out how to print out number of lines and words in a file in c++
    By javapenguin in forum Other Programming Languages
    Replies: 1
    Last Post: January 29th, 2012, 06:53 PM
  5. Help: Num to words
    By shamed in forum What's Wrong With My Code?
    Replies: 7
    Last Post: January 7th, 2010, 05:55 PM

Tags for this Thread