; Mellotron Mk.II Flute
; Iain McCurdy. 2019
; A semi-physical model of a Mellotron MkII flute sound.
; Emulations of noise, hum, crackle and tape Wow are implemented
; CONTROLS
; Volume - as its name suggests
; Tone - 6 dB/oct lowpass filter
; Pitch - pitch control of the flute sound +/- 2 semitones. Can also be controlled using a MIDI pitch bend wheel.
; C R A C K L E
; Level - level of crackle noise in the output sound
; Density - density of the crackle noise in the output (crackles per second)
; H U M
; Level - level of mains hum sound in the output
; 50/60 Hz - choosen between 60 Hz (Americas/parts of Asia) and 50 Hz (rest of the World)
; V I B R A T O (pitch and amplitude modulation - this is slightly random in depth and rate)
; Rate - rate of vibrato
; Depth - depth of vibrato
; S O U N D
; Res/Noise - Mix between a pure resonant component (oscillator) and a noisier but still pitched (streson) component
; TAPE - choose between playing finite 7 1/2 second tape strips (authentic) or infinite tape strips
; Wow - random Wowing of amplitude, high-frequency loss and speed/pitch wobble emulating tape degradation
; Hiss - a general tape hiss component
form caption("Mellotron Mk.II Flute") size(655, 205), colour(255,255,240), pluginid("MlFl")
keyboard bounds(210,105,440, 95)
image bounds(5, 5, 645, 95), corners(4), outlinecolour(50,50,50), outlinethickness(1) shape("square"), colour(255,255,240), plant("Vibrato")
{
label bounds( 5, 7,120, 12), text("C R A C K L E")
rslider bounds( 5, 27, 64, 64) range(0, 1, 0.2, 0.5, 0.001), channel("CrackleLevel"), text("Level"), textcolour(50,50,50), trackercolour(200,200,150)
rslider bounds( 60, 27, 64, 64) range(10, 10000, 1000, 0.5, 0.001), channel("CrackleDensity"), text("Density"), textcolour(50,50,50), trackercolour(200,200,150)
label bounds(130, 7,110, 12), text("H U M")
rslider bounds(130, 27, 64, 64) range(0, 1, 0.1, 0.5, 0.001), channel("Hum"), text("Level"), textcolour(50,50,50), trackercolour(200,200,150)
checkbox bounds(195, 35, 80, 13), channel("50Hz"), text("50 Hz"), colour:1(205,205,100), value(1), radiogroup(1)
checkbox bounds(195, 50, 80, 13), channel("60Hz"), text("60 Hz"), colour:1(205,205,100), value(0), radiogroup(1)
label bounds(265, 7,110, 12), text("V I B R A T O")
rslider bounds(260, 27, 64, 64) range(1, 8, 4.8, 1, 0.001), channel("VibRate"), text("Rate"), textcolour(50,50,50), trackercolour(200,200,150)
rslider bounds(315, 27, 64, 64) range(0, 1, 0.5, 1, 0.001), channel("VibDepth"), text("Depth"), textcolour(50,50,50), trackercolour(200,200,150)
label bounds(380, 7,110, 12), text("S O U N D")
rslider bounds(385, 27, 64, 64) range(0, 1, 0.5, 1, 0.001), channel("ResNoise"), text("Res/Noise"), textcolour(50,50,50), trackercolour(200,200,150)
label bounds(427, 23, 70, 10), text("T A P E")
checkbox bounds(455, 35, 80, 13), channel("Strip"), text("Strip"), colour:1(205,205,100), value(1), radiogroup(2)
checkbox bounds(455, 50, 80, 13), channel("Loop"), text("Loop"), colour:1(205,205,100), value(0), radiogroup(2)
label bounds(482, 7,110, 12), text("W O W")
rslider bounds(505, 27, 64, 64) range(0, 1, 0.2, 1, 0.001), channel("Wow"), text("Amount"), textcolour(50,50,50), trackercolour(200,200,150)
label bounds(551, 7,110, 12), text("H I S S")
rslider bounds(575, 27, 64, 64) range(0, 1, 0.05, 0.5, 0.001), channel("Hiss"), text("Level"), textcolour(50,50,50), trackercolour(200,200,150)
}
image bounds(5,105, 200, 95), corners(4), outlinecolour(50,50,50), outlinethickness(1) shape("square"), colour(255,255,240), plant("Vibrato")
{
rslider bounds( 8, 20, 64, 64) range(0, 1, 1, 0.5, 0.001), channel("Volume"), text("Volume"), textcolour(50,50,50), trackercolour(200,200,150)
rslider bounds( 68, 20, 64, 64) range(50, 15000, 15000, 0.25, 0.001), channel("Tone"), text("Tone"), textcolour(50,50,50), trackercolour(200,200,150)
rslider bounds(128, 20, 64, 64) range(-2, 2, 0, 1, 0.001), channel("Pitch"), text("Pitch"), textcolour(50,50,50), trackercolour(200,200,150)
}
-n -d -+rtmidi=NULL -M0 -m0d --midi-key-cps=4 --midi-velocity-amp=5
; Initialize the global variables.
ksmps = 32
nchnls = 2
0dbfs = 1
seed 0
giMkIIFlute56 ftgen 56, 0, 4096, 10, 97.080264, 162.878276, 210.241016, 11.273446, 22.318012, 40.701239, 6.916688, 26.106188, 3.348517, 7.261434, 2.534372, 2.687190, 1.088675, 1.944011, 0.457914, 0.966165, 0.953198, 0.673453, 0.632998, 0.852495, 0.287165, 0.289101, 0.271626, 0.238228, 0.202007, 0.243436, 0.215113, 0.187877, 0.195740, 0.173247, 0.216784, 0.149637, 0.131398, 0.127563, 0.124917, 0.154106, 0.146522, 0.146514, 0.116934, 0.114449, 0.122774, 0.126263, 0.119919, 0.130603, 0.110594, 0.098676, 0.074785, 0.080709, 0.086584, 0.086131, 0.078932, 0.079181, 0.083353, 0.073553, 0.087630, 0.088756, 0.086205, 0.077206, 0.072027, 0.069168, 0.064938, 0.067682, 0.085759, 0.083339, 0.076402, 0.075108, 0.086217, 0.090174, 0.081265, 0.074138, 0.079767, 0.076603, 0.077008, 0.071933, 0.070559, 0.072543, 0.073272, 0.070806, 0.066454, 0.066908, 0.071179, 0.068781, 0.064365, 0.060498, 0.064075, 0.073980, 0.077247, 0.076960, 0.081709, 0.083790, 0.079803, 0.075292, 0.074300, 0.077830, 0.083957, 0.086576, 0.080344, 0.075179, 0.075969, 0.073689, 0.068794, 0.065616, 0.066293, 0.066044, 0.062825, 0.065727
giMkIIFlute57 ftgen 57, 0, 4096, 10, 99.061265, 101.234090, 80.417078, 77.401463, 18.463648, 178.856944, 35.658410, 17.528210, 4.366938, 7.701839, 4.887233, 5.893705, 13.016011, 1.950681, 3.209193, 2.812725, 3.696655, 2.076899, 1.881683, 0.938351, 1.575386, 0.521360, 0.509543, 0.589501, 0.227895, 0.183783, 0.210706, 0.187369, 0.236871, 0.166072, 0.151658, 0.133187, 0.171418, 0.147294, 0.155619, 0.125954, 0.106928, 0.113702, 0.085575, 0.111578, 0.109732, 0.093426, 0.078367, 0.077666, 0.076916, 0.072152, 0.070172, 0.068117, 0.073160, 0.076071, 0.072363, 0.080972, 0.075148, 0.064348, 0.074685, 0.075794, 0.088805, 0.089989, 0.073971, 0.068398, 0.076853, 0.073563, 0.071946, 0.068935, 0.067768, 0.068076, 0.070158, 0.065604, 0.064026, 0.067625, 0.067784, 0.068059, 0.062083, 0.056090, 0.060833, 0.071257, 0.071659, 0.066858, 0.065595, 0.069788, 0.072265, 0.067283, 0.061734, 0.062483, 0.062730, 0.057938, 0.054875, 0.058879, 0.062396, 0.060895, 0.060440, 0.060427, 0.058931, 0.059486, 0.060291, 0.056044, 0.053226, 0.049696, 0.046858, 0.045497
giMkIIFlute58 ftgen 58, 0, 4096, 10, 162.953911, 173.190505, 47.802556, 46.958616, 133.157938, 84.126476, 18.925092, 9.305251, 16.761782, 3.599282, 4.731511, 10.546057, 1.334516, 2.551820, 2.109162, 2.869452, 1.798747, 1.318593, 0.789809, 0.635776, 0.412914, 0.590641, 0.441974, 0.326842, 0.186794, 0.270306, 0.198558, 0.200809, 0.235969, 0.224848, 0.187183, 0.194060, 0.169337, 0.183168, 0.165590, 0.164015, 0.162983, 0.191580, 0.164646, 0.147970, 0.111947, 0.138758, 0.158193, 0.146455, 0.119608, 0.110576, 0.114871, 0.109295, 0.109308, 0.098378, 0.107762, 0.116599, 0.114046, 0.089819, 0.092213, 0.093580, 0.090674, 0.090644, 0.086541, 0.085792, 0.092724, 0.090753, 0.090385, 0.088049, 0.095385, 0.095123, 0.088033, 0.089302, 0.081477, 0.079262, 0.088065, 0.096740, 0.097292, 0.092280, 0.097573, 0.099057, 0.099991, 0.099278, 0.092914, 0.086622, 0.080963, 0.085247, 0.096953, 0.097754, 0.094951, 0.094672, 0.096085, 0.109515, 0.112476, 0.107240, 0.090788, 0.081673, 0.077615, 0.077008
giMkIIFlute59 ftgen 59, 0, 4096, 10, 212.778016, 140.187673, 30.010915, 75.566015, 42.259980, 72.478421, 6.839830, 4.333377, 1.655432, 3.811097, 1.864799, 3.086995, 2.370260, 1.864496, 2.062751, 1.437658, 1.655308, 0.529659, 0.368347, 0.226510, 0.231690, 0.187838, 0.211644, 0.164924, 0.179769, 0.256257, 0.203591, 0.195537, 0.185314, 0.171869, 0.144064, 0.148699, 0.116299, 0.104534, 0.098477, 0.081783, 0.071421, 0.098895, 0.096868, 0.080041, 0.076778, 0.100238, 0.083461, 0.107192, 0.094630, 0.121510, 0.110499, 0.091226, 0.113579, 0.120676, 0.105023, 0.102767, 0.103107, 0.088792, 0.100423, 0.100658, 0.104871, 0.101211, 0.095120, 0.083921, 0.093185, 0.109534, 0.119740, 0.102200, 0.102746, 0.105273, 0.105932, 0.098138, 0.096262, 0.092754, 0.087826, 0.090703, 0.088451, 0.100089, 0.111460, 0.107949, 0.102729, 0.103388, 0.102082, 0.094172, 0.091916, 0.095443, 0.103297, 0.106400, 0.098907, 0.083360, 0.078656, 0.080649, 0.078892
giMkIIFlute60 ftgen 60, 0, 4096, 10, 59.712843, 112.632250, 170.523137, 154.033167, 116.590336, 29.192553, 17.639887, 20.877290, 7.286801, 8.997101, 6.596505, 4.189446, 3.133554, 4.511912, 3.053240, 2.207989, 1.872819, 1.734297, 1.000595, 0.575143, 0.477595, 0.372418, 0.328460, 0.258439, 0.219906, 0.202029, 0.175765, 0.163844, 0.188410, 0.146444, 0.159655, 0.147292, 0.107875, 0.128193, 0.147185, 0.139605, 0.117940, 0.089134, 0.094035, 0.091042, 0.087827, 0.086637, 0.077966, 0.082248, 0.058284, 0.050099, 0.069481, 0.069485, 0.061188, 0.057591, 0.054480, 0.059268, 0.063224, 0.060491, 0.058910, 0.053836, 0.054720, 0.059638, 0.073430, 0.072104, 0.068330, 0.057326, 0.054843, 0.056703, 0.058217, 0.056514, 0.057099, 0.051050, 0.055298, 0.055588, 0.055139, 0.055028, 0.053900, 0.054302, 0.053215, 0.055294, 0.055413, 0.051816, 0.053681, 0.053293, 0.046867, 0.042725, 0.042370, 0.040570
giMkIIFlute61 ftgen 61, 0, 4096, 10, 59.944706, 38.379325, 162.695200, 78.441737, 51.966632, 89.311979, 49.158343, 36.616814, 10.646496, 11.829724, 3.950109, 2.726824, 2.298436, 1.893951, 2.243720, 1.252218, 0.646845, 0.569355, 0.331950, 0.178757, 0.217629, 0.157916, 0.095486, 0.118913, 0.098210, 0.123875, 0.115059, 0.096478, 0.072335, 0.076760, 0.081191, 0.090798, 0.095844, 0.073321, 0.056514, 0.061900, 0.062313, 0.058066, 0.068596, 0.062996, 0.055610, 0.049899, 0.057144, 0.063029, 0.075543, 0.076122, 0.075564, 0.076307, 0.068328, 0.055865, 0.053609, 0.058732, 0.064104, 0.065129, 0.066580, 0.068182, 0.070548, 0.066697, 0.064035, 0.075022, 0.087399, 0.077855, 0.074318, 0.066664, 0.067371, 0.076855, 0.077668, 0.077848, 0.072402, 0.068144, 0.070622, 0.068191, 0.063047, 0.061648, 0.067552, 0.062698, 0.058152, 0.056137, 0.054752
giMkIIFlute62 ftgen 62, 0, 4096, 10, 107.883946, 103.776386, 96.014627, 111.252744, 71.357815, 149.004981, 32.984263, 13.047485, 14.143732, 9.044676, 9.674146, 8.904595, 6.342661, 4.775061, 7.597611, 2.417059, 1.677617, 0.903952, 0.721312, 0.590758, 0.341576, 0.202605, 0.318664, 0.267387, 0.267472, 0.242362, 0.264137, 0.207689, 0.179845, 0.120825, 0.095789, 0.099849, 0.106409, 0.081526, 0.082518, 0.102708, 0.075766, 0.080911, 0.077221, 0.080072, 0.075624, 0.070258, 0.068226, 0.073144, 0.076605, 0.080077, 0.066024, 0.069681, 0.069847, 0.068513, 0.071587, 0.075513, 0.073855, 0.074201, 0.079676, 0.076354, 0.071840, 0.068782, 0.072331, 0.080626, 0.078263, 0.073593, 0.072136, 0.076164, 0.072804, 0.073475, 0.075227, 0.077689, 0.071114, 0.062337, 0.065386, 0.061912, 0.058389, 0.057049, 0.058367
giMkIIFlute63 ftgen 63, 0, 4096, 10, 170.158400, 47.412135, 20.879505, 28.265700, 49.469303, 9.898926, 5.314896, 1.512583, 4.477993, 1.891140, 1.061585, 1.764459, 1.138233, 0.639119, 0.644543, 0.167591, 0.202739, 0.101683, 0.123567, 0.109962, 0.120004, 0.079525, 0.097272, 0.075286, 0.075367, 0.073648, 0.073345, 0.067109, 0.065302, 0.078291, 0.077010, 0.061818, 0.073790, 0.058390, 0.068083, 0.071900, 0.073971, 0.079455, 0.067583, 0.075422, 0.076207, 0.065959, 0.064695, 0.084666, 0.099563, 0.094182, 0.084400, 0.084313, 0.075081, 0.072636, 0.079818, 0.084868, 0.096540, 0.087959, 0.088424, 0.079659, 0.086299, 0.079776, 0.092273, 0.082129, 0.076653, 0.085261, 0.080489, 0.072065, 0.076109, 0.083178, 0.083047, 0.082045, 0.075366, 0.073128
giMkIIFlute64 ftgen 64, 0, 4096, 10, 190.497096, 47.559458, 152.872196, 12.189114, 129.681644, 36.210536, 17.282968, 10.969009, 4.018738, 7.353829, 5.000354, 3.350324, 3.634757, 4.557213, 1.621025, 1.128950, 0.427936, 0.466668, 0.286251, 0.151940, 0.180681, 0.185922, 0.176290, 0.159699, 0.121572, 0.116302, 0.128972, 0.104935, 0.114637, 0.108206, 0.090384, 0.120675, 0.093869, 0.091681, 0.071542, 0.093498, 0.090344, 0.083097, 0.087032, 0.088785, 0.087003, 0.090477, 0.096849, 0.095026, 0.108166, 0.103027, 0.084166, 0.091592, 0.082109, 0.081884, 0.087833, 0.075960, 0.068037, 0.074129, 0.073607, 0.072384, 0.078022, 0.077942, 0.081237, 0.075517, 0.070635, 0.071626, 0.073965, 0.068954, 0.057156, 0.055511
giMkIIFlute65 ftgen 65, 0, 4096, 10, 257.586677, 24.039120, 115.533810, 17.941584, 120.047358, 12.751048, 12.878571, 6.227553, 14.023870, 1.398397, 3.334507, 2.394951, 1.427103, 0.695080, 0.211719, 0.142460, 0.186935, 0.113860, 0.146138, 0.131961, 0.108508, 0.101014, 0.109301, 0.096250, 0.106216, 0.074522, 0.093170, 0.099640, 0.122146, 0.094115, 0.089108, 0.098324, 0.087713, 0.099713, 0.102485, 0.082412, 0.094837, 0.097818, 0.086409, 0.081442, 0.085873, 0.093817, 0.095720, 0.097819, 0.087933, 0.103552, 0.104012, 0.084025, 0.106279, 0.093218, 0.086708, 0.088713, 0.098084, 0.090297, 0.090176, 0.093175, 0.097051, 0.100511, 0.085742, 0.084113, 0.081543, 0.079442, 0.079945
giMkIIFlute66 ftgen 66, 0, 4096, 10, 232.954091, 64.115778, 68.023783, 20.203384, 71.395086, 12.654891, 13.023257, 19.252506, 9.212520, 3.666843, 7.605152, 2.240548, 1.099878, 0.429990, 0.284268, 0.349856, 0.278663, 0.159724, 0.175907, 0.150496, 0.152141, 0.154369, 0.107843, 0.131743, 0.131823, 0.119579, 0.088734, 0.119000, 0.113621, 0.101176, 0.090346, 0.063070, 0.075456, 0.097247, 0.069783, 0.072720, 0.070182, 0.067403, 0.085704, 0.074592, 0.070828, 0.081185, 0.082933, 0.076712, 0.070714, 0.066285, 0.067705, 0.075365, 0.069899, 0.072990, 0.075925, 0.081640, 0.076967, 0.071601, 0.076331, 0.070563, 0.060026, 0.051690, 0.049423
giMkIIFlute67 ftgen 67, 0, 4096, 10, 245.433951, 127.913095, 22.986922, 54.448501, 31.800885, 16.185502, 2.438224, 6.825236, 3.270177, 1.596985, 1.073339, 0.394874, 0.217809, 0.165258, 0.252908, 0.132126, 0.128568, 0.104961, 0.083944, 0.114697, 0.082243, 0.103622, 0.087129, 0.091963, 0.089306, 0.083306, 0.074091, 0.067832, 0.086529, 0.080217, 0.077279, 0.082590, 0.083597, 0.069211, 0.082995, 0.082480, 0.072444, 0.082049, 0.080615, 0.081210, 0.078161, 0.093576, 0.087368, 0.089584, 0.102802, 0.087563, 0.093149, 0.088879, 0.080154, 0.077839, 0.080467, 0.083412, 0.084033, 0.075735, 0.070273, 0.067584
giMkIIFlute68 ftgen 68, 0, 4096, 10, 249.958334, 108.478875, 29.347004, 49.624849, 58.833627, 20.572604, 2.705196, 2.335555, 2.337015, 1.891052, 1.123933, 0.480722, 0.418294, 0.259287, 0.202143, 0.191845, 0.213836, 0.191781, 0.160528, 0.143812, 0.176263, 0.126346, 0.107808, 0.100398, 0.084944, 0.093122, 0.085112, 0.081524, 0.064616, 0.087469, 0.079221, 0.085276, 0.075389, 0.064581, 0.077764, 0.090173, 0.099154, 0.077342, 0.073900, 0.074177, 0.091848, 0.082755, 0.074266, 0.072409, 0.060721, 0.066570, 0.062962, 0.070375, 0.076303, 0.075925, 0.063290, 0.064689, 0.067131
giMkIIFlute69 ftgen 69, 0, 4096, 10, 234.261356, 105.610004, 53.384608, 57.065770, 20.133938, 1.323801, 1.710660, 1.667721, 1.756147, 0.514547, 0.275213, 0.224205, 0.121178, 0.100038, 0.105232, 0.092713, 0.084068, 0.091136, 0.076816, 0.066182, 0.063061, 0.088509, 0.079386, 0.080784, 0.083724, 0.070215, 0.062490, 0.071797, 0.073312, 0.073224, 0.081194, 0.069915, 0.097730, 0.073837, 0.078391, 0.081824, 0.091070, 0.087808, 0.104862, 0.091781, 0.099985, 0.097795, 0.076872, 0.070045, 0.074685, 0.075734, 0.067639, 0.073036, 0.063136, 0.060855
giMkIIFlute70 ftgen 70, 0, 4096, 10, 319.642588, 148.025692, 83.450350, 64.300108, 5.047062, 13.695456, 2.129418, 7.812893, 2.496355, 0.565044, 0.455646, 0.365457, 0.250277, 0.223577, 0.231378, 0.192722, 0.148871, 0.100269, 0.093094, 0.080862, 0.091171, 0.083983, 0.068269, 0.071688, 0.084730, 0.058811, 0.058332, 0.061020, 0.077986, 0.061507, 0.058228, 0.059835, 0.065764, 0.065167, 0.071055, 0.054538, 0.060824, 0.071086, 0.063717, 0.071153, 0.064703, 0.060341, 0.067137, 0.072014, 0.058384, 0.049590, 0.049945
giMkIIFlute71 ftgen 71, 0, 4096, 10, 284.870190, 95.062177, 70.880682, 13.140162, 8.275208, 1.570874, 2.007205, 1.318393, 1.315314, 0.343716, 0.211765, 0.148389, 0.105032, 0.079986, 0.135834, 0.099447, 0.106114, 0.091040, 0.096454, 0.092998, 0.083395, 0.081244, 0.084730, 0.081641, 0.087209, 0.078462, 0.060848, 0.077259, 0.085266, 0.095801, 0.081959, 0.084611, 0.083306, 0.084166, 0.081051, 0.082521, 0.093933, 0.072899, 0.075361, 0.081819, 0.075371, 0.071681, 0.066214, 0.063043
giMkIIFlute72 ftgen 72, 0, 4096, 10, 334.531528, 87.517617, 21.539705, 49.386235, 5.476098, 5.706489, 1.237298, 2.844353, 0.571017, 0.260905, 0.157930, 0.166573, 0.133654, 0.131105, 0.138775, 0.127101, 0.130292, 0.122113, 0.126563, 0.125071, 0.132501, 0.142697, 0.156059, 0.103048, 0.120325, 0.115887, 0.105784, 0.104034, 0.095242, 0.104352, 0.087510, 0.093284, 0.094819, 0.092688, 0.085648, 0.097584, 0.099694, 0.104946, 0.093995, 0.084258, 0.080929, 0.080095
giMkIIFlute73 ftgen 73, 0, 4096, 10, 273.540484, 69.468486, 16.287879, 58.678308, 7.407113, 9.054289, 1.521616, 4.940277, 0.335758, 0.600536, 0.187522, 0.102958, 0.130797, 0.107892, 0.121390, 0.093278, 0.069250, 0.093743, 0.095164, 0.090846, 0.072820, 0.070745, 0.081508, 0.072481, 0.095498, 0.072552, 0.080339, 0.081827, 0.080472, 0.075141, 0.100666, 0.096636, 0.083886, 0.073402, 0.069667, 0.064963, 0.075888, 0.064443, 0.054757
giMkIIFlute74 ftgen 74, 0, 4096, 10, 327.192302, 59.018241, 62.499975, 42.943357, 9.659822, 17.014186, 8.558700, 4.690065, 1.125907, 0.824819, 0.340653, 0.202247, 0.229881, 0.113420, 0.129426, 0.116220, 0.095684, 0.102646, 0.083021, 0.079348, 0.075114, 0.070334, 0.062345, 0.068914, 0.062320, 0.052839, 0.065159, 0.062229, 0.061295, 0.058478, 0.066501, 0.056914, 0.061430, 0.055066, 0.056073, 0.054424, 0.058013
giMkIIFlute75 ftgen 75, 0, 4096, 10, 207.257988, 134.824679, 86.696050, 54.739700, 38.182613, 22.500675, 11.512880, 3.523843, 1.065066, 0.467851, 0.274562, 0.283203, 0.130079, 0.099950, 0.080014, 0.087029, 0.064103, 0.084212, 0.062079, 0.081834, 0.070087, 0.074655, 0.069285, 0.077046, 0.069444, 0.076156, 0.078354, 0.077833, 0.072389, 0.072364, 0.072989, 0.078354, 0.064564, 0.059584, 0.052300
giMkIIFlute76 ftgen 76, 0, 4096, 10, 205.445478, 179.837001, 27.193618, 42.804054, 15.930753, 25.444011, 1.983520, 2.340215, 0.677752, 0.544131, 0.306778, 0.162403, 0.232790, 0.172258, 0.107316, 0.108569, 0.089575, 0.102104, 0.080179, 0.087508, 0.065077, 0.064280, 0.059673, 0.051974, 0.056553, 0.066646, 0.060910, 0.056202, 0.058086, 0.057356, 0.057725, 0.060199, 0.045961
giMkIIFlute77 ftgen 77, 0, 4096, 10, 100.850281, 86.050836, 57.886246, 29.729339, 38.386013, 9.783630, 3.828718, 0.671771, 0.340014, 0.154000, 0.077515, 0.076544, 0.080603, 0.066728, 0.062245, 0.059142, 0.058659, 0.055074, 0.049153, 0.048194, 0.046725, 0.053149, 0.051727, 0.047944, 0.050514, 0.049150, 0.049526, 0.043878, 0.047481, 0.044010, 0.035006
giMkIIFlute78 ftgen 78, 0, 4096, 10, 256.665175, 29.168993, 34.848106, 8.664225, 24.089413, 1.732110, 1.079683, 0.425177, 0.448755, 0.419480, 0.250772, 0.156795, 0.133370, 0.090727, 0.082170, 0.085640, 0.067198, 0.064327, 0.073464, 0.062198, 0.063231, 0.076131, 0.061302, 0.068983, 0.065023, 0.061437, 0.073011, 0.071554, 0.057822
giMkIIFlute79 ftgen 79, 0, 4096, 10, 278.766017, 22.812615, 79.723354, 25.234273, 15.790717, 2.904157, 0.668656, 0.491388, 0.303561, 0.341127, 0.143049, 0.155013, 0.094232, 0.091426, 0.083062, 0.067794, 0.069034, 0.070094, 0.072241, 0.076504, 0.053050, 0.056740, 0.056790, 0.058201, 0.056489, 0.057404, 0.052904, 0.044512
giMkIIFlute80 ftgen 80, 0, 4096, 10, 284.351094, 13.644265, 38.215411, 15.709102, 16.491443, 3.458548, 0.518275, 0.277211, 0.308817, 0.121549, 0.109952, 0.084701, 0.090566, 0.100937, 0.069559, 0.058648, 0.063979, 0.076503, 0.057573, 0.053739, 0.061903, 0.052974, 0.054928, 0.065376, 0.055840, 0.047679
giMkIIFlute81 ftgen 81, 0, 4096, 10, 289.850362, 13.809101, 29.159993, 11.595659, 11.817347, 2.080341, 0.342960, 0.118848, 0.089819, 0.072661, 0.079886, 0.067105, 0.069571, 0.061104, 0.056154, 0.052883, 0.047698, 0.065152, 0.060058, 0.060632, 0.067502, 0.067800, 0.059687, 0.052130, 0.047932
giMkIIFlute82 ftgen 82, 0, 4096, 10, 242.739535, 48.829115, 52.380999, 5.088955, 7.578164, 1.854966, 0.728891, 0.344130, 0.201850, 0.154415, 0.096737, 0.084612, 0.073067, 0.074413, 0.064135, 0.060871, 0.053942, 0.060723, 0.056645, 0.051431, 0.057546, 0.053616, 0.045648
giMkIIFlute83 ftgen 83, 0, 4096, 10, 246.676736, 4.537546, 66.910463, 11.221704, 4.772504, 1.377442, 0.340263, 0.187229, 0.112504, 0.104153, 0.057965, 0.082356, 0.082030, 0.073389, 0.055905, 0.070118, 0.063547, 0.071236, 0.070750, 0.066709, 0.059190, 0.047960
giMkIIFlute84 ftgen 84, 0, 4096, 10, 200.814785, 23.418997, 73.064081, 10.324828, 6.759823, 0.694302, 1.288947, 0.389919, 0.232468, 0.091046, 0.088219, 0.048972, 0.057764, 0.048110, 0.043424, 0.041257, 0.046698, 0.051109, 0.042182, 0.045662, 0.038163
giMkIIFlute85 ftgen 85, 0, 4096, 10, 238.608518, 32.741617, 24.167023, 3.990282, 1.746141, 0.263503, 0.104810, 0.061068, 0.095435, 0.064179, 0.071987, 0.066458, 0.070069, 0.061349, 0.052359, 0.059984, 0.064022, 0.058590, 0.055460
giMkIIFlute86 ftgen 86, 0, 4096, 10, 167.251384, 36.127820, 62.113756, 8.100502, 1.566654, 0.366032, 0.277946, 0.161076, 0.100249, 0.090109, 0.055828, 0.047311, 0.053041, 0.050679, 0.047383, 0.036080, 0.045978, 0.035971
giMkIIFlute87 ftgen 87, 0, 4096, 10, 236.087549, 5.202373, 31.686897, 0.651817, 0.606774, 0.165790, 0.138093, 0.072813, 0.081331, 0.057933, 0.082972, 0.082382, 0.070520, 0.080399, 0.076378, 0.067507, 0.063981
giMkIIFlute88 ftgen 88, 0, 4096, 10, 228.302620, 2.572424, 4.492465, 0.346736, 0.459175, 0.195954, 0.177201, 0.120175, 0.065518, 0.062578, 0.048716, 0.038785, 0.041971, 0.039781, 0.035129, 0.033944
giMkIIFlute89 ftgen 89, 0, 4096, 10, 204.450697, 4.819240, 17.659217, 0.591349, 0.964605, 0.125437, 0.145802, 0.041617, 0.043932, 0.044441, 0.038573, 0.042860, 0.038184, 0.038782, 0.032567
; Map MIDI notes played to function tables
giKeyMap ftgen 0, 0, 128, -17, 0,56 , 57,57, 58,58, 59,59, 60,60, 61,61, 62,62, 63,63, 64,64, 65,65, 66,66, 67,67, 68,68, 69,69, 70,70, 71,71, 72,72, 73,73, 74,74, 75,75, 76,76, 77,77, 78,78, 79,79, 80,80, 81,81, 82,82, 83,83, 84,84, 85,85, 86,86, 87,87, 88,88, 89,89
giSine ftgen 0, 0, 4096, 10, 1
gaHum init 0 ; mains hum signal
instr 99
endin
instr 1
; if this is the first note, turn on mains hum
if active:i(p1)==1 then
turnon 2
endif
iCPS cpsmidi ; read in MIDI as a frequency in cycles per second
iNote notnum ; read in note number
iFn table iNote, giKeyMap ; read function table from map
iKybdScale limit (iNote - 55) / (89 - 55), 0, 1 ; keyboard scaling value
iAtt = ((1 - iKybdScale)*0.4)^2 + 0.02 ; derive an attack time (lower notes have a longer attack time)
kBend pchbend 0, 2 ; read in MIDI pitch bend value (range -2 to 2)
if changed:k(kBend)==1 then ; only move widget whenever MIDI pitch bend is moved
chnset kBend, "Pitch" ; update widget
endif
kVolume chnget "Volume"
kTone chnget "Tone"
kPitch chnget "Pitch"
kResNoise chnget "ResNoise"
; Upon note release...
kCPS = iCPS * semitone(kPitch) ; tape glisses down when released
kTone *= expsegr:k(1,0.1,0.01) ; tone cuts off when key is released
; if 'Tape Strip' as opposed to 'Tape Loop' is chosen...
iStrip chnget "Strip"
if iStrip==1 then
if timeinsts:k()>=7.5 then ; if duration of this note exceeds 7.5 seconds (tape strips of the original were between 7 and 8 seconds.
turnoff ; turn this instrument off
kCPS *= expsegr:k(1,0.1,0.1) ; tape glisses down when released
endif
endif
; Vibrato
kModDepth chnget "VibDepth"
kModRate chnget "VibRate"
kVibEnv cosseg 0, 0.7, 2 ; vibrato rises up after the note has begun
;kout vibrato kAverageAmp, kAverageFreq, kRandAmountAmp, kRandAmountFreq, kAmpMinRate, kAmpMaxRate, kcpsMinRate, kcpsMaxRate, ifn [, iphs
kMod vibrato kVibEnv*kModDepth, kModRate, kVibEnv*kModDepth*0.5, kModRate*0.01, kModRate, kModRate, kModRate*0.5, kModRate*2, giSine ;[, iphs
aMod interp kMod ; interpolate to a-rate
iTrmScl = ((1 - iKybdScale) * 2) + 0.5 ; less tremolo for higher notes
aTrm = ampdbfs(aMod * iTrmScl) ; create tremolo function
aVib = cent(aMod * 10) ; create vibrato function
; Wow
kWowDepth chnget "Wow"
aWow rspline 0, kWowDepth, 5 * kWowDepth, 15 * kWowDepth ; Wow function
kCPS *= cent((aWow - kWowDepth) * 20) ; create pitch change aspect of Wow
; Tone
aTone poscil 0.2, kCPS * aVib, iFn ; the main resonant tone
; Wind Noise
aTap streson rand:a(0.03), kCPS, 0.95 ; pass some noise through a string resonator
aTap buthp aTap, iCPS ; highpass filter it to remove components below the fundamental
aTap butlp aTap, limit:i(iCPS*4,20,sr/3) ; lowpass filter it to suppress brightness. Follow above the fundamental but protect against out of range frequency values
aMix tone ntrpol:a(aTone,aTap,kResNoise) * aTrm * 2, kTone ; Crossfade mix between pure tone and noise tone. 'Tone' (lowpass) filter at the same time
aMod poscil 1, kCPS*aVib*2 ; attack modulator
kMix cosseg 0.7, iAtt, 0.7, iAtt, 0 ; attack crossfader
aMix ntrpol aMix, aMix * aMod, kMix ; create attack spectrum
; Tape Hiss
aHiss rand 0.08 * chnget:k("Hiss") ; generate some white noise
aHiss butbp aHiss, 2000, 2000 ; bandpass filter it to remove some high and low frequencies
aMix += aHiss ; add to the main audio signal
; Amplitude Envelope
iEnvAtt = ((1 - iKybdScale) * 0.2) + 0.02 ; shorter attacks for higher notes
aEnv cossegr 0, iEnvAtt, 1, 0.02, 0 ; main amplitude envelope
aMix *= aEnv ; apply envelope
; Crackle
kCrackleMix chnget "CrackleLevel"
kDensity chnget "CrackleDensity"
aCrackle dust2 4 * kCrackleMix, kDensity ; generate crackle according to widget settings
aCrackle butlp aCrackle, 1500 ; lowpass filter the crackling
aMix *= (1 - aCrackle) * kVolume * (1-(gaHum*5)) ; modulate the flute sound using an inversion of the crackling sound and also the hum sound
; Amplitude Wow
aMix *= ampdbfs((aWow-kWowDepth)*9)
; Tone Wow
aCF = cpsoct(13 - (aWow * 5))
aMix tone aMix, aCF
outs aMix, aMix
endin
instr 2 ; Mains hum instrument. Only one iteration of the instrument will ever exist while notes are played.
if active:k(1)==0 then
turnoff
endif
kHum chnget "Hum"
k50Hz chnget "50Hz"
k60Hz chnget "60Hz"
kFreq = k50Hz == 1 ? 50 : 60 ; select 50/60 Hz
aEnv expsegr 0.001, 0.06, 1, 0.03, 0.001
aHum vco2 0.23 * kHum, kFreq, 4, 0.48
aHum buthp aHum, 80
gaHum = aHum * aEnv ; create as global variable so that it can be used in instr 1
outs gaHum, gaHum
endin
;causes Csound to run for about 7000 years...
f 0 z