Convert MP3 audio files into sheet music using Python. This project analyzes MP3 files to detect musical notes and their durations, then generates a MusicXML file for viewing in music notation software.
Before you begin, ensure you have the following installed:
- Python: Download Python
- MuseScore: Download MuseScore
- FFmpeg: Install FFmpeg
Follow these steps to get your development environment set up:
- Clone the Repository
git clone https://github.com/yourusername/your-repo-name.git
- Navigate to the Project Directory
cd your-repo-name
- Install Dependencies
pip install numpy pydub scipy librosa music21
- Clone the Repository
git clone https://github.com/yourusername/your-repo-name.git
To convert your MP3 file to sheet music:
-
Prepare Your MP3 File Place your MP3 file in the project directory (e.g.,
HotCrossBuns.mp3
). -
Run the Audio Analysis Script
python NoteInterpretation.py This script will: - Convert the MP3 file to WAV format - Analyze the audio for onsets, tempo, and frequencies - Calculate note durations and interpret notes
-
Run the MusicXML File Creation Script
python NotesToSheetMusic.py This script will: - Convert the arrays into a sheet music - Will display the sheet music in MuseScore
To customize the code to read the proper files:
- MP3 File Name: Update the mp3_file variable in NoteInterpretation.py to match your MP3 file.
- MuseScore Path: Adjust the MuseScore path in CreateSheetMusic.py if MuseScore is installed in a different location.
This project will convert an MP4 file, eventually spotify songs, to TABS or sheet music.
Instructions on how to get this running on MacOS - Type all commands without the quotation marks enclosing them
- Go to https://github.com/KyleMatton26/MP4ToTABS
- Navigate in the terminal to where you want to save the repository using commands like "ls", "cd nameOfPlace", and "cd .."
- Type "git clone https://github.com/KyleMatton26/MP4ToTABS.git"
- Open VS Code and at the top click "File" -> "Open Folder...", then navigate to the "MP4ToTabs" folder that was cloned and click open
- Open the terminal in VS Code by going to the top of the screen and clicking "Terminal" then "New Terminal"
- Install HomeBrew by pasting "/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"" into the terminal and pressing "return" or "enter"
- Type "pip install " replacing the "" with a library, make sure to do that for all the libraries used
- Type "brew install " replacing the "" with things like "ffmpeg" UNSURE IF THIS WORKS, MIGHT NOT NEED HOMEBREW EVEN!!!!!!!
- Click run on the following files in order: "AudioProcessing.py", "NoteInterpretation.py", and then "NotesToSheetMusic.py"
- Follow these instructions to modify https://github.com/firstcontributions/first-contributions/blob/main/README.md
*** Don't think I actually needed HomeBrew since I don't believe any installs worked. However, it didn't work the first time and then I did run the "brew install ffmpeg" and it worked, so maybe something did install and change ***