Last Updated: February 25, 2016
·
854
· superuserdo

Man of Steel "Ideal of Hope" theme coded in Timbre.js

http://sudo.sudocoda.com/blog/2013/07/26/supercollider-dot-js-snippet-for-man-of-steel-ideal-of-hope-theme/

ex5 = (function() {
    timbre.utils.exports("atof");

    var synth = T("efx.delay", 150, 0.3);

    function tone(freq) {
    synth.append( T("*", T("+", T("saw", freq, 0.2),
                            T("sin", freq + 2, 0.1)),
                            T("sin", freq, 0.5)));
    if (synth.args.length > 4) synth.args.shift();
    }

var sch = T("schedule", "bpm (375, 2)", [
    [0, tone, [atof("C2")]], [0, tone, [atof("E2")]], [0, tone, [atof("C3")]],
    [1, tone, [atof("F2")]], [1, tone, [atof("E2")]], [1, tone, [atof("G3")]],
    [2, tone, [atof("F2")]], [2, tone, [atof("E2")]], [2, tone, [atof("G3")]],
    [3, tone, [atof("F2")]], [3, tone, [atof("E2")]], [3, tone, [atof("G3")]],
    [4, tone, [atof("F2")]], [4, tone, [atof("E2")]], [4, tone, [atof("G3")]],
    [5, tone, [atof("F2")]], [5, tone, [atof("E2")]], [5, tone, [atof("G3")]],
    [6, tone, [atof("F2")]], [6, tone, [atof("E2")]], [6, tone, [atof("G3")]],
    [7, tone, [atof("F2")]], [7, tone, [atof("E2")]], [7, tone, [atof("F3")]],
    [8, tone, [atof("F2")]], [8, tone, [atof("E2")]], [8, tone, [atof("F3")]],
    [9, tone, [atof("F2")]], [9, tone, [atof("E2")]], [9, tone, [atof("F3")]],
    [10, tone, [atof("F2")]], [10, tone, [atof("E2")]], [10, tone, [atof("F3")]],
    [11, tone, [atof("F2")]], [11, tone, [atof("E2")]], [11, tone, [atof("C3")]],
    [12, tone, [atof("F2")]], [12, tone, [atof("E2")]], [12, tone, [atof("C3")]],
    [13, tone, [atof("C1")]], [13, tone, [atof("E2")]], [13, tone, [atof("E3")]],
    [14, tone, [atof("C1")]], [14, tone, [atof("E2")]], [14, tone, [atof("E3")]],
    [15, tone, [atof("C1")]], [15, tone, [atof("E2")]], [15, tone, [atof("E3")]],
    [16, tone, [atof("C1")]], [16, tone, [atof("E2")]], [16, tone, [atof("E3")]],
    [17, tone, [atof("C1")]], [17, tone, [atof("E2")]], [17, tone, [atof("E3")]],
    [18, tone, [atof("C1")]], [18, tone, [atof("E2")]], [18, tone, [atof("E3")]],
    [19, tone, [atof("C1")]], [19, tone, [atof("E2")]], [19, tone, [atof("E3")]],
    [20, tone, [atof("F2")]], [20, tone, [atof("E2")]], [20, tone, [atof("E3")]],
    [21, tone, [atof("F2")]], [21, tone, [atof("E2")]], [21, tone, [atof("E3")]],
    [22, tone, [atof("F2")]], [22, tone, [atof("E2")]], [22, tone, [atof("E3")]],
    [23, tone, [atof("F2")]], [23, tone, [atof("E2")]], [23, tone, [atof("E3")]],
    [24, tone, [atof("F2")]], [24, tone, [atof("E2")]], [24, tone, [atof("E3")]],
    [25, tone, [atof("F2")]], [25, tone, [atof("E2")]], [25, tone, [atof("C3")]],
    [26, tone, [atof("F2")]], [26, tone, [atof("E2")]], [26, tone, [atof("G3")]],
    [27, tone, [atof("F2")]], [27, tone, [atof("E2")]], [27, tone, [atof("G3")]],
    [28, tone, [atof("F2")]], [28, tone, [atof("E2")]], [28, tone, [atof("G3")]],
    [29, tone, [atof("F2")]], [29, tone, [atof("E2")]], [29, tone, [atof("G3")]],
    [30, tone, [atof("F2")]], [30, tone, [atof("D2")]], [30, tone, [atof("G3")]],
    [31, tone, [atof("F2")]], [31, tone, [atof("D2")]], [31, tone, [atof("G3")]],
    [32, tone, [atof("A2")]], [32, tone, [atof("E2")]], [32, tone, [atof("F3")]],
    [33, tone, [atof("A2")]], [33, tone, [atof("E2")]], [33, tone, [atof("F3")]],
    [34, tone, [atof("A2")]], [34, tone, [atof("E2")]], [34, tone, [atof("F3")]],
    [35, tone, [atof("A2")]], [35, tone, [atof("E2")]], [35, tone, [atof("F3")]],
    [36, tone, [atof("A2")]], [36, tone, [atof("E2")]], [36, tone, [atof("D3")]],
    [37, tone, [atof("A2")]], [37, tone, [atof("E2")]], [37, tone, [atof("D3")]],
    [38, tone, [atof("A2")]], [38, tone, [atof("E2")]], [38, tone, [atof("E3")]],
    [39, tone, [atof("A2")]], [39, tone, [atof("E2")]], [39, tone, [atof("E3")]],
    [40, tone, [atof("A2")]], [40, tone, [atof("E2")]], [40, tone, [atof("E3")]],
    [41, tone, [atof("A2")]], [41, tone, [atof("E2")]], [41, tone, [atof("E3")]],
    [42, tone, [atof("A2")]], [42, tone, [atof("E2")]], [42, tone, [atof("E3")]],
    [43, tone, [atof("A2")]], [43, tone, [atof("E2")]], [43, tone, [atof("E3")]],
    [44, tone, [atof("A2")]], [44, tone, [atof("E2")]], [44, tone, [atof("E3")]],
    [45, tone, [atof("A2")]], [45, tone, [atof("C3")]], [45, tone, [atof("E3")]],
    [46, tone, [atof("A2")]], [46, tone, [atof("C3")]], [46, tone, [atof("E3")]],
    [47, tone, [atof("A2")]], [47, tone, [atof("C3")]], [47, tone, [atof("E3")]],
    [48, tone, [atof("A2")]], [48, tone, [atof("C3")]], [48, tone, [atof("E3")]],
    [49, tone, [atof("A2")]], [49, tone, [atof("C3")]], [49, tone, [atof("E3")]],
    ], true);

synth.onbang = function() {
     sch.bpm += 5;
};

synth.onplay = function() {
    sch.on();
};
synth.onpause = function() {
    sch.off();
};

return synth;
}());