Manual: Samples

From OpenMPT Wiki
Jump to: navigation, search
Sample Tab

On the sample tab, you find all the tools needed to load, edit and create new samples. Samples, besides synthesizer plugins, are the key sound source in OpenMPT. Depending on the module format used, they are directly used without further modifications (MOD and S3M format) or are references by instruments, where they can be passed through a variety of envelopes and other effects (all other formats).

A number of sample properties can be controlled on this tab, such as default volume and panning, loop and sustain points as well as auto vibrato. All options are explained in detail here.

Toolbar[edit]

File Toolbar[edit]

Sample File Toolbar.png

  • New Sample: Creates a new sample. In instrument mode, you are asked if the new sample should be assigned with a new instrument. Shift-clicking this button or choosing the dropdown menu duplicates the current sample.
  • Load Sample: Loads one or more sample in one of the following formats. To enforce a sample to be loaded as a RAW, sample, choose “Import Raw Sample” from the dropdown menu.
    • WAV: Uncompressed PCM (up to 32 bits), floating-point (up to 64 bits), IMA ADPCM, µ-Law and A-Law.
    • FLAC, OggFlac (FLAC in Ogg Container)
    • Impulse Tracker samples (ITS)
    • Scream Tracker 3 samples (S3I)
    • Fasttracker 2 instruments (XI)
    • Gravis UltraSound patches (PAT)
    • AIFF / AIFF-C with uncompressed PCM, floating-point, µ-Law and A-Law
    • Sun Audio with uncompressed PCM, floating-point, µ-Law and A-Law (AU / SND)
    • Amiga IFF (8SVX / 16SVX)
    • Headerless PCM data (RAW, PCM)
    • Opus
    • Ogg Vorbis
    • MPEG-1 Audio (MP1 / MP2 / MP3) through mpg123 (shipped with OpenMPT).
    • Media Foundation: On Windows 7 and newer, OpenMPT makes use of the Media Foundation framework and can load any sample supported by the system. This includes AAC, MP1, MP2, MP3 and MP4 audio, compressed WAV files, WMA and other formats.
    • Trying to load any module as a sample will open it in the Instrument Library.
  • Save Sample: Saves an instrument either in the WAV, FLAC or RAW format. Hold Shift while clicking the button to mass-export all samples at once. In the save dialog, you can then use the variables %sample_number%, %sample_filename% and %sample_name%.

Next to the toolbar buttons are a spin button for dialling up a different sample, a drop-down box for changing the zoom level and sample format information.

Edit Toolbar[edit]

Sample Edit Toolbar.png

The sample format block is followed by another toolbar that mostly contains tools for editing samples:

  • Preview Sample: Plays the current sample at middle-C. Clicking the button again stops the sample.
  • Normalize: Amplifies the sample (or a selection of it) as much as possible without distortion. Samples should be normalized before being converted to 8-Bit for optimal usage of the dynamic range. Shift-clicking this button normalizes all samples independently.
  • Amplify: Opens the Amplify dialog, where the sample (or a selection of it) can be faded in or out and amplified by an arbitrary amount.
  • Remove DC Offset: Normalises and shifts the waveform so that is centered around the 0 (DC) line. Any DC bias on samples should be removed for optimal headroom usage. Shift-clicking this button removes DC Offset from all samples.
  • Change Stereo Separation: Allows to widen or reduce a stereo sample’s stereo width, or to swap stereo channels by entering a negative separation amount (-100%: swaps channels, no change in stereo width).
  • Resample: Opens the Resample dialog which can be used to change the sample’s playback frequency.
  • Reverse: Reverses the sample or parts of it.
  • Silence: Silences a sample selection.
  • Invert Phase: Inverts the sample’s or sample selection’s phase.
  • Sign / Unsign: Applies a theoretical conversion between signed and unsigned PCM data to the sample or a selection. Usually this would be used for fixing imported RAW samples with mixed up signed / unsigned import options, but it can also produce nifty-sounding distorted samples.
  • Crossfade: Opens the Sample Crossfader dialog, which applies a crossfade between the sample loop start and loop end for seamless sample loops.
  • Tune sample: Opens the Sample Tuner dialog, where a sample can be tuned to a given note.

External Samples[edit]

In the MPTM format, you may keep references to external samples instead of directly storing them in the module file. This can help reducing disk space taken up by your modules, especially if you want to keep several work-in-progress versions of your song or when using auto save. However, keep in mind that editing these external sample files will also change any module referencing them.

You can enable this feature by checking the Keep Sample Data on Disk box. This is only available if OpenMPT knows the sample’s location on disk, e.g. after you loaded this sample from or saved the sample disk during the current editing session. Shift-clicking the box will enable or disable it for all samples where it is applicable. OpenMPT will only load the external sample’s waveform from disk; any other parameters such as loop points, vibrato and panning settings are stored in the module itself.

The Tree View offers further facilities for external sample management: There, you can right-click any sample and set its external path (this will also reload the sample from that location), save any changes you made to the sample to the external file and reload the sample from disk in case you edited it in an external application. You can also reload edited samples that way even when not using the external samples functionality.

Volume, Panning and Pitch[edit]

  • Default Volume: The note velocity that is applied if no volume command is found next to a note. It can be overriden by placing a volume command (vxx in the volume column, or Cxx in the effect column in the MOD format) next to the note. Enabling Show default volume commands in the General settings displays the default volume next to a note if there are no regular volume commands.
  • Global Volume: The overall attenuation of the sample. At a global volume of 64, no attenuation is done, at 32 the sample is half as loud, etc.
  • Set Pan: Sets the default panning of the sample, which can be overridden by pattern panning commands. If enabled, sample panning overrides the default channel panning and instrument panning. In the XM format, every sample is forced to have a default panning, so there is no channel panning or instrument panning.

In the S3M, IT and MPTM format, you can directly define the playback frequency of the Middle-C:

  • Frequency: Defines the playback frequency of C-5.
  • Transpose: Shows to which note the C-5 frequency is relative to. It can be used to quickly tune the sample to a different note. When changing the transpose value, the frequency is updated instantly.

In the MOD and XM format, you get different options:

  • Finetune: Specifies a slight variation (up to a few hundred Hz) from the Transpose note. Units are 1/8 semitone in MOD format, and are 1/128 semitone in XM format.
  • Transpose: Shows to which note the C-5 frequency is relative to. In the MOD format, this value is locked to C-5, i.e. the Middle-C frequency cannot be changed coarsely, only fine-tuning is possible. Higher notes in this drop-down box represent a higher Middle-C frequency, i.e. C#5 means that it is transposed up by a semitone.

Sample Loops[edit]

Depending on the module format used, samples can have “normal” and sustain loops. Every loop has a Start and End point, and there are several loop points avaiable:

  • Off: The loop is not activated.
  • On: The loop is repeated from the start to the end.
  • Bidi: The loop is played bi-directionally, i.e. it is first played from start to end, then reversed from end to start.

Sustain loops are played as long as no Note Off event is encountered. They are always considered before normal loops, so if the sustain loop is placed beyond the normal loop, the normal loop is ignored at first. As soon as the sustain loop is exited (by means of a Note Off event), playback is resumed in the normal loop.

Note that sample loops have a peculiar behaviour if the ProTracker one-shot loops compatibility setting is enabled in the MOD format: If the loop start is set to 0, the complete sample is played first, after which it restarts and only the loop part is repeated. Since many MOD players do not support this ProTracker quirk, it is recommended to always trim samples (so that there is no more sample data after the loop end) or not start the sample loop at 0.

Auto Vibrato[edit]

OpenMPT’s sample player has an internal oscillator which can be applied to pitch, creating an automatic vibrato effect. Depending on the format, each sample (IT / MPTM) or instrument (XM) can have its own Auto Vibrato settings. In the XM format, all samples that are assigned to the same instrument will share the same vibrato settings.

Auto Vibrato can be combined with vibrato effects in the pattern editor — they both function independently. The Auto Vibrato settings cannot be changed in the patterns, though, so the only way to change the Auto Vibrato amount for a sample is to duplicate it.

The Auto Vibrato is defined by the four following attributes:

  • Vibrato Waveform: In this field, you can select the oscillator waveform, i.e. the waveform that is used to modulate the sample pitch.
  • Vibrato Depth: Defines how “deep” the vibrato is, in 164ths of a semitone. The higher the value is, the more the sample pitch is changed.
  • Vibrato Sweep: Defines how fast the vibrato reaches the full oscillation depth. The behaviour of this setting is inverse in the XM and IT track formats:
    • IT: Full vibrato depth is reached after fading in for (depth × 256 / sweep) ticks, so the higher the value, the quicker the vibrato fades in. 0 means no vibrato at all, 255 means that the full depth is reached after approximately “depth” ticks.
    • XM: Full vibrato depth is reached after fading in for “sweep” ticks, so the higher the value, the slower the vibrato fades in.
  • Vibrato Rate: The rate (or speed) at which the vibrato will be played. One oscillator cycle has 256 / rate ticks, so a higher value implies a faster vibrato effect.

Pitch Shifting and Time Stretching[edit]

Pitch Shifting and Time Stretching can be used to alter a sample’s pitch without affecting playback speed and to to change a sample’s length without altering its pitch. By default, OpenMPT is in Pitch Shifting mode.

Pitch Shifting[edit]

Pitch shifting is done using Short-time Fourier Transform (STFT). Three parameters are available for configuration:

  • Pitch: The amount of semitones the sample should be shifted upwards or downwards.
  • Quality: The oversampling factor which also determines the overlap between adjacent STFT windows. Higher values usually provide better results, at the cost of more processing time.
  • FFT Size: The size of one FFT frame used for processing. Depending on the frequency content of the sample, higher or lower values may sound better.

Time Stretching[edit]

By clicking the Time Stretching checkbox, the Time Stretching mode is enabled. The follwing parameters are available:

  • Parameters: A string which contains a SoundTouch configuration. The numbers are, from left to right:
    • Default sequence length: This is the default length of a single processing sequence in milliseconds which determines how the original sound is chopped in the time-stretch algorithm. Larger values mean fewer sequences are used in processing. In principle a larger value sounds better when slowing down the tempo, but worse when increasing the tempo and vice versa.
      A value of 0 (default) lets the algorithm choose this parameter automatically.
    • Default seeking window length: The seeking window default length in milliseconds is for the algorithm that seeks the best possible overlapping location. This determines from how wide a sample "window" the algorithm can use to find an optimal mixing location when the sound sequences are to be linked back together.
      The bigger this window setting is, the higher the possibility to find a better mixing position becomes, but at the same time large values may cause a "drifting" sound artifact because neighboring sequences can be chosen at more uneven intervals. If there's a disturbing artifact that sounds as if a constant frequency was drifting around, try reducing this setting.
      A value of 0 (default) lets the algorithm choose this parameter automatically.
    • Overlap length: Overlap length in milliseconds. When the sound sequences are mixed back together to form again a continuous sound stream, this parameter defines how much the ends of the consecutive sequences will overlap with each other.
  • Ratio: Defines how much the sample is stretched, ranging from 50% (double speed) to 200% (half speed).
  • Time Stretch Calculator: By clicking the button next to the stretch ratio, the Time Stretch Calculator dialog is opened, where you can calculate the correct time stretch ratio for a given tempo and pattern setup.

Sample Display[edit]

Sample Display Toolbar[edit]

Sample Display Toolbar.png

  • Zoom In / Zoom Out: Increases or decreases sample zoom. You can also press Ctrl while scrolling the Mouse Wheel to achieve the same effect.
  • Toggle Draw Mode: Enables or disables sample drawing which can be used to fix small mistakes in the sample waveform or to create chip samples. Hold down Shift while drawing to draw horizontal lines.
  • Resize Sample: Changes the length of the sample by either adding silence at the start or end or by resizing it to a given length. This can also be used to create new samples for chip samples if there is no sample yet.
  • Sample Grid Size: Enables a sample grid which restricts sample selections to equal-sized sample portions. Set the sample grid size to 0 to disable the sample grid again.

Sample Display[edit]

Below the toolbar, the actual sample is displayed. By dragging the mouse, a sample selection can be made. Shift-clicking a point can be used to draw a sample selection from a previously clicked point to that point. Ctrl-clicking a point plays the sample from that position at the Middle-C frequency. If the sample has any cue points set, they can (by default) be previewed using Shift+1 through Shift+9.

In the status bar, some information about the sampling point below the mouse cursor and (if existing) the current sample selection:

  • If no selection is made, the focussed sampling point is displayed and its position is translated into an Offset pattern effect.
  • If a selection is made, the selection’s start and end point and the selection length (both in samples and in seconds, based on the Middle-C frequency, as well as in beats based on the current tempo) are displayed in addition to the current position of the mouse cursor in the sample.

Right-clicking the sample waveform opens the context menu.

Sample Display Context Menu[edit]

The sample display’s context menu contents differ depending on whether or not there is a selected block of data.

Default sample context menu
Sample selection context menu
  • Zoom: Zooms into the current sample selection.
  • Set as Loop: When a selection is made, this sets the start and end points of the Sample Loop to that of the selection block.
  • Set Loop Start: Uses the selected sample point as the start of the Sample Loop.
  • Set Loop End: Uses the selected sample point as the end of the Sample Loop.
  • Set as Sustain Loop: When a selection is made, this sets the start and end points of the Sustain Loop to that of the selection block.
  • Set Sustain Start: Uses the selected point as the start of the Sustain Loop.
  • Set Sustain End: Uses the selected sample point as the end of the Sustain Loop.
  • Set Sample Cue To: Sets one of the sample cues for the MPTM format’s o volume column command to the selected sample point.
  • Slice at cue points: The cue points found in the sub menu of the previous menu entry are used as splitting positions to create several smaller samples.
  • Convert to 8-Bit: The sample’s bit depth is reduced to 8-Bit, reducing its sound quality in exchange for a smaller sample size.
  • Convert to 16-Bit: The sample’s bit depth is increased to 16-Bit. This should only be done if you want to further manipulate the sample (e.g. resample or time-stretch), as the conversion process itself will not improve sample quality.
  • Convert to Mono: Offers the following options to convert a stereo sample into a mono sample:
    • Mix Channels: Mixes the left and right channels of a stereo sample equally together.
    • Only Left: Only keeps the left channel of a stereo sample.
    • Only Right: Only keeps the right channel of a stereo sample.
    • Split Sample: Create two sample slots for this sample, one containing only the left channel and the other containing just the right channel. If the sample is referenced by an instrument, this is instrument is duplicated as well for the right channel.
  • Trim: Deletes all sample data outside of the selected region.
  • Trim around Loop Points: Deletes all sample data outside of the sample loop. This is only available if no selection has been made.
  • Quick Fade: If the selection includes the beginning of the waveform, this applies a fade-in from the first sample point to the last one in the selected region. If the selected region includes the end of the waveform, then a fade-out from the first sample point of the selection to the last one is applied.
  • Cut: Performs a Copy command, then removes the selected sample data.
  • Copy: Copies the selected part of the sample (or the whole sample if there is selection) to the clipboard. You can then paste this sample data into another sample slot; some third-party applications (including many popular sample editors) can also make use of this clipboard data.
  • Paste (Replace): Replaces the entire sample with the sample data in the clipboard.
  • Paste (Insert): Inserts the sample data in the clipboard into the existing sample. If a selection is made, the selection is replaced by the inserted sample. Otherwise, the sample is inserted at the selected position.
  • Mix Paste: Mixes an existing source sample with the sample data in the clipboard.
  • Undo: Reverts to the previous waveform data (before the last edit).
  • Redo: Reapplies the last undone action.