A project by NeuroTech UCSB to classify music genres from EEG brain signals recorded with OpenBCI hardware.
This project explores whether EEG signals recorded while a subject listens to music can be used to decode and classify the genre being heard. Data is collected using an OpenBCI headset and processed through a pipeline of loading, filtering, and (eventually) classification.
MusicGenreEEG/
├── data_loader.py # Load and parse OpenBCI CSV recordings
├── preprocessing.py # EEG signal filtering and preprocessing
└── data/ # Place your OpenBCI .csv recordings here (gitignored)
Install dependencies:
pip install numpy pandas scipyfrom data_loader import load_openbci, pick_file
filepath = pick_file() # Opens a file dialog to select your OpenBCI CSV
data = load_openbci(filepath)
print(data["eeg"].shape) # (n_samples, n_channels)
print(data["sample_rate"]) # e.g. 250 Hz
print(data["channel_names"]) # EXG channel labelsOr run directly:
python data_loader.pypython preprocessing.pyThis loads an OpenBCI recording via file dialog and prints basic stats on the raw EEG signal. Filtering (bandpass, notch) will be applied in this stage.
Recordings should be in OpenBCI CSV format (.csv or .txt) as exported by the OpenBCI GUI. The loader expects:
- Header lines prefixed with
%(automatically skipped) - A
Sample Rateline in the header comments - Columns named with
EXGfor EEG channels - A
Timestampcolumn
Place data files in a data/ folder at the root of the repo (this folder is gitignored to keep raw data out of version control).
- OpenBCI data loader
- Preprocessing pipeline scaffold
- Bandpass and notch filtering
- Feature extraction (PSD, band power)
- Genre labeling and dataset construction
- ML classification model
- Evaluation and results
This is a NeuroTech UCSB project. Feel free to open issues or PRs.