Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I need help writing some java code

    Ok, so i need help writing a java script that will look at a bunch of numbers and output the highest one so what i need is for it to do something like this.

    (A is my input value)
    (B is my output value)
    the (A) value will be constantly changing and with the script has to do is look at all of those values and output them to (b)


    if anyone knows how to do this i would be so grateful if they could write the code for me because i'm new to coding and i really need this to work.
    thanks.

  • #2
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    sounds very much like a piece of school homework haha. What variable type is (A)? Array?

  • #3
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by BluePanther View Post
    sounds very much like a piece of school homework haha. What variable type is (A)? Array?
    well it's not homework, it's for a audio interactive motion graphic.
    and i don't know what type variable (A)
    (A) will be the audio level input ranging from 0 to 1 so (A) will be any # between 0 and 1
    and i need it to tell me the highest audio level
    Last edited by Aaron h; 07-25-2011 at 02:51 AM. Reason: spelling

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,996
    Thanks
    79
    Thanked 4,433 Times in 4,398 Posts
    Ummmm...you are asking for JAVA help. This is the JavaSCRIPT forum. About the only thing the two languages have in common are the first 4 letters of their names.

    So which is it you really need? If it's really Java, then try the Java forum.

  • #5
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    this is the Java form

  • #6
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    nope.

  • #7
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oh well can you guys help me out anyways?

  • #8
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,996
    Thanks
    79
    Thanked 4,433 Times in 4,398 Posts
    Well, the code (in any language) is trivial. But the means of *displaying* the results will be completely different in the different languages.

    And you don't say where/how your stream of "A" values is coming from. Is it some port that the code needs to sample (a) as fast as possible, (b) once a millisecond, (c) once an hour, (d) or what?

    But the basic code is surely something like
    Code:
    double maxA = 0;
    while ( true )
    {
         double a = readNewA( );
         if ( a > maxA ) maxA = a;
    }
    But now you need to figure out how to display maxA. You need to code readNewA. And...

    The devil is in the details.

  • #9
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well, the value of (A) is coming from a live audio feed (audio input on the computer) witch is being piped into this Java script. and i just want it to be display it as a number. like a simple equation # goes in on (A) max # comes out on (B)

    sorry i'm new to java and i really need this to work.

  • #10
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,996
    Thanks
    79
    Thanked 4,433 Times in 4,398 Posts
    I have NO IDEA how you can read the (volume?) of an audio feed. I would assume you need an A-to-D converter. But for the rest of it...if you don't know the details (e.g., how often you will sample the value), how can you expect us to know.

    And you haven't given an inkling of how you intend to display the B value.

  • #11
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes i do have an A to D converter, it need to sample it as fast as possible, and i just need it too look at the level and find the max level and output it as a # thats it

  • #12
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Never mind i got it to work thank you so much you saved my butt like no joke


  •  

    Posting Permissions

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