Skip to content
This repository has been archived by the owner on Jun 9, 2019. It is now read-only.

I discover #60

Open
manudahmen opened this issue Mar 13, 2016 · 0 comments
Open

I discover #60

manudahmen opened this issue Mar 13, 2016 · 0 comments

Comments

@manudahmen
Copy link

I discorver this project last night, and I have a question

  1. How do the T object terminates its flow?
  2. How to make noise disappear?

Here is my source code:

var tempo = 120;
function metroBeatsSeconds(seconds) {
    tempo = seconds;
    timbre.bpm = seconds;
}

/**
 * Created by manuel on 13-03-16.
 */
function freqSon(ecartTon)
{
    var BaseLa4 = 440;
var factTon = Math.pow(2,1/6);
return BaseLa4 * Math.pow(factTon, ecartTon);



}
function note(param, length)
{
    var fre = freqSon(noteTrans(param, length));
    console.log("Note" + param, " \nDurée (en temps de mesure): " + (length * 1000 / partFractDenominateur()) + "ms (" + (length / timbre.bpm / 60 * 1000) + "ms\n");
    T("sin", {freq: fre, mul: 100, timeout: "" + (length * 1000 / timbre.bpm) + "ms"}).play();

}

/***
 * ex; do4 , 1
 * ex: so4 , 1
 */
function noteTrans(note, length) {
    switch(note.substring(0, 2))
 {
    case "do":
        param = 0;
        break;
    case "re":
        param = 1;
        break;
    case "mi":
        param = 2;
        break;
    case "fa":
        param = 2.5;
        break;
    case "so":
        param = 3.5;
        break;
    case "la":
        param = 4.5;
        break;
    case "si":
        param = 5.5;
        break;
    }
    octave = note.substring(2,3);

var ecart = param+6*octave - 4.5 + 6 * 4; //ParRapprtLa440 en tons + -> aigu - -> grave

return ecart;
}

function silence(length)
{
}



//And the "score" file: 

function part1() {
    metroBeatsSeconds(120);
    note("do4", 1);
    note("re4", 1);
    note("mi4", 1);
    note("fa4", 1);
    note("sol4", 1);
    note("la4", 1);
    note("si4", 1);
    note("do5", 1);
}
function partFractDenominateur() {
    return 4;
}
function partFractNumerateur() {
    return 2;
}
function part1_stop() {
    T.stop();
}

I really want to get involved in this project. I have a question 💯 Do you have Javascript code generator?

https://gitlab.com/mdahmen/Laterreestron.de.git

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant