Shuriken Beat Slicer

Shuriken is an open source beat slicer which harnesses the power of aubio's onset detection algorithms and Rubber Band's time stretching capabilities.  A simple Qt interface makes it easy to slice up drum loops, assign individual drum hits to MIDI keys, and change the tempo of loops in real-time.  The JUCE library takes care of handling audio and MIDI behind the scenes.

For more info on aubio, Rubber Band, and JUCE please see:

http://aubio.org

http://www.breakfastquay.com/rubberband

https://www.juce.com


Contents


Importing Audio Files

To get started with Shuriken, first import an audio file.  Audio samples are loaded into RAM before editing so the original files always remain untouched.

Shuriken calls on the abilities of libsndfile when importing audio files.  For full details of supported file formats please see: http://www.mega-nerd.com/libsndfile/#Features

Shuriken also comes with sndlib statically built in.  sndlib can read the following file formats:

For more info on sndlib please see: https://ccrma.stanford.edu/software/snd/sndlib/


Slice 'n' Dice

Once an audio file has been imported, its waveform is displayed in the main window.  Selecting “Onsets” and clicking “Find” will place a slice point at the start of every drum hit or note.  Selecting “Beats” and clicking “Find” will insert a slice point at the beginning of every beat of the bar.

When searching for onsets or beats, you have the option to automatically adjust the position of each slice point by moving it to the closest, next, or previous zero-crossing.  These options can be selected from the “Zero-X” drop-down list.  The default setting is to ignore zero-crossings.

To add additional slice points, hover the mouse over the waveform and press the Insert key on the keyboard.  To delete a slice point, select it and press Delete.

Though aubio does a good job of detecting onsets, you'll still probably want to adjust the position of the slice points manually before clicking “Slice”.  Right-clicking on a slice point will reveal a context menu which allows you to move the slice point to the next or previous zero-crossing.  Clicking on the waveform between slice points will allow you to audition each section of audio before slicing.

Once the waveform has been sliced, each audio slice is automatically assigned to a separate MIDI key starting from middle C (C4) and ascending chromatically.  You can drag an audio slice left or right to assign it to a different key.  Slices can be reordered then joined together by toggling the “Slice” button.  To select multiple slices, click “Multi Select” on the toolbar then drag the mouse over the waveform.


Detection Options

“Detection Method”, “Window Size”, “Hop Size”, and “Threshold” affect the accuracy of aubio's onset and beat detection routines.  The default settings should give good results in many, though not all, situations.  Experimenting with the settings may produce better results in some instances.


Detection Method
Various scientific methods have been devised for detecting onsets.  For more info on each of these methods please see: http://aubio.org/doc/0.4.1/specdesc_8h.html#details and http://dev.aubio.org/wiki/Publications
Window Size
aubio works by analysing audio in chunks.  Here you can set how many samples should be processed at a time.
Hop Size
Each window of samples to be analysed can partly overlap the previously analysed window.  If, for example, “Window Size” is set to 1024 and “Hop Size” is set to 25%, then the next window of samples will be 256 samples along from the start of the previous window.  This overlap can help to produce better results.
Threshold
This determines the sensitivity of the detection routine.  Lowering the threshold will result in more detections, raising it will result in fewer.


Calculating BPM

The “Time Signature” and “Length” widgets allow you to specify the length of an audio loop in bars or beats.  Shuriken then does the appropriate maths to calculate the BPM once the “Calc” button is clicked.


Time Stretching

The Rubber Band library takes care of time stretching duties within Shuriken and provides two modes of operation: offline and real-time.  To switch between offline and real-time mode, open the options dialogue and click the appropriate radio button under the “Time Stretch” tab.

Hint: if you find that JACK's DSP load is too high when time stretching in real-time mode, try setting “Window Size” to “Short”.


Global Time Stretch

Global time stretching allows you to stretch/squeeze the entire audio loop.

In offline mode, first click the “Calc” button (or manually enter the current BPM in the “Original BPM” box) then enter the desired BPM in the “New BPM” box and click “Apply”.

In real-time mode, enter values into the “Original BPM” and “New BPM” boxes as before, but now the tempo of the audio can be changed on the fly.  Try clicking the up and down arrows on the “New BPM” box.


Selective Time Stretch

Selective time stretching allows you to stretch/squeeze individual audio slices.  You must be in real-time mode and the waveform must be sliced before the “Selective Time Stretch” button is enabled.  Toggling this button will display markers between each audio slice.  Simply drag a marker to stretch/squeeze the audio either side of it.  Markers can be snapped to beats or divisions of a beat by selecting the desired setting from the “Snap” combo box (BPM must be set first).  Toggle the “Selective Time Stretch” button again to leave this mode.

Note that un-slicing the waveform or switching to offline mode after working in selective time stretch mode causes any stretches to be rendered offline.


Stretch Options

Options to fine-tune Rubber Band's operation are available as follows (taken from the Rubber Band documentation):

Stretch Profile

Control the profile used for variable time stretching.  Rubber Band always adjusts the stretch profile to minimise stretching of busy broadband transient sounds, but the degree to which it does so is adjustable.
Elastic
The audio will be stretched at a variable rate, aimed at preserving the quality of transient sounds as much as possible.  The timings of low activity regions between transients may be less exact than when the “Precise” profile is set.
Precise
Although still using a variable stretch rate, the audio will be stretched so as to maintain as close as possible to a linear stretch ratio throughout.  Timing may be better than when using “Elastic”, at slight cost to the sound quality of transients.  This setting is always used when running in real-time mode.

Transients

Control the component frequency phase-reset mechanism that may be used at transient points to provide clarity and realism to percussion and other significant transient sounds.
Crisp
Reset component phases at the peak of each transient (the start of a significant note or percussive event).  This, the default setting, usually results in a clear-sounding output; but it is not always consistent, and may cause interruptions in stable sounds present at the same time as transient events.
Mixed
Reset component phases at the peak of each transient, outside a frequency range typical of musical fundamental frequencies.  The results may be more regular for mixed stable and percussive notes than “Crisp”, but with a phasier sound.  The balance may sound very good for certain types of music and fairly bad for others.
Smooth
Do not reset component phases at any point.  The results will be smoother and more regular but may be less clear than with either of the other transients options.

Phase

Control the adjustment of component frequency phases from one analysis window to the next during non-transient segments.
Laminar
Adjust phases when stretching in such a way as to try to retain the continuity of phase relationships between adjacent frequency bins whose phases are behaving in similar ways.  This, the default setting, should give good results in most situations.
Independent
Adjust the phase in each frequency bin independently from its neighbours.  This usually results in a slightly softer, phasier sound.

Window Size

Control the window size for FFT (Fast Fourier Transform) processing.  The window size actually used will depend on many factors, but it can be influenced.
Standard
Use the default window size. The actual size will vary depending on other parameters. This option is expected to produce better results than the other window options in most situations.
Short
Use a shorter window.  This may result in crisper sound for audio that depends strongly on its timing qualities.  Also has the effect of reducing JACK's DSP load when running in real-time mode.
Long
Use a longer window.  This is likely to result in a smoother sound at the expense of clarity and timing.

Formant

Control the handling of formant shape (spectral envelope) when pitch-shifting.  Only effective when pitch correction is turned off.
Shifted
Apply no special formant processing.  The spectral envelope will be pitch shifted as normal.
Preserved
Preserve the spectral envelope of the unshifted signal.  This permits shifting the note frequency without so substantially affecting the perceived pitch profile of the voice or instrument.

Pitch Shifting

Control the method used for pitch shifting (only effective when pitch correction is turned off).  These options may be changed at any time. They are only effective in real-time mode; in offline mode, the pitch-shift method is fixed.
High Speed
Use a method with a CPU cost that is relatively moderate and predictable.  This may sound less clear than “High Quality”, especially for large pitch shifts.
High Quality
Use the highest quality method for pitch shifting.  This method has a CPU cost approximately proportional to the required frequency shift.
High Consistency
Use the method that gives greatest consistency when used to create small variations in pitch around the 1.0-ratio level.  Unlike the previous two options, this avoids discontinuities when moving across the 1.0 pitch scale in real-time; it also consumes more CPU than the others in the case where the pitch scale is exactly 1.0.

JACK Sync

If “Audio Back-end” has been set to JACK (under the “Audio Setup” tab) then the “JACK Sync” option will also be made available.  Use this option to synchronise the BPM of the audio with tempo changes in a sequencer.  For this to work, you need to ensure that the sequencer is actually sending tempo change information via JACK (e.g. in Ardour 3 click the “external positional sync” button to change its text from “Internal” to “JACK”).  “Original BPM” has to be fairly accurate for this to work well, so you may need to adjust it manually.


JACK Outputs

The JACK Outputs dialogue becomes available when “JACK” is selected as the audio back-end.  The dialogue displays a grid which allows you to route any audio slice to any of Shuriken's outputs.  The number of outputs can be increased up to a maximum of 16 stereo outputs.


Export Options

Shuriken allows audio slices to be exported as individual audio files in WAV, AIFF, AU, FLAC or Ogg format, with options for encoding (e.g. 16-bit PCM) and sample rate.  There are also options for exporting a Hydrogen drumkit, SFZ, or Akai .pgm file.  A standard MIDI file may be exported either on its own or along with the audio files.  When exporting a MIDI file, you will be asked to confirm the BPM and time signature in case one or the other has not yet been set in the main window.  Note that MIDI files store tempo in terms of quarter notes rather than beats per minute, so a drum loop at 140 BPM where the beat is an eighth note would have a tempo of 70 quarter notes per minute.


Session Management

Shuriken has full support for Non Session Management.  It is possible to import an existing project into a NSM session as well as export a project from a session.

Shuriken also has support for LADISH L1 session management.  On receiving the SIGUSR1 Unix signal, Shuriken will save the current project.  On receiving the SIGTERM signal, Shuriken will ask the user if any unsaved changes should be saved, then exit cleanly.  Shuriken can deal with these signals being sent in quick succession and in any order; any save operation will complete before the application shuts down.

To allow LADISH to open a saved project, the file path of the project can be given as an argument when starting Shuriken from the command line, e.g.:

shuriken '/home/user/project.shuriken'

When using Shuriken in a LADISH session, make sure “Audio Back-end” is set to JACK in the Options dialogue otherwise Shuriken will terminate when you try to save the session!


Keyboard Shortcuts

Add slice point Insert
Delete slice point Delete
Move slice point to next zero-crossing N
Move slice point to previous zero-crossing   P
Slice waveform Return
Toggle monophonic mode M
Reverse audio R
Apply gain G
Apply gain ramp Shift + G
Delete audio slice Delete
Select next audio slice Z
Play selected audio slice A
Select previous audio slice Q
Play all audio slices in sequence Spacebar
Select/move 1
Multi select 2
Audition 3
Scroll waveform left Left cursor key
Scroll waveform right Right cursor key
Zoom in Ctrl + + (see note below for UK keyboard layouts)
Zoom out Ctrl + -
Zoom original Ctrl + 0

Note: on a UK keyboard you'll need to use the + key on the keypad if you want to avoid pressing Ctrl + Shift + +


Top