Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8752517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:15:05+00:00 2026-06-13T13:15:05+00:00

I have this code for my web application that I need some improvement, it

  • 0

I have this code for my web application that I need some improvement, it works somehow but the outcome is quite slow:

The idea behind this code are:

  • The function gets the current buffer and then transpose it into an array (with 50ms sampling rate)
  • At every sampling, the elements of the array must be rendered by passing each element in the updateWave function
  • For the next iteration, the current buffer is fetched again, but it contains the previous data (so previous data/elements should not be rendered) the new elements must be rendered again.

Updated (simplified code):

private String data = "";   
// This function renders the waveform in the page, has been tested to
// render properly and smoothly by passing random double value at 50ms interval    
public void updateWave(String waveValue){
    wave.renderWaveOnFly(Double.parseDouble(waveValue));
}

public final native void waveIt()/*-{   
    var instance = this;
    $wnd._waver = setInterval(function(){
            // Get the current buffer from the flash interface
            // Note it fetches everything in the buffer
            var newData = $wnd.Recorder.audioData().toString();
            var strData = newData.toString();
            var arr = strData.split(',');
            var arrEl = arr.pop();
            instance.@com.mycode.wavegwt.showcase.client.Showcase::updateWave(Ljava/lang/String;)(arrEl.toString());
            //console.log(arrEl);
        }
    ,50);
}-*/;

// This function renders the waveform from math function 
// and the waveform is smooth and the UI is still responsive
public final native void waveItByRandomValue()/*-{  
    var instance = this;
    $wnd._waver = setInterval(function(){
            var arrEl = Math.cos(i++/25) - 0.2 + Math.random() * 0.3;
            instance.@com.mycode.wavegwt.showcase.client.Showcase::updateWave(Ljava/lang/String;)(arrEl.toString());
        }
    ,50);
}-*/;

public native void renderWaveOnFly(Double _data)/*-{
    var data = $wnd.data;
    data.push(_data);
    $wnd._waveform.update({
        data: data
    });
}-*/;

waveIt() is a function that reads a buffer from a flash interface (which gets its data from the microphone). For the demo, I set the mic recorder to record 10 seconds when triggered, then when recording starts waveIt(), after 10 seconds call clearInterval($wnd._waver)

The problem with this:

  • waveIt() function is really slow, i.e, the UI is not responsive when running this and that the rendering takes so slow
  • Compared to waveItByRandomValue() which renders fast and the UI is still responsive when running this function

I am running out of strategy on how to make this work right.

To see my project live see this: http://bitly.com/XGboA1

I also did explain a bit more of this problem in Google Groups: http://bitly.com/SqSZVl

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:15:06+00:00Added an answer on June 13, 2026 at 1:15 pm

    This might be a part of the solution, typed arrays :

    http://www.html5rocks.com/en/tutorials/webgl/typed_arrays/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code that does a web-service request. While doing this request I need
I have used this code for extracting urls from web page.But in the line
I have the need to expand an asp.net 2.0 web application that I recently
I am working on a web application where I need to schedule some code.
The issue is this: I have a web application that runs on a PHP
I have a web application that I'm writing (C#, MSSQL) and I need to
I have a need to create a Web Application that can interact with 3D
So I have this one CakePHP web application that I'm trying to refactor. There
I have an ASP.NET web form application that on the server side I need
I have a win forms application that contains a Web Browser control. I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.