A powerful audio processing tool that allows you to create new audio from existing audio using granular synthesis techniques. This tool provides both a command-line interface and a graphical user interface for audio manipulation, beat detection, and sample cutting.
- Audio file loading from local storage or YouTube
- Beat detection using the madmom library
- Sample cutting and exporting
- AutoMixer for creating mixed samples
- Command-line interface with various commands
- Graphical user interface using PySide6
- YouTube audio downloading capability
- Docker support for easy setup and cross-platform compatibility
-
Clone the repository:
git clone https://github.com/yourusername/granular-sampler.git cd granular-sampler
-
Create and activate a Conda environment:
conda create -n grain python=3.9 conda activate grain
-
Install the required dependencies:
pip install -r requirements.txt
-
Install Docker on your system (https://docs.docker.com/get-docker/)
-
Clone the repository:
git clone https://github.com/yourusername/granular-sampler.git cd granular-sampler
-
Build and run the Docker container:
./run_granular_sampler.sh
To use the command-line tool, run the main.py
script with the following syntax:
python main.py <path_to_audio_file_or_youtube_url> <desired_output_path_directory> [automix_parameters]
python main.py "/path/to/your/audio.mp3" ~/output/directory/
python main.py "/path/to/your/audio.mp3" ~/output/directory/ amc s 0.8 l /2 ss 1.2
s
- Playback speed of the resulting trackss
- Playback speed of each samplel
- Length of each sample (use/
or*
to divide or multiply the default length)c
- Channel configuration (e.g.,c 0,200;200,400;400,600
)w
- Window divider (e.g.,w 3
)
p
- Play selected part of the trackb <ms>
- Set beginning of the samplel <ms>
- Set length of the samples <ms>
- Set step for forward and rewindf
/r
- Forward / Rewind (use multiple times for faster movement)plot
- Plot amplitude of the selected part of the trackinfo
- Print information about cutting the trackload <filepath>
- Change the track to cutcut
- Cut the trackcut -a
- Cut the track and adjust the cut positionam
- Automix the whole trackamc info
- Show automix configurationamc m <algorithm> s <playback_speed> l </ or *number>
- Set automix paramsset_wav_enabled
/set_wav_disabled
- Enable/disable WAV exportset_verbose_enabled
/set_verbose_disabled
- Enable/disable verbose modehelp
- Print help messageq
- Quit
To use the GUI version of the tool, run:
python main.py
Or if using Docker:
./run_granular_sampler.sh
The GUI allows you to:
- Load audio files from local storage or YouTube
- Detect beats in audio files
- Configure and run AutoMixer for granular synthesis
- Play original and processed audio
- Save processed audio
The Docker setup simplifies the installation process and ensures compatibility across different operating systems.
- Make sure you have Docker installed on your system.
- Run the provided shell script:
This script will build the Docker image and run the container with the appropriate settings for your operating system.
./run_granular_sampler.sh
Note: For Windows users, you may need to install an X server like VcXsrv to run GUI applications from Docker.
See the run_with_params.sh
file for examples of running the tool with different parameters.
Contributions are welcome! Please feel free to submit a Pull Request.