Overview
Version 2.x.x of React Voice Visualizer introduces significant improvements to the library’s API design and extends functionality with new features. This guide will help you smoothly transition your existing code from v1.x to the latest version. The current stable version is 2.0.8.Breaking Changes
Internal Audio Ref Management
The most significant breaking change in v2.x.x is how audio references are handled. This change provides a more seamless and intuitive developer experience by removing the need for manual ref management.Before (v1.x)
After (v2.x)
New Features
Preloaded Audio Blob Support
Version 2.x.x introduces the ability to set preloaded audio blobs, expanding the library’s versatility in different scenarios.
setPreloadedAudioBlob() function allows you to load audio from various sources:
- User file inputs
- External URLs
- Local file system
- Generated audio data
Example Usage
Migration Steps
Follow these steps to migrate your application to v2.x.x:Remove Manual Ref Assignments
Search your codebase for any instances where you’re manually passing
ref={audioRef} to audio elements or components. Remove these manual ref assignments as the library now handles this internally.Search for patterns like:<audio ref={audioRef}>ref={audioRef}- Any destructuring of
audioReffromrecorderControls
Update Audio Loading Logic (if applicable)
If you’re loading external audio files, update your code to use the new
setPreloadedAudioBlob() function:Troubleshooting
Common Issues
Audio not playing after migration
Audio not playing after migration
Solution: Ensure you’ve removed all manual
ref={audioRef} assignments. The library now manages audio references internally, and manual ref assignments may cause conflicts.TypeScript errors about audioRef
TypeScript errors about audioRef
Solution: Remove
audioRef from your destructuring assignments. This property may still exist for backward compatibility but should not be used directly.Preloaded audio not loading
Preloaded audio not loading
Solution: Ensure you’re calling If loading from a URL, fetch the blob first:
setPreloadedAudioBlob() with a valid Blob or File object:Build errors after upgrading
Build errors after upgrading
Solution: Clear your node_modules and lock file, then reinstall:or for Yarn:
Migration Checklist
Use this checklist to ensure you’ve completed all migration steps:- Updated package to v2.x.x
- Removed all manual
ref={audioRef}assignments - Removed unused
audioRefdestructuring from code - Updated audio loading logic to use
setPreloadedAudioBlob()(if applicable) - Tested recording functionality
- Tested playback functionality
- Tested visualization rendering
- Verified all custom audio loading works correctly
- Cleared build cache and rebuilt application
- Tested in all target environments
Need Help?
If you encounter issues during migration that aren’t covered in this guide:- Check the API Reference for detailed information
- Review the Quickstart Guide for basic usage examples
- Visit the GitHub Issues page
- Try the Demo App to see v2.x.x in action
What’s Next?
After successfully migrating to v2.x.x, explore the new features:- Learn more about Preloaded Audio Support
- Check out advanced Customization Options
- Review all available Controls and Methods

