This project consists of a React Native frontend app and a FastAPI backend server for audio fingerprinting and music discovery.
boltCreation/
├── app/ # React Native frontend
│ ├── (tabs)/
│ │ ├── index.tsx # Main listening screen with "Recent Discoveries"
│ │ ├── discover.tsx # Discovery/search screen
│ │ ├── favorites.tsx # Favorites screen
│ │ └── profile.tsx # User profile screen
│ └── _layout.tsx
├── tones/ # Backend server
│ ├── tones/
│ │ └── src/
│ │ ├── server.py # FastAPI server with endpoints
│ │ ├── search_load.py # Audio fingerprinting logic
│ │ ├── db_utils.py # Database utilities
│ │ └── main.py # CLI interface
│ └── tones_cpp/ # C++ audio processing
└── test_server.py # Server testing script
The tones server provides audio fingerprinting capabilities with the following key endpoints:
GET /health- Health check endpointGET /recent-discoveries- Get recent music discoveriesPOST /search- Search for music by uploading audio filePOST /upload- Add new music to the database
The /recent-discoveries endpoint returns data in this format:
{
"data": [
{
"id": "1",
"title": "Midnight City",
"artist": "M83",
"album": "Hurry Up, We're Dreaming",
"confidence": 94.7,
"timestamp": "2024-01-15T10:30:00Z",
"mood": "Atmospheric",
"genre": "Electronic",
"energy": 85,
"duration": "4:03",
"bpm": 104,
"key": "E major"
}
]
}cd tones/tones/src
python server.pyThe server will start on http://localhost:8000 by default.
Run the test script to verify all endpoints are working:
python test_server.pyThe React Native app displays recent music discoveries fetched from the tones server.
- Recent Discoveries: Shows recently identified music from the tones server
- Audio Listening: Interface for recording and identifying music
- Music Discovery: Browse and search for music
- Favorites: Save favorite discoveries
The main screen (app/(tabs)/index.tsx) fetches recent discoveries from the tones server:
const fetchRecentDiscoveries = async (): Promise<MusicMatch[]> => {
const response = await fetch('http://localhost:8000/recent-discoveries');
const data = await response.json();
return data.data; // Transform to UI format
};- Audio Processing: User records audio → Tones server processes → Stores in database
- Recent Discoveries: Frontend fetches recent discoveries from
/recent-discoveriesendpoint - Display: Recent discoveries are displayed in the main screen with confidence scores
# Install Python dependencies
cd tones/tones
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your database configuration
# Start the server
cd src
python server.py# Install Node.js dependencies
npm install
# Start the development server
npx expo start- Make sure the tones server is running on
http://localhost:8000 - Update the
TONES_SERVER_URLinapp/(tabs)/index.tsxif needed - Test the connection using the test script:
python test_server.py
The current schema is minimal but functional:
CREATE TABLE tone (
toneId bigint PRIMARY KEY,
name character varying
);
CREATE TABLE address_couple (
address numeric(64,0),
couple bigint
);To improve the recent discoveries feature, consider adding:
- Timestamp column to the
tonetable for proper ordering - Metadata table for storing additional song information (genre, mood, etc.)
- User association for personalized discoveries
The frontend is designed to work with the tones server but includes fallback mock data for development. The integration handles:
- Error handling: Falls back to mock data if server is unavailable
- Data transformation: Converts server response to UI format
- Timestamp formatting: Displays human-readable timestamps
- Loading states: Shows loading indicators during API calls
- The frontend currently uses mock data as fallback when the server is unavailable
- The server returns mock data for recent discoveries (update with real database queries)
- Both frontend and backend are configured for local development
- The audio fingerprinting system is ready for integration with the UI
- Database Integration: Implement real database queries in the server
- Authentication: Add user authentication and personalized discoveries
- Real-time Updates: Add WebSocket support for live discovery updates
- Audio Recording: Integrate audio recording functionality in the frontend
- Metadata Enhancement: Add more rich metadata for discovered music