### Basic Offset Examples Source: https://sfzformat.com/opcodes/offset_ccN These examples demonstrate setting a fixed offset for sample playback. The offset value specifies the starting sample unit. ```sfz offset=3000 ``` ```sfz offset=32425 ``` -------------------------------- ### pitcheg_start Opcode Example Source: https://sfzformat.com/opcodes/pitcheg_start_onccN Sets the envelope start level to 20%%. This opcode is used in SFZ files to define the initial amplitude of an envelope. ```plaintext ampeg_start=20 ``` -------------------------------- ### fileg_start Opcode Example Source: https://sfzformat.com/opcodes/pitcheg_start_onccN Sets the file envelope start level to 100%%. This opcode is used in SFZ files to define the initial amplitude of a file envelope. ```plaintext fileg_start=100 ``` -------------------------------- ### Basic Monophonic Legato Implementation Source: https://sfzformat.com/tutorials/legato This example demonstrates a basic monophonic flute setup using group and off_by opcodes for legato. Specify ampeg_release for smoother fadeouts between notes. Ensure correct group and off_mode settings for desired behavior. ```sfz ampeg_release=0.3 amp_veltrack=0 sw_lokey=48 sw_hikey=49 group=1 off_by=1 off_mode=normal lokey=50 hikey=51 pitch_keycenter=50 sw_last=48 sample=d4_p.wav xfin_locc1=0 xfin_hicc1=42 xfout_locc1=43 xfout_hicc1=85 sample=d4_mf.wav xfin_locc1=43 xfin_hicc1=85 xfout_locc1=86 xfout_hicc1=127 sample=d4_f.wav xfin_locc1=86 xfin_hicc1=127 lokey=52 hikey=53 pitch_keycenter=52 sw_last=48 sample=e4_p.wav xfin_locc1=0 xfin_hicc1=42 xfout_locc1=43 xfout_hicc1=85 sample=e4_mf.wav xfin_locc1=43 xfin_hicc1=85 xfout_locc1=86 xfout_hicc1=127 sample=e4_f.wav xfin_locc1=86 xfin_hicc1=127 lokey=50 hikey=51 pitch_keycenter=50 sw_last=49 sample=d4_ft_p.wav xfin_locc1=0 xfin_hicc1=63 xfout_locc1=64 xfout_hicc1=127 sample=d4_ft_f.wav xfin_locc1=64 xfin_hicc1=127 lokey=52 hikey=53 pitch_keycenter=52 sw_last=49 sample=e4_ft_p.wav xfin_locc1=0 xfin_hicc1=63 xfout_locc1=64 xfout_hicc1=127 sample=e4_ft_f.wav xfin_locc1=64 xfin_hicc1=127 ``` -------------------------------- ### pitcheg_start_onccN Opcode Example Source: https://sfzformat.com/opcodes/pitcheg_start_onccN Modulates the pitcheg_start opcode using a MIDI controller. This allows dynamic control over the envelope start level. ```plaintext pitcheg_start_onccN ``` -------------------------------- ### Basic eqN_gain Examples Source: https://sfzformat.com/opcodes/eqN_gain_onccX These examples show how to set the gain for different equalizer bands. Negative values reduce gain, while positive values increase it. ```sfz eq1_gain=-3 eq2_gain=6 eq3_gain=-6 ``` -------------------------------- ### eqN_gain_onccX Example Source: https://sfzformat.com/opcodes/eqN_gain_onccX This example demonstrates setting the gain for an equalizer band modulated by a MIDI CC. This is useful for dynamic control of EQ. ```sfz eq1_gain_oncc23=-12 ``` -------------------------------- ### Basic eqN_gain Examples Source: https://sfzformat.com/opcodes/eqN_gain These examples demonstrate setting the gain for different equalizer bands (eq1, eq2, eq3) to negative and positive values. ```plaintext eq1_gain=-3 eq2_gain=6 eq3_gain=-6 ``` ```plaintext eq1_gain_oncc23=-12 ``` -------------------------------- ### Example Usage of fil_gain and fil2_gain Source: https://sfzformat.com/opcodes/fil2_gain_onccN This example demonstrates setting up two filters, one as a low shelf and the other as a high shelf, with specific cutoff frequencies and gain values. ```sfz fil_type=lsh cutoff=150 fil_gain=-6 fil2_type=hsh cutoff2=80000 fil2_gain=3 ``` -------------------------------- ### delay_beats with stop_beats Source: https://sfzformat.com/opcodes/delay_beats Shows how to use delay_beats in combination with stop_beats. This example delays the start by 2.25 beats and stops playback at 3 beats. ```sfz delay_beats=2.25 stop_beats=3 ``` -------------------------------- ### Stereo Positioning Examples Source: https://sfzformat.com/opcodes/position_onccN These examples demonstrate how to use the `position` opcode to control stereo panning. The first example mixes both channels and plays the result to the left. The second example narrows the stereo image and plays it slightly to the right. The third example shows how `position` can be modulated by a MIDI CC. ```sfz width=0 position=-100 ``` ```sfz width=50 position=30 ``` ```sfz width=50 position_oncc40=-50 ``` -------------------------------- ### SFZ Keyswitching Example with sw_default Source: https://sfzformat.com/opcodes/sw_default This example demonstrates how to use sw_default to set an initial keyswitch. Notes 36, 38, and 40 are configured as switches for sine, triangle, and saw oscillators respectively, with 36 being the default. ```sfz // ********************************************************************** // A Keyswitching Example // // Notes 36,38 and 40 serve as switches to trigger sine, triangle or saw oscillators. // you can expand on this concept to create your own KeySwitching instruments. // ********************************************************************** sw_lokey=36 sw_hikey=40 sw_default=36 sw_last=36 sw_label=Sine lokey=41 sample=*sine sw_last=38 sw_label=Triangle lokey=41 sample=*triangle sw_last=40 sw_label=Saw lokey=41 sample=*saw ``` -------------------------------- ### Unison Oscillator Configuration Example Source: https://sfzformat.com/opcodes/oscillator_multi This example demonstrates setting up a region for unison with 5 oscillators, each detuned by 100 cents. The comments illustrate the resulting gain and detuning for left and right channels. ```sfz /* # Left: [4] 25 cents, 0 dB [3] -25 cents, -2.49878 dB [2] 100 cents, -6.0206 dB [1] -100 cents, -12.0412 dB [0] 0 cents, -inf dB # Right: [0] 0 cents, 0 dB [1] -100 cents, -2.49878 dB [2] 100 cents, -6.0206 dB [3] -25 cents, -12.0412 dB [4] 25 cents, -inf dB */ oscillator_detune=100 oscillator_multi=5 ``` -------------------------------- ### Example Usage of fil_gain and fil2_gain Source: https://sfzformat.com/opcodes/fil_gain This example demonstrates how to set up low-shelf and high-shelf filters using fil_type, cutoff, fil_gain, fil2_type, cutoff2, and fil2_gain opcodes. Ensure the correct filter types and cutoff frequencies are specified for the desired EQ effect. ```sfz fil_type=lsh cutoff=150 fil_gain=-6 fil2_type=hsh cutoff2=80000 fil2_gain=3 ``` -------------------------------- ### MD5 Hash Example Source: https://sfzformat.com/opcodes/md5 This example shows how to specify the MD5 hash for a sample file within an SFZ region. It is used to verify the integrity of the sample. ```sfz /* University of Iowa Music Instrument Samples - Piano http://theremin.music.uiowa.edu/MISpiano.html */ sample=Piano.ff.A0.aiff md5=4ce81c280832d99f05a0d609a1031d5e ``` -------------------------------- ### Basic Sequence Position Example Source: https://sfzformat.com/opcodes/seq_position This example shows how a region plays on the second note out of every four notes in a sequence. ```plaintext seq_length=4 seq_position=2 ``` -------------------------------- ### Example Usage of on_lohdccN and on_hihdccN Source: https://sfzformat.com/opcodes/on_hihdccN This example demonstrates setting both the lower and higher floating-point MIDI CC opcodes. Use these when you need to control parameters with fractional values. ```sfz on_lohdcc64=1 on_hihdcc64=1 ``` -------------------------------- ### Basic param_offset Examples Source: https://sfzformat.com/opcodes/param_offset Demonstrates different integer values that can be used for param_offset. ```sfz param_offset=300 ``` ```sfz param_offset=400 ``` ```sfz param_offset=412 ``` -------------------------------- ### eqN_bw Opcode Examples Source: https://sfzformat.com/opcodes/eqN_bw Examples demonstrating the usage of the eqN_bw opcode to set equalizer band bandwidths. Values are in octaves. ```plaintext eq1_bw=1 eq2_bw=0.4 eq3_bw=1.4 ``` -------------------------------- ### Example Usage of on_lohdccN and on_hihdccN Source: https://sfzformat.com/opcodes/start_hihdccN This example demonstrates setting both on_lohdcc64 and on_hihdcc64 to 1. These opcodes are used for floating-point MIDI CCs. ```plaintext on_lohdcc64=1 on_hihdcc64=1 ``` -------------------------------- ### Hitimer Region Example Source: https://sfzformat.com/opcodes/hitimer This example shows how to use the hitimer opcode to set an upper bound for region playback based on elapsed time. The region will play if the timer is between lotimer (if specified) and hitimer. ```sfz hitimer=0.25 sample=quick.wav ``` ```sfz lotimer=0.25 sample=slow.wav ``` -------------------------------- ### Example Flex Envelope Generator (SFZ 2.0) Source: https://sfzformat.com/modulations/envelope_generators This example demonstrates a flex envelope generator for pitch modulation. It defines four points with specific durations and levels to shape the pitch envelope over time. ```sfz eg01_pitch=1200 eg01_time1=0 eg01_level1=0 eg01_time2=1 eg01_level2=1 eg01_time3=2 eg01_level3=0.5 eg01_sustain=3 eg01_time4=1 eg01_level4=0 ``` -------------------------------- ### SFZ Master Header Example Source: https://sfzformat.com/headers/master This example demonstrates the structure of a master header within an SFZ file, showing how global, master, group, and region headers are organized. Use this to understand the hierarchy and placement of master settings. ```sfz loop_mode=one_shot ampeg_attack=0.001 ampeg_decay=0.7 ampeg_sustain=100 amplitude_cc30=100 offset_cc33=3000 ampeg_sustain_oncc33=-100 key=36 sample=../Samples/bobobo/bobobo_bass_vl1_rr1.wav hirand=0.250 sample=../Samples/bobobo/bobobo_bass_vl1_rr2.wav lorand=0.250 hirand=0.500 sample=../Samples/bobobo/bobobo_bass_vl1_rr3.wav lorand=0.500 hirand=0.750 sample=../Samples/bobobo/bobobo_bass_vl1_rr4.wav lorand=0.750 amplitude_cc35=100 offset_cc38=1500 ampeg_sustain_oncc38=-100 key=38 sample=../Samples/bobobo/bobobo_tenor_l_vl1_rr1.wav hirand=0.250 sample=../Samples/bobobo/bobobo_tenor_l_vl1_rr2.wav lorand=0.250 hirand=0.500 sample=../Samples/bobobo/bobobo_tenor_l_vl1_rr3.wav lorand=0.500 hirand=0.750 sample=../Samples/bobobo/bobobo_tenor_l_vl1_rr4.wav lorand=0.750 ``` -------------------------------- ### ampeg_start and fileg_start Examples Source: https://sfzformat.com/opcodes/ampeg_start Demonstrates setting the ampeg_start and fileg_start opcodes. Setting ampeg_start to 100 can mimic zero attack time and added hold time. Be aware that non-zero ampeg_start values might cause audible clicks if the sample playback doesn't begin near zero amplitude. ```plaintext ampeg_start=20 fileg_start=100 ``` -------------------------------- ### Stop Beats Example Source: https://sfzformat.com/opcodes/stop_beats Demonstrates the usage of stop_beats in conjunction with delay_beats to control loop slicing. These values determine when a region will stop playing relative to the start of the loop. ```sfz delay_beats=1 stop_beats=1.5 ``` ```sfz delay_beats=25.9922 stop_beats=26.0964 ``` -------------------------------- ### Set Polyphonic Aftertouch Range Source: https://sfzformat.com/opcodes/lopolyaft This example sets the region to play only if the last Polyphonic Aftertouch message received was within the 30-100 range. Ensure that aftertouch is enabled and configured correctly in your MIDI setup. ```sfz lopolyaft=30 hipolyaft=100 ``` -------------------------------- ### Define Loop Start Point Source: https://sfzformat.com/legacy Sets the sample loop start point in samples. Overwrites the sample's defined loop start. Has no effect if loop_mode is set to no_loop. ```sfz loop_start=4503 ``` ```sfz loop_start=12445 ``` -------------------------------- ### Setting LFO Phase Source: https://sfzformat.com/opcodes/lfoN_phase_onccX Use `lfoN_phase` to set the initial phase shift for LFO number N. The phase value determines where the LFO starts in its cycle. For a sine wave, phase 0 starts at the center and moves up, 0.5 starts at the center and moves down, and 0.25 starts at the maximum value. ```sfz lfo02_phase=0.5 lfo01_phase=0.25 ``` -------------------------------- ### ampeg_sustain_curveccN Example Source: https://sfzformat.com/opcodes/ampeg_sustain_curveccN This example shows the basic syntax for setting the ampeg_sustain_curveccN opcode. It is an ARIA-specific parameter. ```plaintext ampeg_sustain=40.34 pitcheg_sustain=10(eg type)_sustain ``` -------------------------------- ### SFZ sw_down and sw_up Example Source: https://sfzformat.com/opcodes/sw_down Demonstrates setting the sw_down and sw_up opcodes with both MIDI note numbers and names. Use sw_down to define a key that triggers a region when pressed, and sw_up for regions that should play when no sw_down key is active. ```sfz sw_down=C3 sw_down=24 sw_up=25 ``` -------------------------------- ### off_shape Opcode Examples Source: https://sfzformat.com/opcodes/off_shape Examples demonstrating the usage of the off_shape opcode. This opcode affects regions muted by polyphony limitations. ```plaintext off_shape=2.1 ``` ```plaintext off_shape=-3.8 ``` -------------------------------- ### Basic Sequential Round Robin Setup Source: https://sfzformat.com/tutorials/unison Sets up a basic sequential round robin with three samples per note. Use this to establish a baseline for round robin emulation. ```unison seq_length=3 seq_position=1 sample=c5_rr1.wav key=60 sample=c#5_rr1.wav key=61 sample=d5_rr1.wav key=62 seq_position=2 sample=c5_rr2.wav key=60 sample=c#5_rr2.wav key=61 sample=d5_rr2.wav key=62 seq_position=3 sample=c5_rr3.wav key=60 sample=c#5_rr3.wav key=61 sample=d5_rr3.wav key=62 ``` -------------------------------- ### Setting EQ Type to Low Shelf Source: https://sfzformat.com/opcodes/eqN_type This example demonstrates how to set the EQ type to 'lshelf' for the first EQ band. Ensure that the gain, frequency, and bandwidth are also defined for the EQ band. ```sfz eq1_gain=20 eq1_freq=10000 eq1_bw=1 eq1_type=lshelf ``` -------------------------------- ### ampeg_sustain Opcode Example Source: https://sfzformat.com/opcodes/pitcheg_sustain_curveccN Example demonstrating the usage of the ampeg_sustain opcode. This sets the sustain level of the amplitude envelope generator to 40.34%. ```sfz ampeg_sustain=40.34 ``` -------------------------------- ### SFZ Instrument with Nested Include Path Source: https://sfzformat.com/tutorials/modular_instruments This example demonstrates using #include with a relative path to a file in a subdirectory, assuming the main SFZ file is in a 'Programs' folder and samples are in a 'Samples' folder. ```sfz hicc100=63 #include "mappings/sample_map.sfz" locc100=64 group=1 off_by=1 #include "mappings/sample_map.sfz" ``` -------------------------------- ### Basic #include Usage Source: https://sfzformat.com/opcodes/include Demonstrates the basic usage of the #include directive to incorporate external SFZ files. ```sfz #include "header.sfz" #include "note_map.sfz" #include "legato/dynfade_legato_first_map.sfz" ``` -------------------------------- ### pitcheg_sustain Opcode Example Source: https://sfzformat.com/opcodes/pitcheg_sustain_curveccN Example demonstrating the usage of the pitcheg_sustain opcode. This sets the sustain level of the pitch envelope generator to 10%. ```sfz pitcheg_sustain=10 ``` -------------------------------- ### Pitch Envelope Attack Shape Examples Source: https://sfzformat.com/opcodes/pitcheg_attack_shape These examples demonstrate setting the pitcheg_attack_shape opcode to positive and negative values to control the attack curve. ```plaintext pitcheg_attack_shape=2.1 pitcheg_attack_shape=-3.8 ``` -------------------------------- ### fil2_type Example: High-Pass Filter Source: https://sfzformat.com/opcodes/fil2_type Use `fil2_type` to define the type of the second filter in a series. This example sets it as a 2-pole high-pass filter. ```plaintext fil2_type=hpf_2p ``` -------------------------------- ### #include with Master Header Source: https://sfzformat.com/opcodes/include Shows how to use the #include directive in conjunction with the header for complex instrument setups. ```sfz loop_mode=one_shot off_mode=normal tune=-1200 //Everything is tuned down an octave, then tuned back up with its own tune param pan=-100 //Similar for pan - hard left, brought to proper position with param pan_oncc10=0 //Disable master pan amplitude_oncc7=100 ampeg_attack=0.001 ampeg_decay=0.7 ampeg_sustain=100 amplitude_cc30=100 pan_cc31=200 tune_cc32=2400 tune_cc55=-500 offset_cc33=3000 ampeg_sustain_oncc33=-100 #include "mappings/bobobo_bass.sfz" amplitude_cc35=100 pan_cc36=200 tune_cc37=2400 offset_cc38=1500 ampeg_sustain_oncc38=-100 tune_cc55=-250 #include "mappings/bobobo_tenor_l_1.sfz" #include "mappings/bobobo_tenor_l_2.sfz" ``` -------------------------------- ### Opcode Inheritance Example Source: https://sfzformat.com/tutorials/basics Demonstrates how opcodes defined in a parent header are inherited by child headers. This reduces file size by avoiding repetition. ```sfz lovel=64 // enter stuff here if you want to apply it to all regions hivel=127 sample=Trumpet_C4_v2.wav key=60 sample=Trumpet_C#4_v2.wav key=61 sample=Trumpet_D4_v2.wav key=62 ``` ```sfz sample=Trumpet_C4_v2.wav key=60 lovel=64 hivel=127 sample=Trumpet_C#4_v2.wav key=61 lovel=64 hivel=127 sample=Trumpet_D4_v2.wav key=62 lovel=64 hivel=127 ``` -------------------------------- ### ampeg_vel2sustain Example Source: https://sfzformat.com/opcodes/ampeg_vel2sustain This example shows how to set the ampeg_vel2sustain parameter. It controls the sustain level of the amplitude envelope generator based on MIDI velocity. ```plaintext ampeg_vel2sustain=40.34 ``` -------------------------------- ### rt_decay Example Source: https://sfzformat.com/opcodes/rt_decay Demonstrates the usage of rt_decay with a release sample. The sample 'keyup_noise.wav' will decrease in volume by 3dB for every second the key is held down. ```sfz sample=pianoA4.wav trigger=attack sample=keyup_noise.wav trigger=release rt_decay=3 //The sample keyup_noise.wav will play 3db quieter for every second the key has been on. ``` -------------------------------- ### Basic Legato Region Setup Source: https://sfzformat.com/tutorials/legato Configures initial and legato regions with distinct offsets and crossfade times. Initial notes use group 1, while legato notes use group 2 for muting. ```sfz off_mode=time off_time=1 amp_veltrack=0 trigger=first group=1 off_by=2 //Sample map goes here #include "mappings/6_a_map.sfz" trigger=legato offset=6000 ampeg_attack=0.4 group=2 off_by=2 //Sample map goes here #include "mappings/6_a_map.sfz" ``` -------------------------------- ### Legato with Combined Transition and Sustain Samples Source: https://sfzformat.com/tutorials/legato Use this approach when each legato sample includes both the transition and the full sustain of the next note. This simplifies setup but can increase sample size. ```sfz // Legato transitions and the complete sustain of the next note both in the same sample trigger=legato group=2 off_by=2 ampeg_attack=0.05 ampeg_release=0.2 off_mode=normal // Leg transitions up sample=legatovib_g4_a4.wav key=A4 sw_previous=G4 sample=legatovib_g4_c5.wav key=C5 sw_previous=G4 sample=legatovib_a4_c5.wav key=C5 sw_previous=A4 // Leg transitions down sample=legatovib_c5_a4.wav key=A4 sw_previous=C5 sample=legatovib_c5_g4.wav key=G4 sw_previous=C5 ```