A Pytorch FM Synthesizer for audio deep learning.
Synthesized datasets are usually very large and of limited versatility; dx7pytorch addresses this problem by bundling an FM Synthesizer core into a Pytorch dataset wrapper.
The synthesizer core is a C++ emulator of the famous Yamaha DX7, a programmable digital instrument for which rich and varied timbres can be created by manipulating its internal parameters. Each combination of parameters is called patch and describes a particular timbre.
The timbres described by the patches can be synthesized into sound samples at selected note or velocity, and with different content, including single notes, chords and arpeggios. Hence, the dataset only requires to store patch information, occupying only a couple of Megabytes.
There exist thousands of patches for this instrument. This repo includes a collection of 29830 unique patches extracted from a public source and filtered by a CRC32 hash filter.
See next sections to know how to replicate the filtering process and compile your own DX7 patch dataset.
Also check tests/audition.ipynb for a quick overview on how this works.
- On-the-fly audio synthesis with full MIDI note and velocity support.
- Selectable sampling frequency.
- Arbitrary instance length.
- Single note, chord and arpeggio synthesis.
- Annotations are automatically generated (fundamental frequency, velocity, patch vector, selected chord or arpeggio).
- Install this Python package:
pip install git+https://github.com/fcaspe/dx7pytorch
- Or manually install and test it
git clone https://github.com/fcaspe/dx7pytorch cd dx7pytorch python setup.py install cd tests python test_pytorch.py
dx7pytorch in 4 simple steps!
- In your Pytorch script, create an instance of the dx7pytorch dataset class, specifying:
- Path to the patch collection.
- MIDI note and velocity range to synthesize.
- Sampling frequency and Instance length.
- The use of a patch filter if desired.
- Use the dataset interface or a Pytorch dataloader to request audio instances.
- A specific MIDI note and velocity within the specified range is sent to the synthesizer.
- The audio samples are generated on-the-fly, every time a request is received.
- The Pytorch wrapper can additionally deliver MIDI annotation or patch information.
This dataset contains a subset of unique patches extracted from Bobby Blues webpage.
-
You can regenerate the included dataset by entering to the dataset directory and trying:
source generate_dataset.shThe script will download the original patch collection, move all files to a single directory and run the patch_packer.py script which will scan for uniqueness and compile the filtered patches onto a collection.bin file which can be used by dx7pytorch. From the 140192 patches downloaded, only 29830 are unique.
Note: Processing all patches takes a while; 1h 30min on my computer.
-
To compile your own patch collection, extracted from Yamaha DX7 sysex files, put all your patch files into an empty directory, and run:
python3 patch_packer.sh /path/to/patch/dir/The packer will scan for uniqueness and generate a collection.bin file.
- The synthesizer core of dx7pytorch is based on the Hexter DX7 emulator. Licensed under GPL-2.0
- DX7 Patch collection extracted from Bobby Blues webpage. Released under public domain.
- Big thanks to
cucuwritescodefor adding chord and arpeggio synthesis support.
