Code Monkey home page Code Monkey logo

samplescanner's Introduction

SampleScanner

Build Status

SampleScanner Logo

SampleScanner is a command-line tool to turn MIDI instruments (usually hardware) into virtual (software) instruments automatically. It's similar to Redmatica's now-discontinued AutoSampler software (now part of Apple's MainStage), but open-source and cross-platform.

Features

  • Uses native system integration (via rtmidi and pyAudio) for compatibility with all audio and MIDI devices
  • Outputs to the open-source sfz 2.0 sample format, playable by Sforzando (and others)
  • Optional FLAC compression (on by default) to reduce sample set file size by up to 75%
  • Flexible configuration options and extensive command-line interface
  • Experimental looping algorithm to extend perpetual samples
  • Clipping detection at sample time
  • 100% Python to enable cross-platform compatibility
  • Has been known to work in Windows, Mac OS and Linux

Installation

Requires a working python (version 2.7), pip, and ffmpeg to be installed on the system.

git clone [email protected]:psobot/SampleScanner
cd SampleScanner
pip install -r requirements.txt

How to run

Run ./samplescanner -h for a full argument listing:

usage: samplescanner [-h] [--cc-before [CC_BEFORE [CC_BEFORE ...]]]
                     [--cc-after [CC_AFTER [CC_AFTER ...]]]
                     [--program-number PROGRAM_NUMBER] [--low-key LOW_KEY]
                     [--high-key HIGH_KEY]
                     [--velocity-levels VELOCITY_LEVELS [VELOCITY_LEVELS ...]]
                     [--key-skip KEY_RANGE] [--max-attempts MAX_ATTEMPTS]
                     [--limit LIMIT] [--has-portamento] [--sample-asc]
                     [--no-flac] [--no-delete] [--loop]
                     [--midi-port-name MIDI_PORT_NAME]
                     [--midi-port-index MIDI_PORT_INDEX]
                     [--midi-channel MIDI_CHANNEL]
                     [--audio-interface-name AUDIO_INTERFACE_NAME]
                     [--audio-interface-index AUDIO_INTERFACE_INDEX]
                     [--sample-rate SAMPLE_RATE] [--print-progress]
                     output_folder

create SFZ files from external audio devices

optional arguments:
  -h, --help            show this help message and exit

Sampling Options:
  --cc-before [CC_BEFORE [CC_BEFORE ...]]
                        Send MIDI CC before the program change. Put comma
                        between CC# and value. Example: --cc 0,127 "64,65"
  --cc-after [CC_AFTER [CC_AFTER ...]]
                        Send MIDI CC after the program change. Put comma
                        between CC# and value. Example: --cc 0,127 "64,65"
  --program-number PROGRAM_NUMBER
                        switch to a program number before recording
  --low-key LOW_KEY     key to start sampling from (key name, octave number)
  --high-key HIGH_KEY   key to stop sampling at (key name, octave number)
  --velocity-levels VELOCITY_LEVELS [VELOCITY_LEVELS ...]
                        velocity levels (in [1, 127]) to sample
  --key-skip KEY_RANGE  number of keys covered by one sample
  --max-attempts MAX_ATTEMPTS
                        maximum number of tries to resample a note
  --limit LIMIT         length in seconds of longest sample
  --has-portamento      play each note once before sampling to avoid
                        portamento sweeps between notes
  --sample-asc          sample notes from low to high (default false)

Output Options:
  output_folder         name of output folder
  --no-flac             don't compress output to flac samples
  --no-delete           leave temporary .aif files in place after flac
                        compression
  --loop                attempt to loop sounds (should only be used with
                        sounds with infinite sustain)

MIDI/Audio IO Options:
  --midi-port-name MIDI_PORT_NAME
                        name of MIDI device to use
  --midi-port-index MIDI_PORT_INDEX
                        index of MIDI device to use
  --midi-channel MIDI_CHANNEL
                        MIDI channel to send messages on
  --audio-interface-name AUDIO_INTERFACE_NAME
                        name of audio input device to use
  --audio-interface-index AUDIO_INTERFACE_INDEX
                        index of audio input device to use
  --sample-rate SAMPLE_RATE
                        sample rate to use. audio interface must support this
                        rate.

Misc Options:
  --print-progress      show text-based VU meters in terminal (default false,
                        can cause audio artifacts)

Contributors, Copyright and License

tl;dr: SampleScanner is © 2015-2018 Peter Sobot, and released under the MIT License. Many contributors have helped improve SampleScanner, including:

The MIT License

Copyright (c) 2015-2018 Peter Sobot https://petersobot.com [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

samplescanner's People

Contributors

nandoflorestan avatar psobot avatar sixohsix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

samplescanner's Issues

Lowest MIDI octave can't be sampled

Using a MIDI monitor I figured out that the lowest C SampleScanner can sample is Note Number 12, which means the lowest MIDI octave can't be sampled. Mainstage (Autosampler) on the other hand starts at the lowest C (Note Number 0) and my U-200 responds to it, which indicates that this is not a technical limitation, but one inside of SampleScanner.

File "./samplescanner", line 7,

Define-XL:samplescanner daslicht$ ./samplescanner -h
Traceback (most recent call last):
  File "./samplescanner", line 7, in <module>
    from lib.send_notes import sample_program, VELOCITIES, MAX_ATTEMPTS
  File "/Users/daslicht/DEV/Sound Projects/SampleScanner/lib/send_notes.py", line 3, in <module>
    from tqdm import tqdm
ImportError: No module named tqdm
Define-XL:samplescanner daslicht$ 

what could be wrong ?

Specifying --low-key with negative octave values doesn't work

samplescanner: error: argument --low-key: invalid note_number value: 'C-2'

My U-220 can receive C-1 as the lowest note, while Apple Mainstage seems to represent that as C-2. I suppose this is just a mapping difference between hardware, Mainstage and SampleScanner. An Option to adjust that would help, so that incoming note numbers are transposed accordingly.

Python 3

Let's move to Python 3.
I hope to publish a PR for that (I've got it running, but want to do more testing).

--program-number always sends on MIDI ch 1

The option '--program-number' doesn't regard the MIDI channel set with '--midi-channel'; it always sends on channel 1. The actual MIDI notes are sent on the correct channel, however.

Request: --program-number-base option

The option '--program-number' appears to be based 1; if e.g. PG 5 is sent, my Roland U-220 changes to PG 6 instead. This is dependent on the hardware device, but it would be nice to have a '--program-number-base [0|1]' option.

Got ZeroDivisionError with high sample path...

The file leveler.py sometimes has run into a ZeroDivisionError, printing out the line "Got ZeroDivisionError with high sample path"... But I don't know what this means exactly, so here are a couple of questions:

  • How does the leveler work?
  • Why is there a division by zero issue?
  • Is there any way we could recover from that error automatically?
  • If not, can we at least let the user know how to work around the error?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.