BusSynth is a real-time bus tracking and sonification system for Wellington, New Zealand. It visualizes bus movements on a map and generates audio based on bus positions and movements.
- Real-time tracking of Wellington buses (ferries and trains show up sometimes also? idk man)
- Interactive map visualization
- Audio synthesis based on bus positions and movements
- Display of bus stops
- Plays an angry blast of noise when a bus is delayed based on the stop location and length of delay
- Python 3.7+
- Required Python packages:
- asyncio
- websockets
- http.server
- requests
- matplotlib
- pyo (for audio synthesis)
- Clone this repository:
git clone https://github.com/krieg-geist/bus-synth.git
cd bus-synth - Install the required packages:
pip install -r requirements.txt
- Obtain an API key from Metlink Open Data API and create a file
.env
in the main directory with the lineMETLINK_API_KEY=YOUR_API_KEY
Run the main script:
python3 bus_synth.py
This will start the following:
- A WebSocket server on port 8765 for real-time bus updates
- An HTTP server on port 8000 serving the visualization webpage
Open a web browser and navigate to http://localhost:8000
to view the bus map.
BusSynth
: Main class orchestrating the entire systemBus
: Represents individual buses with their propertiesOscillatorManager
: Manages audio synthesis (implemented in a separate file)
- Data Fetching: Retrieves real-time bus and stop data from Metlink API
- WebSocket Server: Broadcasts bus updates to the web client
- HTTP Server: Serves the web page for visualization
- Audio Synthesis: Generates sound based on bus movements (via
OscillatorManager
)
- Make it actually sound good
Trigger audio events when busses reach stop- Trigger audio events based on route progress
Smooth audio transitions
Contributions are welcome! Please feel free to submit a Pull Request.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software with specific restrictions, provided that the user intends to use the Software explicitly FOR the purposes of evil or advancing evil, including but not limited to:
Genocide, Wanton Destruction, Fraud, Nuclear/Biological/Chemical Terrorism, Harassment, Prejudice, Slavery, Disfigurement, Brainwashing, Ponzi Schemes and/or the Destruction of Earth itself,
with this, including without limitation the rights to copy, modify, merge, publish, distribute, sublicense, sell and/or run copies Software or any executable binaries built from the source code.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, THAT WILL ASSUREDLY HAPPEN BECAUSE THE SOFTWARE IS MEANT TO BE USED EXPLICITLY FOR EVIL, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE