Interactive Python sorting algorithm visualizer with real-time bar animations and 8-bit sound feedback. Supports multiple algorithms, adjustable speed and array size, and displays comparisons, swaps, and execution time using a Tkinter GUI. Features ๐ Real-time sorting visualization ๐ Optional 8-bit sound feedback โก Adjustable sorting speed ๐ Adjustable array size ๐ Shuffle array instantly ๐ Live statistics: Comparisons Swaps Execution time ๐จ Modern Tkinter GUI ๐ Automatic sound fallback if audio library is unavailable ๐ง Algorithms Included
The visualizer currently supports:
Bubble Sort Selection Sort Insertion Sort Merge Sort Quick Sort Heap Sort Comb Sort
Each algorithm runs step-by-step so the visualization can animate each comparison and swap.
๐ Sound System
The application includes a custom SoundEngine that generates tones based on the values being compared.
Each comparison produces a short tone. Tone pitch changes depending on the element values. When sorting finishes, a short ascending melody plays.
If the simpleaudio library is installed, real audio will be played. Otherwise, the program falls back to the system Tkinter bell sound.
๐ฆ Installation
- Clone the repository git clone https://github.com/yourusername/sorting-visualizer-sound.git cd sorting-visualizer-sound
- Install optional dependency for sound pip install simpleaudio
- Run the program python sorting_visualizer.py ๐ฎ How to Use Choose a sorting algorithm from the dropdown menu. Adjust the array size and sorting speed. Click Shuffle to generate a random array. Click Sort to start the visualization. Enable or disable 8-bit sound using the toggle.
Watch the bars move and listen to the sorting process in real time.
๐ Built With Python Tkinter โ GUI framework simpleaudio โ sound playback threading & queues โ asynchronous sound handling ๐ Educational Purpose
This project helps students and developers:
Understand how sorting algorithms operate internally Compare different algorithms visually Experience algorithm behavior through visual + audio feedback ๐ Possible Future Improvements More algorithms (Shell Sort, Radix Sort) Pause / step mode Dark/light themes Algorithm complexity display Export visualization as GIF or video
โญ If you find this project useful, consider starring the repository!