Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/r-koubou/midi-sampling
Simple hardware MIDI instrument automated sampling tool
https://github.com/r-koubou/midi-sampling
midi sampling
Last synced: about 1 month ago
JSON representation
Simple hardware MIDI instrument automated sampling tool
- Host: GitHub
- URL: https://github.com/r-koubou/midi-sampling
- Owner: r-koubou
- License: mit
- Created: 2024-08-12T08:03:30.000Z (6 months ago)
- Default Branch: develop
- Last Pushed: 2024-09-05T14:31:20.000Z (5 months ago)
- Last Synced: 2024-09-05T18:32:53.509Z (5 months ago)
- Topics: midi, sampling
- Language: Python
- Homepage:
- Size: 374 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
midi-sampling
================[日本語](README_ja.md)
## Overview
`midi-sampling` performs sampling from external MIDI sound sources. It allows you to specify arbitrary MIDI notes and velocities to control MIDI devices and carry out sampling.
Since it operates from a console, it is lightweight and can automate sampling processes.
## Requirements
- Windows OS with Python 3.12 or later
- It might also work on macOS, but this has not been verified.
- [pipenv](https://github.com/pypa/pipenv)
- [ffmpeg](https://www.ffmpeg.org/)## Setup
### Installing pipenv
https://github.com/pypa/pipenv?tab=readme-ov-file#installation
### Installing dependencies
Navigate to the project directory and run the following command:
```bash
pipenv install
```### Installing ffmpeg
https://www.ffmpeg.org/download.html
After installation, add the directory containing `ffmpeg.exe` to the environment variable `PATH`.
## How to Run
### Activating the pipenv environment
Navigate to the project directory and run the following command:
```bash
pipenv shell
```If the prompt on the left side appears as `(midi-sampling)`, you are inside the pipenv environment.
```bash
(midi-sampling) C:\Path\To\Project\midi-sampling>
~~~~~~~~~~~~~~~
```### Executing the Sampling
Run the following command:
```bash
python -m midisampling
```### Listing Devices
Run the following command:
```bash
python -m midisampling.device
```#### Output example
```
+------------------------------------------------------+
| Audio Devices |
+--------------------------------+---------------------+
| Name | Platform |
+--------------------------------+---------------------+
| Line(Steinberg UR28M) | Windows WDM-KS |
| Microsoft Sound Mapper - Input | MME |
| Primary Sound Capture Driver | Windows DirectSound |
| UR28M In (Steinberg UR28M) | MME |
| UR28M In (Steinberg UR28M) | Windows DirectSound |
| UR28M In (Steinberg UR28M) | Windows WASAPI |
| Yamaha Steinberg USB ASIO | ASIO |
+--------------------------------+---------------------+
+------------------------------+
| MIDI Devices |
+------------------------------+
| Name |
+------------------------------+
| Impact GX Mini |
| Microsoft GS Wavetable Synth |
| MIDIOUT2 (Impact GX Mini) |
| Roland SC-8850 MIDI OUT 1 |
| Roland SC-8850 MIDI OUT 2 |
| Roland SC-8850 PART A |
| Roland SC-8850 PART B |
| Roland SC-8850 PART C |
| Roland SC-8850 PART D |
+------------------------------+
```## Configuration Files
Sample files, `sampling-config.json` and `midi-config.example.json`, are included. Please adjust the settings according to your environment.
### Sampling Configuration
*Configuration for device, sampling.*
#### Properties
- **`audio_channels`** *(integer, required)*: Number of channels in the sampled audio file.
- **`audio_sample_rate`** *(integer, required)*: Sampling rate of the audio file.
- **`audio_sample_bits`** *(integer, required)*: Bit depth of the sampled audio file. Must be one of: `[16, 24, 32]`.
- **`audio_sample_bits_format`** *(string, required)*: Format of the bit depth of the sampled audio file. Must be one of: `["int", "float"]`.
- **`audio_in_device`** *(object, required)*
- **`name`** *(string, required)*: Name of the input device for the sampled audio file.
- **`platform`** *(string, required)*: Platform of the input device for the sampled audio file (e.g., `ASIO`, `MME`, `Windows DirectSound`, `Windows WASAPI`, `Core Audio` etc.).
- **`asio_audio_ins`** *(array)*: Default: `[]`.
- **Items** *(integer)*: List of ASIO input channel numbers. Specify the input channel numbers of your device. The format starts from 0 (e.g., to use inputs 1 and 2, specify `[0, 1]`).
- **`midi_out_device`** *(string, required)*: Name of the MIDI device used for sampling.
#### Examples```json
{
"audio_channels": 2,
"audio_sample_rate": 48000,
"audio_sample_bits": 32,
"audio_sample_bits_format": "int",
"audio_in_device": {
"name": "Yamaha Steinberg USB ASIO",
"platform": "ASIO"
},
"asio_audio_ins": [
2,
3
],
"midi_out_device": "Roland SC-8850 PART A"
}
```### MIDI Sampling Configuration
*Structure of the MIDI sampling configuration.*
See also `midi-config.example.json` and [schema files](midisampling/appconfig/json.schema.files/midi)
> TODO: Document JSON Schema
### Audio process Configuration
*Structure of the audio process configuration.*
#### Definitions
- **`def_audioprocess_config`** *(object)*: Cannot contain additional properties.
- **`format`**: Refer to *[#/definitions/def_format](#definitions/def_format)*.
- **`keep_wav_chunks`** *(array)*: A list of wave chunk names to keep via the audio process. if not specified, all chunks will be kept. Default: `[]`.
- **Items** *(string)*Examples:
```json
[
"smpl"
]
``````json
[
"smpl",
"cue"
]
```- **`effects`** *(array)*: A list of audio process configurations.
- **Items**: Refer to *[#/definitions/def_effect](#definitions/def_effect)*.
- **`def_format`** *(object)*: Format configuration Specifying it explicitly in dependent libraries prevents auto-detection and false conversions within. However, this is not guaranteed as it depends on the library. Cannot contain additional properties.
- **`bit_depth`** *(string)*: The bit depth of the audio file. If not specified, the bit depth of the input file will be auto detected by dependency library. Must be one of: `["int16", "int24", "int32", "float32"]`.
- **`sample_rate`** *(integer)*: The sample rate of the audio file. If not specified, the sample rate of the input file will be auto detected by dependency library.
- **`channels`** *(integer)*: The number of channels of the audio file. If not specified, the number of channels of the input file will be auto detected by dependency library.
- **`def_effect`** *(object)*: Effect configuration. Cannot contain additional properties.
- **`index`** *(integer, required)*: The index of the effect in the chain.
- **`name`** *(string, required)*: A effect name.
- **`params`** *(object, required)*: A dictionary of parameters for the effect. Can contain additional properties.
#### Examples```json
[
{
"keep_wav_chunks": [
"smpl"
],
"format": {
"bit_depth": "int32",
"sample_rate": 48000,
"channels": 2
},
"effects": [
{
"index": 0,
"name": "normalize",
"params": {
"target_db": -10.0
}
},
{
"index": 1,
"name": "trim",
"params": {
"threshold_db": -65.0,
"min_silence_duration": 250
}
}
]
}
]
```### Audio Process Parameters
For individual settings, please refer to the following:
- [Audio Process Parameters](midisampling/waveprocess/Parameters.md)