A React-based frontend application for a voice assistant that allows users to record audio and receive audio responses from a backend API.
- Voice Recording: Click to start/stop recording audio using the device's microphone
- Audio Playback: Play back the response audio received from the backend
- Modern UI: Clean, responsive interface built with Tailwind CSS
- Real-time Feedback: Visual indicators for recording state
- Node.js (version 14 or higher)
- npm or yarn package manager
- A backend API running on
http://localhost:8000with the/api/process-audioendpoint
- Clone the repository:
git clone <repository-url>
cd simple-voice-assistant-ui- Install dependencies:
npm installIn the project directory, you can run:
Runs the app in development mode. Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits. You will also see any lint errors in the console.
Launches the test runner in interactive watch mode.
Builds the app for production to the build folder. It correctly bundles React in production mode and optimizes the build for the best performance.
Note: this is a one-way operation. Once you eject, you can't go back!
If you aren't satisfied with the build tool and configuration choices, you can eject at any time.
- Start the development server:
npm start-
Ensure your backend API is running on
http://localhost:8000 -
Open your browser and navigate to
http://localhost:3000 -
Click "Start Recording" to begin recording audio
-
Speak into your microphone
-
Click "Stop Recording" to send the audio to the backend
-
The response audio will automatically play back when received
The application expects a backend API with the following endpoint:
- POST
/api/process-audio- Accepts:
multipart/form-datawith anaudiofield containing the recorded audio blob - Returns: Audio file (MP3/WAV format) as the response body
- Content-Type:
audio/mpegoraudio/wav
- Accepts:
- React 19.0.0 - Frontend framework
- Tailwind CSS 4.0.6 - Utility-first CSS framework
- Web APIs - MediaRecorder API for audio recording
- Fetch API - For HTTP requests to the backend
src/
├── components/
│ └── VoiceAssistant.js # Main voice assistant component
├── App.js # Root component
├── App.css # App styles
├── index.js # Application entry point
└── index.css # Global styles
This application uses modern web APIs including:
- MediaRecorder API for audio recording
- Fetch API for HTTP requests
- Blob and URL APIs for audio handling
Supported browsers:
- Chrome 47+
- Firefox 25+
- Safari 14.1+
- Edge 79+
- The application uses React hooks (
useState,useRef) for state management - Audio is recorded as WAV format and sent to the backend
- The response audio is automatically played back using HTML5 audio controls
- Error handling is implemented for network requests and audio recording
-
Microphone Permission Denied
- Ensure your browser has permission to access the microphone
- Check browser settings and allow microphone access
-
Backend Connection Error
- Verify the backend API is running on
http://localhost:8000 - Check that the
/api/process-audioendpoint is available - Ensure CORS is properly configured on the backend
- Verify the backend API is running on
-
Audio Playback Issues
- Check that the backend returns valid audio data
- Verify the audio format is supported by your browser
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is private and proprietary.