Results 1 to 15 of 15
Like Tree1Likes
  • 1 Post By JosAH

Thread: Help needed for project

  1. #1
    luppiex is offline Member
    Join Date
    Oct 2013
    Posts
    15
    Rep Power
    0

    Default Help needed for project

    Hi, I've been told to program a hearing aid like application for android devices using Eclispe, and I've never touched on Java before. Is there anything that could get me started?
    I've looked up on some VOIP SDK thinking that it might make things easier for me as I'm doing this alone. So, I will like to know if there is anything else
    that could really help me out on this.
    Last edited by luppiex; 10-21-2013 at 08:18 AM.

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,596
    Rep Power
    5

    Default Re: Help needed for project

    You have to start with learning the language and the tools. Until you do that, learning anything else is going to be fruitless.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    luppiex is offline Member
    Join Date
    Oct 2013
    Posts
    15
    Rep Power
    0

    Default Re: Help needed for project

    Hi gimbal2, thanks for the speedy reply. Will all these be possible to be done in a month? Considering the fact that I will need to learn the language from scratch and everything by myself.

  4. #4
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    902
    Rep Power
    2

    Default Re: Help needed for project

    If you have experience with some other OO language, you might have a chance. Otherwise, with no programming experience, you're probably screwed to the max. What fool told you to do such a thing?

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,596
    Rep Power
    5

    Default Re: Help needed for project

    Generally this requires a few years of school, an internship and a few years working as a junior you know. Programming is hard, software development (as in, actually making something for real) is -very- hard. Until you have a few years of working experience under your belt.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    luppiex is offline Member
    Join Date
    Oct 2013
    Posts
    15
    Rep Power
    0

    Default Re: Help needed for project

    Nevertheless, thank you guys. I'll try to do what I can for this project and come back here if I have any questions.

  7. #7
    luppiex is offline Member
    Join Date
    Oct 2013
    Posts
    15
    Rep Power
    0

    Default Re: Help needed for project

    Hi, now I am having problem debugging this source code:
    Java Code:
    package com.example.testtest;
    
    
    
    import java.io.*;
    
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.SourceDataLine;
    import javax.sound.sampled.TargetDataLine;
    
    public class MainActivity  {
    	private IncomingSoundListener isl = new IncomingSoundListener();
        private OutgoingSoundListener osl = new OutgoingSoundListener();
        private boolean inVoice = true;
        private boolean outVoice = false;
        AudioFormat format = getAudioFormat();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
    
        private AudioFormat getAudioFormat() {
        	float sampleRate = 20000.0F;
            int sampleSizeBits = 16;
            int channels = 1;
            boolean signed = true;
            boolean bigEndian = false;
            //AudioFormat.Encoding.ULAW
            return new AudioFormat(sampleRate, sampleSizeBits, channels, signed, bigEndian);
    	}
        public MainActivity(){
        	new Thread(isl).start();
        	new Thread(osl).start();
        	outVoice = true;
        }
    
    	
    	class IncomingSoundListener implements Runnable {
    	    @Override
    	    public void run() {
    	        try {
    	            DataLine.Info speakerInfo = new DataLine.Info(SourceDataLine.class, format);
    	            SourceDataLine speaker = (SourceDataLine) AudioSystem.getLine(speakerInfo);
    	            speaker.open(format);
    	            speaker.start();
    	            while(inVoice) { 
    	                byte[] data = baos.toByteArray();
    	                baos.reset();
    	                ByteArrayInputStream bais = new ByteArrayInputStream(data);
    	                AudioInputStream ais = new AudioInputStream(bais,format,data.length);
    	                int numBytesRead = 0;
    	                if ((numBytesRead = ais.read(data)) != -1) speaker.write(data, 0, numBytesRead);
    	                ais.close();
    	                bais.close();
    	            }
    	            speaker.drain();
    	            speaker.close();
    	        } catch (Exception e) {
    	            e.printStackTrace();
    	        }
    	    }
    	}
    
    	class OutgoingSoundListener implements Runnable {
    	    @Override
    	    public void run() {
    	        try {
    	            DataLine.Info micInfo = new DataLine.Info(TargetDataLine.class, format);
    	            TargetDataLine mic = (TargetDataLine) AudioSystem.getLine(micInfo);
    	            mic.open(format);
    	            byte tmpBuff[] = new byte[mic.getBufferSize()/5];
    	            mic.start();
    	            while(outVoice) {
    	                int count = mic.read(tmpBuff,0,tmpBuff.length);
    	                if (count > 0) baos.write(tmpBuff, 0, count);
    	            }
    	            mic.drain();
    	            mic.close();
    	        } catch (Exception e) {
    	            e.printStackTrace();
    	        }
    	    }
    
    	}
    
    }
    Is it possible to run JRE library in an android app?
    Last edited by JosAH; 10-30-2013 at 10:34 AM. Reason: added [code] ... [/code] tags

  8. #8
    luppiex is offline Member
    Join Date
    Oct 2013
    Posts
    15
    Rep Power
    0

    Default Re: Help needed for project

    I am running this source in Android Application project, when I run this code in Java project, it worked just fine after adding a main.

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,755
    Rep Power
    19

    Default Re: Help needed for project

    Moved thread out of staff only section.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  10. #10
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,309
    Blog Entries
    7
    Rep Power
    20

    Default Re: Help needed for project

    Quote Originally Posted by luppiex View Post
    I am running this source in Android Application project, when I run this code in Java project, it worked just fine after adding a main.
    Did you check if all those packages and classes are present in that Android Java virtual machine before trying to run the entire shebang and hope for the best? That Android Java implementation is a heavily molested one: packages were removed, JIT compilation was considered unnecessary and the entire runtime model is different from the standard JSE one ...

    kind regards,

    Jos
    gimbal2 likes this.
    cenosillicaphobia: the fear for an empty beer glass

  11. #11
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,755
    Rep Power
    19

    Default Re: Help needed for project

    The Sound API does not exist in Android.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  12. #12
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,596
    Rep Power
    5

    Default Re: Help needed for project

    Quote Originally Posted by JosAH View Post
    That Android Java implementation is a heavily molested one
    Thanks, finally I have the appropriate term for it: molested. Google is such a wonderful beast. On the one hand they produce all these wonderful APIs and tools to strengthen the Java platform itself... and then they create Dalvik and the Android standard API and rip it apart completely. Thanks Google!
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  13. #13
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,309
    Blog Entries
    7
    Rep Power
    20

    Default Re: Help needed for project

    Quote Originally Posted by gimbal2 View Post
    Thanks, finally I have the appropriate term for it: molested. Google is such a wonderful beast. On the one hand they produce all these wonderful APIs and tools to strengthen the Java platform itself... and then they create Dalvik and the Android standard API and rip it apart completely. Thanks Google!
    They should defenestrate that guy Dalvik, head first; who on earth in his right mind thinks that parts of the JRE core library could go or should be heavily mutilated and still claim the result is Java? Even their Android plugins for Eclipse suck big times; I refuse to work with them and I'd like to call for a revolt.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  14. #14
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,596
    Rep Power
    5

    Default Re: Help needed for project

    I'll bring the tar and feathers, you bring the pitchforks and torches!
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  15. #15
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,309
    Blog Entries
    7
    Rep Power
    20

    Default Re: Help needed for project

    Quote Originally Posted by gimbal2 View Post
    I'll bring the tar and feathers, you bring the pitchforks and torches!
    Don't be so bourgois, only open the window at the top floor and bring in the plebeians; they must be hungry by now ...

    kindest regards,

    Jos ;-)

    ps. and get the cars out of the way please.
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Help needed in Java Project
    By 1995ad in forum New To Java
    Replies: 17
    Last Post: 11-02-2010, 05:06 AM
  2. Programmer needed for J2ME project
    By Sber in forum Reviews / Advertising
    Replies: 0
    Last Post: 11-04-2009, 02:51 PM
  3. help needed in runnin java project
    By anurag.25 in forum Advanced Java
    Replies: 14
    Last Post: 02-15-2009, 07:00 PM
  4. help needed with project
    By Ice_Angel in forum JDBC
    Replies: 1
    Last Post: 06-22-2008, 08:00 PM
  5. Uni Project - GUI - Help Needed
    By deeadeed in forum New To Java
    Replies: 0
    Last Post: 12-03-2007, 11:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •