// Bol Processor version BP2.8.0
// Data file saved as '-da.checkControls.html'. Date: Dim 22 Fév 1998 -- 17:46
-gl.GeneralMIDI
-or.TheBlueNoteJazz
-se.checkControls

// These are examples of effects controlled by BP2
// They can be played with a General MIDI synth or QuickTime MIDI.
// In QuickTime MIDI, a slow Mac may take several seconds loading an instrument. Play the same
// example twice if the proper sound did not come immediately.

// MIDI users need a multi-timbral patch using channels 2 and 4, which we named
// "-or.TheBlueNoteJazz". A patch under this name is available to QuickTime users and has been
// automatically loaded with this file. See the "Devices" menu.

// Csound users may check the 'Write Csound scores' and 'Trace Csound' buttons (Settings window)

// #1 Transposition
// Default transposition is 0.

Shakuhachi
Shakuhachi -- do4 re4 mi4 _transpose(-5) do4 re4 mi4 {fa4 mi4 re4,si4 la4 sol4 } _transpose(0) do4 {_transpose(-5) fa4 mi4 re4,si4 la4 sol4 } {fa4 mi4 re4,si4 la4 sol4 } mi4 re4 do4

// #2 Transposition. Note that BP2 clips key numbers within the MIDI range (0..127) by shifting octaves on notes beyond that range.

LoudPiano
LoudPiano -- do4 re4 mi4 _transpose(-128) do4 re4 mi4 {fa4 mi4 re4,si4 la4 sol4 } _transpose(0) do4


// Velocity controls
// Note that default velocity is 64.

// #3 Simple control
Shakuhachi
Shakuhachi -- _vel(40) do4 re4 mi4 fa4 _vel(120) sol4 {2,fa4 mi4 re4 mi4 re4} _vel(30) do4 re4 mi4 fa4

// #4 Stepwise variation 5 to 127, and from 127 down to 10
Shakuhachi -- _vel(5) _velstep do4 re4 mi4 fa4 _vel(127) do4 re4 mi4 fa4 _vel(10) re4 do4

// #5 Stepwise variation 5 to 127, then keep value 127, eventually change suddenly to 10
// Reduce tempo if you can't hear!
Shakuhachi -- _vel(5) _velstep do4 re4 mi4 fa4 sol4 fa4 mi4 re4 do4 re4 mi4 fa4 _vel(127) _velfixed do4 re4 mi4 fa4 sol4 fa4 mi4 _vel(20) re4 do4

// #6 Stepwise variation until "_velfixed", then constant value (82) until "_vel(127)", then stepwise down from 127 to 10. The constant value is approximately 70.
Shakuhachi -- _vel(20) _velstep do4 re4 mi4 fa4 sol4 fa4 mi4 _velfixed re4 do4 re4 mi4 fa4 _vel(127) _velstep do4 re4 mi4 fa4 sol4 fa4 mi4 _vel(10) re4 do4

// #7 Here we control several fields of a polymetric structure with the same velocity value that keeps increasing from 10 to 127.
Shakuhachi -- _vel(10) _velstep do4 re4 mi4 fa4 sol4 fa4 mi4 re4 do4 re4 mi4 fa4 {do4 mi4 re4 fa4, sol4 si4 do5} _vel(127)

// #8 Multichannel and polyphonic version.
TheBlueNoteJazz
TheBlueNoteJazz -- _chan(K1=2) _vel(10) _velstep do4 re4 mi4 fa4 sol4 fa4 mi4 re4 do4 re4 mi4 fa4 _vel(127) _velfixed do4 _vel(30) mi4 re4 fa4 _chan(4) sol4 si4 do5 {_chan(K1) do4 _vel(30) mi4 re4 fa4,_vel(70) _chan(4) sol4 si4 do5} _script(MIDI all notes off channel 2)

// #9 Also multi-timbral. We keep a separate control "_vel(40)" on one voice.
TheBlueNoteJazz -- _vel(10) _velstep _chan(K1=2) do4 re4 mi4 fa4 sol4 fa4 mi4 re4 do4 re4 mi4 fa4 do4 mi4 re4 fa4 {_chan(K1) do4 mi4 re4 fa4, _chan(4) _vel(40) sol4 si4 do5} _chan(K1) fa4 mi4 re4 do4 _vel(127)

// Volume control.

// #10 Stepwise control. "_volumecontrol(7)" is not necessary because controller 7 is the default volume controller.
Shakuhachi
Shakuhachi -- _volumecontrol(7) _volume(30) _volumestep do4 re4 mi4 fa4 sol4 fa4 mi4 re4 do4 re4 mi4 fa4 _volume(127)

// #11 Continuous control.
// Note that parameters K1,K2,.. may also be controlled by external MIDI devices.
// The default value of _volumerate is 50 samples per second.
Shakuhachi -- _volumerate(40) _volumecont _volume(K1=64) re4_______ _volume(127) ________ _volume(K2=10) _____ _volume(K1)

// #12 Controlling volume on channel 4. This will work if the synth is in "OMNI ON" mode or
// its keyboard is on channel 4.
// Here we expect that the keyboard is not on channel 4, so we put the synth in OMNI mode
// This is done by the "_script()" command which is only effective if the "Internal"
// bank is selected! There are also lots of silences in the beginning to give
// time to the D-50 to set-up changes.
TheBlueNoteJazz
Internal - _script(MIDI Omni mode ON channel 1) -- TheBlueNoteJazz --- _chan(4) _volumestep _volume(30) do4 re4 mi4 fa4 sol4 fa4 mi4 re4 do4 re4 mi4 fa4 _volume(127)

// #13 Almost the same example except that "_volume(20)" is placed before "_chan(4)".
// Consequently, control is sent on channel 1 (the default channel). This will work if the synth is in "OMNI ON" mode or its keyboard is on channel 1.
Internal - _script(MIDI Omni mode ON channel 1) -- TheBlueNoteJazz --- _volumestep _volume(20) _chan(4) do4 re4 mi4 fa4 sol4 fa4 mi4 re4 do4 re4 mi4 fa4 _volume(127)

// #14 Continuous control of volume, channel 2. Same remark regarding channels.
// "_volumerate(10)" must be placed after "_chan(2)" so that the rate is fixed on the
// desired channel.
// Beware that "_volumecont" precedes the first "_volume()" instruction!
Internal - _script(MIDI Omni mode ON channel 1) -- TheBlueNoteJazz --- _chan(2) _volumerate(10) _volumecont _volume(127) do4 _ _volume(10) __ _volume(127) __ _volume(0) __ _volume(100)_______

// #15 Controlling volume on several channels. This may not work
// properly if the synth (e.g. D-50) does not recognize positions of volume pedals on
// separate channels. Either the setting is "OMNI ON" and all _volume() will change the unique
// pedal (the one with the same MIDI channel as the keyboard), or "OMNI OFF" and only
// _volume() on the same channel as the keyboard will be recognized.
TheBlueNoteJazz -- {_chan(2) _volumerate(50) _volumecont _volume(127) do4________volume(0)____ _volume(127),_chan(4) _volumefixed _volume(64) sol4 ________}

// #16 Similar example producing different results on D-50.
// With "OMNI ON" and keyboard on channel 1, volume is changed on both channels. In fact,
// the control on channel 4 replaces the one on channel 2.
// With "OMNI OFF" and keyboard on channel 2, the control on channel 4 is ignored.
// With "OMNI OFF" and keyboard on channel 4, the control on channel 2 is ignored.
// I have written _volume(64) at the end of the item because you might forget to move the
// pedal of your synth and it would remain silent, unless 'Reset controllers' is checked!
TheBlueNoteJazz -- _chan(2) _volumestep _volume(127) do4 re4 mi4 fa4 sol4 fa4 mi4 re4 do4 _chan(4) sol4 si4 do5 {_chan(2) do4 mi4 re4 fa4 do4 mi4 re4 fa4, _chan(4) _volumecont _volume(127) sol4 si4 do5 sol4 si4 do5 _volume(30)} _chan(2) _volume(0) --- _volume(64)


// There are other remarks regarding the continuous or stepwise control of parameters like
// velocity, articulation, volume, pitchbender, modulation and pressure on several
// channels in a single sequence. See the last examples of pitchbend control below and apply
// the same principles


// Pitchbend control. It is advisable to reset the pitch bender to its initial value before
// exiting. At least, BP2 resets pitchbenders on all channels before starting an item.
// Result depends on the pitchbend range of your patch, which is declared
// by _pitchrange(x). For example, if the total range is 4 semitones, i.e. +/- 200 cents,
// you should declare _pitchrange(200). BP2 only checks that the value sent via MIDI
// falls in range 0..16383, where '0' means here '-200 cents' and '16383' means '+200 cents'.

// Beware that you must declare the pitch range for each MIDI channel you will be needing!

// The rate of sampling (default 50 samples per second) is declared by _pitchrate()

// #17 Pitch bender used to modify individual notes
// "_pitchrange(200)" must be placed after "_chan(1)" so that it is assigned to the proper
// channel
Cello
Cello -- _chan(1) _pitchrange(200) do4 re4 _pitchbend(0) mi4 fa4 sol4 fa4 mi4 re4 do4 re4 mi4 fa4 _pitchbend(50) mi4 fa4 sol4 fa4 mi4 re4 do4 _pitchbend(0)


// #18 A stepwise portamento: bender values are interpolated between -200 and +200 cents
Cello -- _pitchrange(200) _pitchbend(-50) _pitchstep re4 re4 re4 re4 re4 re4 _pitchbend(50) _pitchbend(0)

// #19 Also stepwise, but notes are not stroked again. Will only produce effect if the 'hold' pedal is on, which is done automatically by _switchon(64,1).
Cello -- _chan(1) _pitchrange(200) _pitchbend(-200) _switchon(64,1) _pitchbend(+200) _pitchstep re4 - - - - - - - _pitchbend(-200) _switchoff(64,1)

// #20 A simple continuous portamento
Cello -- _pitchrange(200) _pitchcont _pitchbend(+200) re4_ _ _ _ _ _ _ _pitchbend(-200)

// #21 Continuous portamento down and up
Cello -- _pitchrange(200) _pitchcont _pitchbend(+200) re4 _ _ _ _ _ _ _ _pitchbend(-200) _ _ _ _ _ _ _ _ _ _ _pitchbend(+160) _ _ _ _ _ _ _pitchbend(-200) _ _ _pitchbend(0) _ _ _ _

// #22 Same portamento, faster.
Cello -- /4 _pitchrange(200) _pitchcont _pitchbend(+200) re4 _ _ _ _ _ _ _ _pitchbend(-200) _ _ _ _ _ _ _ _ _ _ _pitchbend(+160) _ _ _ _ _ _ _pitchbend(-200) _ _ _pitchbend(0) _ _ _ _

// #23 Same portamento played twice and very fast. The limitation for obtaining accuracy
// is only the sampling period of the pitch bender (default 50 samples per second)
// Remember that PitchBend messages are produced in real time, not stored in memory, so that
// the movement may be quite complex. Fast movements might not work in QuickTime Music.
// Note in the following example that the movement is not contsrained by time quantization:
// With 50ms time accuracy we have 20 events per second, but BP2 will generate the pitch
// pattern at the rate of 60 PitchBend messages per second.
Cello /32 _pitchrange(200) _pitchcont _pitchrate(60) _pitchbend(+200) re4 _ _ _ _ _ _ _ _pitchbend(-200) _ _ _ _ _ _ _ _ _ _ _pitchbend(+160) _ _ _ _ _ _ _pitchbend(-200) _ _ _pitchbend(0) _ _ _ _pitchbend(+200) _ _ _ _ _ _ _ _pitchbend(-200) _ _ _ _ _ _ _ _ _ _ _pitchbend(+160) _ _ _ _ _ _ _pitchbend(-200) _ _ _pitchbend(0) _ _ _

// #24 Portamento on multichannel item
// Unlike volume control, pitch control is properly separated on each channel in most
// synth's.
// Note that the first field of the polymetric volume ("do4") is assigned channel 4
// because it was the channel before entering the polymetric structure.
// It is useful to specify _chan(4) at the very beginning of the item because the pitchbender
// is reset on the first sound-object (here, a silence); that sound-object should be on
// channel 4.

TheBlueNoteJazz
TheBlueNoteJazz -- _chan(4) _pitchrange(200) _pitchbend(0) - - do4___ { _vel(127) _pitchbend(-200) _pitchcont do4______________ _pitchbend(+200),_chan(2) sol4______________}

// #25 Here no portamento is produced on sol4 because it is on channel 2. But the
// pitchbend continues going down on channel 4.
TheBlueNoteJazz -- _chan(4) _pitchrange(200) _pitchbend(+200) _pitchcont do4____ do4_____ _chan(2) sol4________ _chan(4) do4______ do4______ _pitchbend(-200)

// #26 In a polyphonic piece, by default, the parameter in every sequence follows a linear
// variation that is determined by outside values, regardless of the channel.
// It's fair to ignore channels in this case so that Csound, which works rather instrumentwise,
// will get the same interpretation.
TheBlueNoteJazz -- _chan(4) _pitchrange(200) _pitchbend(-200) _pitchcont do4___ {do4______________, _chan(2) _volume(30) sol4______________} do4___ _pitchbend(+200)

// #27 To avoid 'sol4' to change pitch, do as follows:
TheBlueNoteJazz -- _chan(4) _pitchrange(200) _pitchbend(-200) _pitchcont do4___ {do4______________, _chan(2) _pitchfixed _volume(30) sol4______________} do4___ _pitchbend(+200)

// #28 Using object concatenation '&' to extend durations
TheBlueNoteJazz -- _chan(4) _pitchrange(200) _pitchbend(-200) _pitchcont do4___& {&do4______________&,_chan(2) _pitchfixed _volume(30) sol4______________} &do4___ _pitchbend(+200)

// #29 Controlling pitchbenders on two separate channels. You can use up to 16 channels with separate simultaneous movements.
// "_pitchrange()" must be placed after each "_chan()" so that it is assigned to the proper channel.
TheBlueNoteJazz -- _volume(70) {_chan(4) _pitchrange(200) _pitchbend(+200) _pitchcont do4________pitchbend(-200)_________ _pitchbend(0),_chan(2) _vel(30) _pitchrange(200) _pitchbend(-200) _pitchcont sol4 _______________pitchbend(+200)}

// #30 Here is an example that will not work: attempting to control pitchbend of two separate channels on overlapping time intervals in the same sequence. The portamento on channel 5 will resume at value (150) after 'sol4' instead of continuing the initial line.

TheBlueNoteJazz -- _volume(80) _chan(4) _pitchrange(200) _pitchbend(+200) _pitchcont do4_____ _chan(2) _pitchrange(200) _pitchcont _pitchbend(-150) sol4__ _pitchbend(150) _chan(4) do4______ do4______ _pitchbend(-200)

// #31 These are proper ways of writing the previous example.
TheBlueNoteJazz -- _volume(80) _chan(4) _pitchrange(200) _pitchbend(+200) _pitchcont do4_____ {---,_chan(2) _pitchrange(200) _pitchcont _pitchbend(-150) sol4__ _pitchbend(150)} do4______ do4______ _pitchbend(-200)

TheBlueNoteJazz -- _volume(80) _chan(4) _pitchrange(200) _pitchbend(+200) _pitchcont do4_____ {_chan(2) _pitchrange(200) _pitchcont _pitchbend(-150) sol4__ _pitchbend(150)} do4______ do4______ _pitchbend(-200)


// Modulation

// #32 Step changes of modulation
// It is advised to reset modulation to 0 at the end.
Shakuhachi
Shakuhachi -- _modstep _mod(0) re4_____ re4_____ re4_____ re4_____ re4_____ _mod(16383) _mod(0)

// #33 Continuous change of modulation
// The rate of sampling (default 50 samples per second) is declared by _modrate()
// Be careful to write "_modcont" before the first "_mod()" instruction.
Shakuhachi -- _modrate(30) _modcont _mod(0) re4 ________________ _mod(16383) mi4______________________ _mod(0)_________

// #34 Changing both pitch and modulation
Violin -- _pitchrange(200) _modcont _pitchcont _mod(16383) _pitchbend(+200) re4_____ _pitchbend(-200) ________________ _pitchbend(0) _mod(0)


// Channel pressure
// This also may not work with QuickTime Music.

// #35 Changing channel pressure by steps
// Note: on this patch of D-50 channel pressure produces the same effect as modulation
// It is advised to reset to 0 at the end of the item (unless "Reset controllers" is checked).
Violin
Violin -- _chan(1) _presstep _press(5) do4 _ _ _ do4 _ _ _ do4 _ _ _ do4 _ _ _ _ _ _ _ _press(127) _press(0)

// #36 Changing channel pressure continuously
// The rate of sampling (default 50 samples per second) is declared by _pressrate()
Violin -- _pressrate(30) _presscont _press(0) do4 ___ do4 ___ do4 ___ do4 _______ _press(127) _press(0)

// #37 Here the initial value (0) is stored in K1
Violin -- _chan(1) _presscont _press(K1=0) do4 _________________ _press(127) ____________ _press(K1) ____

// #38 Changing pitch and channel pressure independently
Violin -- _pressrate(30) _pitchrate(40) _pitchrange(200) _press(0) _pitchbend(0) _pitchcont _presscont do4 ____________ _pitchbend(+200) _____ _press(127) ___ _pitchbend(-200) _________ _press(0) ____ _pitchbend(0)


// #39 Panoramic control
// Works only if a MIDI controller is assigned to panoramic control, as per General MIDI specs, by default controller 10.
// I haven't been able to check this on D-50, so please report if successful
// and tell me whether "left" is 0 or 127.
// This also may not work with QuickTime Music.

// Here, "_pancontrol(10)" is not needed because it's the default value.
Shakuhachi
Shakuhachi -- _pancontrol(10) _panrate(40) _pancont _pan(0) re4_______ _pan(127) ________ _pan(K2=10) _____ _pan(80) _________ _pan(K2)


// Of course, you can combine all the effects described above: controlling velocity, volume, articulation, pitch, modulation, pressure, in polyphonic and multichannel items. The limitation is only the MIDI system: you can't, for instance, assign different PitchBend values to simultaneous notes on the same MIDI channel.

// #40 Controlling switches 64 to 95 (64 is the 'hold' pedal)
Violin
Violin -- do4 --- do4 --- _switchon(64,1) do4 --- do4 _switchoff(64,1) --- do4

//--------------------------------------------------------+