Skip to content

Conversation

Aditya30ag
Copy link
Contributor

Overview

This PR resolves issue #375 by significantly improving the waveform visualization in the worklet-recorder application to match standard audio software displays.

Key Improvements

🎨 Enhanced Visual Representation

  • Amplitude Multiplier: Added 5.0x multiplier for more dramatic and visible vertical movement
  • Professional Styling: Material Design blue (#2196F3) with 2px line width
  • Better Canvas Sizing: Proper fallback dimensions (800x400) with minimum size constraints

🔧 Technical Enhancements

  • Y-axis Clamping: Prevents drawing outside canvas bounds
  • Smooth Scrolling: Improved background maintenance during scrolling
  • Grid Line Rendering: Better visual reference with proper spacing
  • Continuous Waveform: Smooth line continuation during scrolling transitions

📊 Audio Software Comparison

The improved waveform now displays more like standard audio software by:

  • Showing more dramatic amplitude changes for better audio level feedback
  • Using appropriate colors and line weights for professional appearance
  • Maintaining visual continuity during real-time playback
  • Providing clearer visual feedback for audio signal levels

Testing

  • ✅ Tested with various audio inputs and levels
  • ✅ Verified proper canvas sizing on different screen dimensions
  • ✅ Confirmed smooth scrolling behavior without visual artifacts
  • ✅ Validated amplitude representation accuracy

Screenshots

The waveform now provides much better visual feedback with enhanced amplitude representation and professional styling that matches industry-standard audio software.

Closes #375

…alization

- Enhanced canvas sizing with proper fallback dimensions
- Added amplitude multiplier for more dramatic vertical movement
- Improved waveform line styling with Material Design blue color
- Enhanced scrolling behavior with proper background maintenance
- Added better grid line rendering for improved visual reference
- Implemented smooth waveform line continuation during scrolling
- Fixed Y-axis clamping to prevent drawing outside canvas bounds

The waveform now displays more like standard audio software with
better amplitude representation and smoother visual continuity.
@Aditya30ag
Copy link
Contributor Author

Screenshot 2025-07-03 223210

@Aditya30ag
Copy link
Contributor Author

@mjwilson-google
hello we have talked about it issue . I have successfully made a changes please check it once

@Aditya30ag
Copy link
Contributor Author

@mkruisselbrink @zachleat please can you review this pr

@mjwilson-google mjwilson-google self-requested a review July 15, 2025 16:12
@mjwilson-google
Copy link
Collaborator

Thank you for your work, and sorry about the delay in looking at this. I think we might want to do something different than averaging the amplitude. I will perform a detailed review and give feedback when I have some more time.

@mjwilson-google mjwilson-google self-assigned this Jul 15, 2025
@Aditya30ag
Copy link
Contributor Author

@mjwilson-google
Thank you for your message! No worries at all about the delay—I appreciate you taking the time to review it. I'm happy to revisit the approach and look forward to your detailed feedback whenever you have a chance. Let me know if there's anything you'd like me to prepare or clarify in the meantime.

@Aditya30ag
Copy link
Contributor Author

@mjwilson-google
We had spoken earlier regarding GSoC, and I truly appreciated your insights. I wanted to ask if there might be any internship opportunities that you are aware of or could recommend. If so, I’d be grateful if you could let me know.

@mjwilson-google
Copy link
Collaborator

Thanks again for your work on this, and your patience waiting for the review.

internship opportunities

This GitHub repository is for working on Web Audio sample code. You can email me directly for this sort of question.

Copy link
Collaborator

@mjwilson-google mjwilson-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your work on this, it looks like a definite improvement.

The key change I would like to see is to make this a more traditional waveform display, similar to the first example here: https://manual.audacityteam.org/man/audacity_waveform.html

I think this can be done by changing how the lines are drawn, please see code comments.

The current version, both before and after the current form of this PR, shows the average value instead. Averaging isn't a common way to display audio waveforms.

// Clamp to canvas bounds to prevent drawing outside
const clampedY = Math.max(0, Math.min(this.height_, currentY));

// Draw the waveform line
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we should draw vertical lines that represent the lowest and highest points the waveform reached in the time range represented by the data array.

We can calculate the minimum and maximum values, then scale them by the height of the waveform display.

Then we can stroke one vertical line at the current X position, between these maximum and minimum values.

Comment on lines 38 to 39
if (this.canvas_.width < 400) this.canvas_.width = 800;
if (this.canvas_.height < 200) this.canvas_.height = 400;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these minimum dimensions necessary? Could this cause layout issues for smaller containers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image what about this

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this waveform display looks more like what I would expect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok i had commited the changes
please review it

@Aditya30ag
Copy link
Contributor Author

@mjwilson-google
Hello, is it ready to be merged?

@hoch
Copy link
Member

hoch commented Sep 8, 2025

@Aditya30ag @mjwilson-google is currently out of office. Thanks for your contribution and patience!

@Aditya30ag
Copy link
Contributor Author

Hello @hoch,
I would like to connect with you i am writing a mail to you please have a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve waveform display for /audio-worklet/migration/worklet-recorder
3 participants