Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎵 Background Tracks v0.7 — Ambient Sound Mixer

🔍 Overview

Background Tracks is a customizable ambient sound mixer built with Python and Tkinter. It lets you mix and loop natural soundscapes — rain, birds, stream, campfire, beach, night — with per-track volume sliders and a dark-mode UI with image previews.

Perfect for focus, relaxation, or sleep.

📦 Windows release: Download the prebuilt app


Background Tracks UI

✨ Features

  • 🎚 Mix up to 6 ambient categories simultaneously
  • 🎵 Loop any MP3 track from each category
  • 🖼 Dark mode UI with high-resolution image previews
  • 🔊 Per-track volume control
  • ▶️ Individual play / stop buttons for each sound
  • Stop All button to silence everything in one click
  • 📂 Auto-discovers all .mp3 files in Sounds/<category>/
  • 💾 Packaged into a single .exe for easy use on Windows
  • NEW: Configurable folders via CLI (--sounds-dir, --images-dir)
  • NEW: Master volume flag (--master-volume)
  • NEW: Window-close cleanup wired up properly (no orphaned audio threads)

📁 Folder Structure

Nature-sounds/
├── Main.py
├── requirements.txt
├── Sounds/
│   ├── 01_bird/      *.mp3
│   ├── 02_beach/     *.mp3
│   ├── 03_night/     *.mp3
│   ├── 04_rain/      *.mp3
│   ├── 05_stream/    *.mp3
│   └── 06_campfire/  *.mp3
└── Images/
    ├── birds.jpg
    ├── beach.jpg
    ├── night.jpg
    ├── rain.jpg
    ├── stream.jpg
    └── campfire.jpg

The category folders use the prefix 01_, 02_, … to keep them in display order.


🛠 Built With

  • Python 3.10+
  • pygame — audio playback
  • Pillow (PIL) — image handling
  • Tkinter — GUI

🧰 Requirements

pip install -r requirements.txt

⚙️ How to Run

Default:

python Main.py

Custom directories and master volume:

python Main.py --sounds-dir Sounds --images-dir Images --master-volume 0.6

🛠️ Command-Line Options

Flag Default Description
--sounds-dir Sounds Folder containing per-category MP3 subfolders
--images-dir Images Folder containing per-category preview images
--master-volume 0.5 Initial volume for every track (0.0 – 1.0)

🎮 Controls

Action How
Pick a track Use the dropdown in each category card
Play Click ▶ Play Track
Stop Click ⏹ Stop Track
Adjust volume Drag the Volume slider
Silence everything Click ⏹ Stop All at the bottom
Quit Close the window — audio cleans up automatically

🧰 Build a Windows .exe (optional)

pip install pyinstaller
pyinstaller --noconfirm --windowed --add-data "Sounds;Sounds" --add-data "Images;Images" Main.py

The bundled app appears in dist/Main/.


🛑 Troubleshooting

Issue Fix
No sounds available in a category Drop one or more .mp3 files into Sounds/<category>/
Image previews missing Confirm Images/<name>.jpg exists for each category — file names must match the IMAGE_MAP dictionary
Crackling / stutter Lower the master volume or close other audio apps
App won't close cleanly The WM_DELETE_WINDOW protocol now stops audio and quits pygame on close

📄 License

This project is licensed under the MIT License. You are free to use, modify, and distribute this software provided that attribution is given to CS42.org as the original source.

About

Background Tracks: a customizable ambient sound mixer built with Python and Tkinter. Mix and loop rain, birds, stream, campfire, and more for focus, relaxation, or sleep. Windows .exe in Releases.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages