GarageBand-like waveform motion in Swing

I have written a custom JPanel that paints an audio waveform to itself after converting the audio file to a double[] representation and bandpass filtering. Needless to say, that takes a while to do, about half a second on my computer.
Now I would like the the waveform to move smoothly across the screen so that the current audio position stays in the middle of the visible portion of the JPanel. (This is what Apple's GarageBand does when audio is being played back). I need this motion to occur without the waveform panel itself recomputing the waveform drawing every time the visible portion of the wave is shifted.
What is the best way to achieve this effect? So far I have considered:
1) Overriding the waveform JPanel's paintComponent() method so it returns an off-screen buffer any time the waveform itself has not changed. At that point I could just stick the JPanel in a JScrollPane and programmatically scroll it.
2) Programmatically scroll a JScrollPane containing my wave JPanel as described in (1), but find some way to override the "new" scrolling algorithm (described in the API) which repaints the underlying component on every move. This way I would not need to maintain an offscreen buffer for the waveform JPanel.
Maybe there is some better way? How do people generally scroll JComponents that are very expensive to repaint()?
I would appreciate advice on this one, perhaps with a link to an example! Thanks in advance.

FYI, your applet and program do not launch on my computer.
App error:
JNLPException[category: Launch File Error : Exception: null : LaunchDesc:
<jnlp spec="1.0" codebase="http://www.pscode.org/sound/" href="http://www.pscode.org/sound/audiotrace.jnlp">
  <information>
    <title>Audio Trace 1.0</title>
    <vendor>Andrew Thompson</vendor>
    <homepage href="http://www.pscode.org/sound//<p>
Audio Trace shows an oscilloscope or lissajous style trace of the
sounds currently playing through your computer. 
</p>
<p>
A variety
of scroll, zoom and fade effects can be applied to the trace
for visual interest.
</p>"/>
    <description kind="one-line">Audio Trace - oscilloscope style sound trace application.</description>
    <description kind="tooltip">Audio Trace</description>
    <icon href="http://www.pscode.org/sound/audiotrace-64x64.gif" height="64" width="64" kind="default"/>
    <icon href="http://www.pscode.org/sound/audiotrace-32x32.gif" height="32" width="32" kind="default"/>
    <shortcut online="false">
      <desktop/>
      <menu submenu="PSCode"/>
    </shortcut>
    <offline-allowed/>
  </information>
  <security>
    <all-permissions/>
  </security>
  <update check="timeout" policy="always"/>
  <resources>
    <java href="http://java.sun.com/products/autodl/j2se" version="1.3+"/>
    <jar href="http://www.pscode.org/sound/audiotrace.jar" download="eager" main="true"/>
  </resources>
  <application-desc main-class="org.pscode.sound.AudioTrace"/>
</jnlp> ]
     at com.sun.javaws.LaunchDownload.getMainClassName(LaunchDownload.java:1037)
     at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1075)
     at com.sun.javaws.Launcher.run(Launcher.java:105)
     at java.lang.Thread.run(Thread.java:613)
Applet error:
NoClassDef for MultipleGradientPaint

Similar Messages

  • My i7 sandy bridge with optibay harddrive is running slow in diablo 3 in low setting. Before I can run ultra settings on Starcraft. It lags now even I run log in sc2!!! It gets slower and slower in game that is like slow motion!!! Computer gets hot.

    Hi everyone, I been noticing my MacBook pro getting very slow in games like diablo 3 and Starcraft. This MacBook pro was bought a year ago. It is running i7 sandy bridge with a 128 Ssd. I did install optibay with a monetux xt hard drive in it.
    It could run ultra setting on Starcraft no problem and is very smooth when I first got it. Lately I got diablo 3, and it gets very slow. I had to change all the graphics setting to low. It is not slow in the beginning, but it gets very slow after a while. It is like slow motion!!! Even when is low, it is still very laggy in game. I tried to repair the disk and clean up the laptop with onyx and still doing the same thing. I even try to reboot when is slow, but same thing after I reboot. I guess the MBP still hot.
    Also I am running in lion!

    If it's a 13" MBP you don't have the more powerful dedicated graphics and there is nothing you can do but be mad at Apple for deceiving you that the 13" MacBook Pro was capable of extreme graphics.
    Only the 15" and 17" have the more powerful dedicated graphics in addition to the CPU graphics.
    Mac video card performance

  • What is causing this breathing-like lens motion effect?

    I was shooting some video this week with my Canon Rebel T3 (1100D). This camera only has one video mode, which has auto focus and auto exposure, but I have the AF switch on my lens switched off and I set the focus manually. I was shooting with a tripod and zoomed in. When I reviewed my footage later, it was almost unusable, because ever couple of seconds there is some sort of shift in the lens, the focus goes a little blurry, and the zoom changes slightly, and then it goes back to where  I had it set. The effect looks as if the lens is "breathing", like the lens is literally expanding and contracting, although I think that term may have a slightly different meaning that what I am experiencing. I am not moving the lens or touching the camera at all. Auto focus is turned off, and I am not zooming, so there should be no motion in the camera. Is this caused by some sort of image stabilization gone wrong? Or is there some other techinical glitch that it might be?
    Solved!
    Go to Solution.

    First you said you "zoom in" then you said you didn't zoom in/out at all. I'm not sure if you zoom the lens during recording or not. But if you did, it could be like Cicopo said. Most photography lens are not parfocal.
    Here is the excerpt from Lensrental.com
    "Does The Lens Breathe?
    A lens that breathes changes the size of the image slightly when your focus from near to far or vice-versa. Most photography lenses do. If you look at the Specs we post for various lenses, any lens that has “rear element focusing groups” will definitely breathe, sometimes dramatically. Lenses with a “floating element” (used to improve close up sharpness) will also breathe.
    Is The Lens Parfocal?
    Some lenses are parfocal, meaning that zooming does not change the focus point. All cine zooms are parfocal, but very few photography zooms are — for the same reason that they breathe, and for lower costs. If you want to zoom while filming, its important to make sure the lens you choose is parfocal, and remember, most are not.
    The following lenses are constant focus while zooming. If its not on this list, it is not parfocal.
    Tokina: 11-16mm f/2.8
    Canon: 17-40 f/4 , 16-35 f/2.8 , 70-200 f/2.8 Non-IS
    Nikon: 17-35 f/2.8, 24-70 f/2.8 AF-S , 70-200/2.8 VR Mark I (not the Mark II)
    Micro 4/3: Panasonic 7-14 f/4
    Standard 4/3: Olympus 11-22 f/2.8-3.5"
    Full article here: http://www.lensrentals.com/blog/2011/02/photo-lenses-for-video
    Weekend Travelers Blog | Eastern Sierra Fall Color Guide

  • Olap like table in java swing

    I need to show olap data in java swing. Can anybody help me providing the source code. It show the olap data from sql server in java swing with
    following facility like
    1) row span
    2) column span
    3) drill down
    4) expand and colapse any row and column
    5) uneven row column exapnson

    I would like to put the values in the String [][] data from left to right in a row and top to bottom in a column. I changed the program a little. I have problem to put the data using this function: model.getValueAt( data[i][j]
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    public class actuationTable extends JPanel {
    int numRows = 3;
    int numCols = 3;
    public actuationTable() {
    super(new FlowLayout());
    String[][] data = {{"g ","h", "i"},{"a", "b", "c"}, {"d", "e", "f"}};
    final JTable table = new JTable(numRows,numCols);
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    table.setFillsViewportHeight(true);
    printDebugData(table);
    JScrollPane scrollPane = new JScrollPane(table);
    add(scrollPane);
    private void printDebugData(JTable table) {
    javax.swing.table.TableModel model = table.getModel();
    for (int i=0; i < numRows; i++) {
    for (int j=0; j < numCols; j++) {
    int[][] data;
    System.out.print(" " + model.getValueAt( data[i][j]));
    private static void createAndShowGUI() {
    JFrame frame = new JFrame("ActuationTable");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    FlowLayoutDemo newContentPane = new FlowLayoutDemo();
    newContentPane.setOpaque(true);
    frame.setContentPane(newContentPane);
    frame.pack();
    frame.setVisible(true);
    public static void main(String[] args) {
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    }

  • How to realize the functionality like the JLayer in Swing?

    JLayer in Swing is a decorator for Swing components. It enables us to draw on components and respond to component events without modifying the underlying component directly, which is interesting  to me. How to do that in JavaFX?

    Technique Description - Use a StackPane
    For simple layering, wrap the underlying node in a StackPane and add further nodes to the stackpane to layer them on top.
    One technique is to just use two nodes in the StackPane, the original node and a Pane on top the original node.  Because the Pane is a automatically resizable Node, the Pane size will adjust to completely cover the Node below. By setting the pickOnBounds and mouseTransparent properties of the Pane appropriately, you can decide whether you want to top pane to consume all mouse events, consume only mouse events on the areas where the top Pane is not transparent and let the rest pass through to the underlying node or let all mouse events be handled by the underlying node.  The top pane is sometimes known as a glass pane.
    Links to examples which use the described technique
    A very simple example with no input processing is =>
    javafx 2 - How to implement a transparent Pane with non-transparent children? - Stack Overflow
    A more comprehensive demonstration of the technique is han solo's blog post on using a glass pane for processing =>
    http://harmoniccode.blogspot.com/2013/04/validate-it.html
    For a supported library by a commercial company see the Decoration Utilities from JideFX =>
    Highlights of the JideFX Beta Release (2 of 3) | David Qiao's Blog
    Suggested Approach
    If you just have one-off requirements than rolling your own like in the StackOverflow answer or han solo's blog is the way to go.
    If you have more sophisticated requirements, you should look into JideFX (it is an open source library).
    And I hope I've got this answer right because I've never used JLayer in Swing, but it appears similar to what I have described.

  • Satellite A105-S2031: DVD/CD plays to slow like slow motion

    Hi, my A105 - S2031 has CD/DVD combo TS-L462C. If I play a CD or DVD, everyting is too slow like a slow motion.
    Does anyone could help me how I can fix this? Or is this a mechanical error of the CD/DVD combo?
    Thanks for anybody's help in advance, Michael

    First of all we should clarify if this is software or a hardware issue;
    In such case it would be advisable to test the notebook with factory settings
    I think you should use the Toshiba recovery CD and should restore the unit back to the Toshiba factory settings.
    Usually the movies should run smoothly without any troubles using the right applications like WinDVD for example.
    If some troubles will appear then a graphic driver update could be advisable but if this will not help then an ASP should be contacted and the notebook should be checked.

  • Stepper motor and loacell PID control - waveform motion.

    Hi, 
    Hardware :  cRio9073, C series module 9403 for stepper motor control and 9215 for load cell data acquisition. 
    I am trying to control a stepper motor in a closed feedback loop system with a load cell. The user would have to input two things : the maximum load applied and the frequency of the motion. At the moment I have it working in open loop controlling how many steps forwards or backwards it does and at what rate, with a display showing the load being applied.
    I am now looking to include the "PID.vi" built into labview into my existing code. I am using the load cell output as the 'process variable' and the 'output' of the PID will control the wait time between an ON and OFF signal to the motor (since I have to do the PWM in software as the 9403 module doesn't do it in hardware. Is this the right way to do it? ) 
    I wish to make the motor do a sinewave motion, thus the 'setpoint' of the PID would be dynamic. I have therefore linked the "Sinewave form.vi" (also built into labview) to the setpoint and the frequency of the "Sinewave form.vi" will be the user input for the frequency of the motor. However my problem lies with the 'Sampling info' of the "Sinewave form.vi" : Previously that is what controlled my number of steps, defining the maximum displacement of the motor. Now I need the peak of the generated sinewave to coincide with the maximum load applied defined by the user. How can I make it do that? 
    I have attached my existing code with how I have attached the PID.vi at the moment. 
    Many thanks for your help
    Lawrence 
    Attachments:
    PIDControl.vi ‏23 KB
    BIOGROWTH.lvproj ‏46 KB

    Hi Lawrence,
    Here is an example PID VI.
    Regards
    Rico P
    Attachments:
    General PID Simulator.vi ‏22 KB

  • Adding Effects like slow motion, fast motion etc...

    On the old imovie you could add animations, slow motion/fast motion, and other graphics to clips. How do you do the same with imove 08 most important the slow motion feature?

    I'm currently using iMovie 08 and I would switch to iMovie 06 but when I try to install it but the message "Please install iLife ’08 before installing iMovie HD 6" pops up. My computer went through a hard drive crash recently and when they replaced it I thought they popped in iLife '08 (hence being stuck with iMovie 08) but i dunno... suggestions?

  • When I Press "IMPORT", The Footage Suddenly Looks Like Slow Motion !

    ... But it imports OK, when you watch the clip after import it is normal.
    This just started today.
    I use a AGDVX100B
    What could this be ?
    It looks like its skipping frames.

    This happens to us all. There's nothing wrong with the source or the software- as you say, it's fine once imported.
    I wouldn't worry about it
    PJ
    (P.s. It's definately not skipping frames as the exact same thing happens with FCE, and you'd definately know about it if frames were lost when using that program!)

  • My video keeps getting choppy (like slow motion)!!!!

    Hey all,
    Whenever I open a different application or try and text chat with another online buddy, the video chat on my side becomes very choppy, as if I am in slow motion. The person Im chatting with says that I later look blurry and pixelated. What should I do? Would downloading the 10.5.3 update fix my issues, or is it a RAM issue

    Add to Ryan's list
    Folding@home
    Lotus Notes
    Certain Tiger iChat Add-ons that have not been Updated such as iChatUSBCam and Chax
    Video Effects and Backdrops in Leopard/iChat 4
    Spirited Away although this shows up by changing your Buddy pic to the app in use as well.
    It is also worth looking at the Activity Monitor and seeing how much CPU apps and functions are using.
    Also have you set System Preferences > Quicktime > Streaming to 1.5Mbps ?
    Restart iChat if you have to change this.
    11:01 PM Tuesday; June 3, 2008

  • Why the tv show i dowload is played like slow motion

    I dowload three NBA game in the itune,but none of them are play normal.

    Hey Corey,
    I'd take a look at the following article, which shows how to download your previous purchases directly to your iPod touch (as long as it has been associated to your Apple ID):
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    http://support.apple.com/kb/ht2519
    Open the iTunes Store on your device.
    Make sure you are signed in with the same Apple ID you used for the original purchase.
    Tap More from the bottom navigation bar.
    Tap Purchased to go to your Purchased page.
    Tap TV Shows.
    Locate the TV show episode or series you would like to download.
    Once you've located the TV shows you are looking for, tap the download button.
    The TV show will begin downloading.
    Best,
    David

  • How to implement edit time help like Eclipse, IntelliJ in Swing

    Hi,
    I am developing an DataBase query tool. In my application, there is a area for writing SQL command like select etc. I want to show the names of tables or fields when the user write a select keyword or give a dot(.) after giving a table name like Ecilpse shows the field names of particular class when we give the class name.

    Hi,
    You would need to add keyListener to the text component into which you are entering the query and listen for a particular keystroke. In your case it would just be a space character.
    However I would you are going about this the wrong way. How do you plan to handle the fact that in a sql query the column names come first before the table names. I would suggest you have a wizard type gui where you first get the tables involves so you can fetch and display the column names.
    Hope this helps.
    cheers,
    vidyut
    http://www.bonanzasoft.com

  • I downloaded GarageBand like 6 hours ago and it's stuck on the installing phase...

    Please help!

    Try placing the iPod in ecovery mode and then restoring the iPod via iTunes.  For recovery mode see:
    iPhone and iPod touch: Unable to update or restore
    Next would beto wait for the battery to fully drain and the charge and try again.

  • Question on the engineering behind Swing

    I have been using the AWT for 5 years and love it, but I'd like to have Trees and Tables, etc.
    My question is this: Why do applets and applications that use Swing for their UI paint v-a-r-y slowly and sometimes don't work, or don't repaint when a menu is shown/removed. I have noticed this in many programs. I know that Swing is a "skin" painted onto the screen to represent UI components in a system-indpendent way, but still, why do slow? It's not my JVM and not my system. So the classes must be just too bulky for their own good. Is there are other Swing-like UI library? Theres AWT, Swing, and ???

    I'd be surprised to see Swing be faster than AWT.
    On Windows, Swing is pretty good, on other OSs, it ain't. Not the fault of the OS, but of Swing/JVM.
    I use Swing at the moment, but that's because AWT doesn't have enough features.
    I don't like the fact that Swing is non-native, and may consider SWT at some point (pending investigations into its licensing, how easy it is to deploy).
    The fact that Swing is non-native is far more important to me than its speed. If AWT were improved (feature-wise) to the same level as Swing, I'd be happy.

  • Why do I keep getting the rainbow spinning wheel in Garageband 11

    I have the latest MBP (see specs below) and I was recording today with Garageband like I always do.  I was using my MOTU 828 MK1 8 channle audio interface with the lates compatible Lion update from Sept 2011.  I have never had any problems untill last night.
    I was recording an acoustic project consiting of 4 raw 'real instrument' acoustic guitar tracks with no effects, which I had no problem recording each track by itself.  Next I recorded 1 raw 'real instrument' bass track with no effects then no problems. 
    I ran into the problem when I started adding the next 2 raw 'real instrument' vocal tracks and 1 click track.  So my project has a total of 8 tracks.
    When I was recording the vocals everything was going fine untli I tried to do another take and when I pressed the record button I got the rainbow spinning wheel. I let it spin for 2 mins and then went to Forc Quit and noticed GB had stopped responding.  So shut down my audio interface and re-started the MBP.  Once the MBP was up and running it could not find my MOTU audio interface or the built in audio device on the MBP.  So I shutdown the MBP for 30 seconds and turned it back on and my MOTU was recognized and I was able to select it in GB.  So I tried to record again with the same problems.  I went through this process for 3 times and the fourth time GB told my I had too many tracks.  So again I shut down my MOTU then shutdown the MBP then once MBP was up I opened GB, turned on my MOTU, selected it as the audio interface I wanted to use and then went to GB preferences and under the 'Advanced' tab I changed my audio resoultion from 'better' to 'good'. 
    Needless to say that did not work and I am not able to add anymore tracks to this song. 
    G
    I would appreciate any suggestions.
    Thank you,
    AJ

    Try throwing out all GB preferences, and maybe Caches as well. Then restart GB (preferences and caches will grow back) and see if that helps.

Maybe you are looking for