sound API: launching a Csound session,performing a CSD file, getting information from Csound, using multithreading, accessingCsound internal buffers, and playing with score events. The Csound API offers many morepossibilities such channel I/O, callback functions, and MIDI control. Using Python and the Csound API allows themusician-programmer to explore these new territories in realtime.
References
[1] Fernando Perez, Brian E. Granger, "IPython: A System for Interactive Scientific Computing," Computing in Science and Engineering, vol. 9, no. 3, pp. 21-29, May/June 2007.
[2] Python Software Foundation, The Python Tutorial, Release 2.7, December 28, 2010.
[3] Richard Boulanger, An Instrument Design TOOTorial, Boston, Massachusetts, March, 1991.
[4] Barry Vercoe et Al. 2005. The Canonical Csound Reference Manual.. [Accessed Dec. 27, 2010].
[5] Iannis Xenakis, FORMALIZED MUSIC: Thought and Mathematics inMusic, Pendragon Revised Edition, Pendragon Press, 1992.
Links
An Instrument Design TOOTorial
Writing your own.csd files// to Do
// - accept user input to go to Date
// - accept anothe input for event.loop


"use strict";
function Cal(el) {
  let months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
  let weekDays = ["So", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
  let today = new Date();
  let calendar = {};
  // accept HTMLElement or Selector
  if (el instanceof HTMLElement) {
    calendar.wrapper = el;
  } else {
    calendar.wrapper = document.querySelector(el);
  }
  if (!calendar.wrapper) {
    console.log("Calendar Error: Invalid Selector or Element!");
    return false;
  }
  calendar.wrapper.classList.add("calendar-wrapper");
  /*   by Default the first day of the week is Monday  */
  calendar.firstDayInTheWeek = 1;   
  calendar.date = today;
  calendar.events = [];
  calendar.specialClasses = [];
  /* give today's Date a special class */
  setDayClass({ date: today, class: "today" });
  renderCalendar();
  let cal = {
    el: _=> calendar.wrapper,
    refresh: _ => {
        calendar.builded = false;
        renderCalendar()
    },
    prevMonth: _ => goToMonth("prev"),
    nextMonth: _ => goToMonth("next"),
    setFirstDayInTheWeek: n => {
      if (isNaN(n) || n>6 || n<0) return;
      calendar.firstDayInTheWeek = n;
      calendar.builded= false;
      renderCalendar();
    },
    addEvent: (obj, refresh )=> {
      let id = addEvent(obj);
      if (refresh) renderCalendar();
      return id;
    },
    removeEvent: (ids, refresh) => {
      removeEvent(ids);
      if (refresh) renderCalendar();
    },
    clearEvents: (refresh) => {
      calendar.events = [];
      if (refresh) renderCalendar();
    },
    setDayClass: (obj,refresh) => {
      setDayClass(obj);
      if (refresh) renderCalendar();
    },
    removeSpecialDayClass: (obj, refresh) => {
      removeSpecialDayClass(obj);
      if (refresh) renderCalendar();
    },
    clearAllSpecialClasses: (refresh) => {
      calendar.specialClasses = [];
      if (refresh) renderCalendar();
    },
    goToDate: goToDate
  };

  return cal;

  function renderCalendar() {
    if(calendar.builded==true) {
        updateMonthName();
        calendar.wrapper.removeChild(calendar.daysWrapper);
    } else {
        calendar.wrapper.innerHTML = "";
        fillMonthName();
        fillDaysNames();
    }
    updateDays();
    fillDays();
  }

  function goToDate(d) {
    let dt = checkDate(d);
    if (dt) {
      calendar.date = dt;
      renderCalendar();
    }
  }

  function goToMonth(dir) {
    let M = calendar.date.getMonth();
    let d = dir == "next"? M + 1 : dir == "prev"? M - 1 : null;
    if (d === null) return;
    calendar.date = new Date(calendar.date.getFullYear(), d, 1);
    renderCalendar();
  }

  function updateDays() {
    let date = calendar.date;
    let thisYear = date.getFullYear();
    let thisMonth = date.getMonth();
    let thisMonthLength = (new Date( thisYear, thisMonth + 1, 0 )).getDate();
    let lastMonthLength = (new Date( thisYear, thisMonth, 0 )).getDate();
    let firstDayInMonth = (new Date( thisYear, thisMonth, 1 )).getDay();
    if (firstDayInMonth - calendar.firstDayInTheWeek >= 0) {
      firstDayInMonth = firstDayInMonth - calendar.firstDayInTheWeek;
    } else {
      firstDayInMonth = 7 + firstDayInMonth - calendar.firstDayInTheWeek;
    }
    let days = [];
    // fill days from the previous month
    for (let i = firstDayInMonth; i > 0; i--) {
      days.push({
        day: lastMonthLength - i + 1,
        month: thisMonth - 1 < 0? 11 : thisMonth - 1,
        year: thisMonth!== 0? thisYear : thisYear - 1,
        class: "prev-month"
      });
    }
    // fill current month days
    for (let i = 1; i <= thisMonthLength; i++) {
      days.push({
        day: i,
        month: thisMonth,
        year: thisYear,
        class: "this-month"
      });
    }
    // fill days from the previous month
    for (let i = 0; i < days.length % 7; i++) {
      days.push({
        day: i + 1,
        month: (thisMonth + 1) % 12,
        year: thisMonth!== 11? thisYear : thisYear + 1,
        class: "next-month"
      });
    }
    calendar.days = days;
  }

  function fillMonthName() {
    let div = document.createElement("div");
    div.classList.add("month-name-wrapper");
    let btn_prev = document.createElement("button");
    let btn_next = document.createElement("button");
    let text = document.createElement("span");
    btn_prev.innerText = "prev";
    btn_prev.classList.add("btn-prev-month");
    btn_next.classList.add("btn-next-month");
    btn_next.innerText = "next";
    div.appendChild(btn_prev);
    div.appendChild(text);
    div.appendChild(btn_next);
    calendar.wrapper.appendChild(div);
    btn_next.addEventListener("click", _ => goToMonth("next"));
    btn_prev.addEventListener("click", _ => goToMonth("prev"));
    calendar.monthName = text;
    updateMonthName();
    calendar.builded = true;
  }

  function updateMonthName(){
    calendar.monthName.innerHTML = months[calendar.date.getMonth()] + " / " + calendar.date.getFullYear();
  }

  function fillDaysNames() {
    let div = document.createElement("div");
    div.classList.add("days-names-wrapper");
    let j = calendar.firstDayInTheWeek;
    for (let i = 0; i < 7; i++) {
      let day = document.createElement("div");
      day.classList.add("day-name");
      day.innerHTML = weekDays[j];
      div.appendChild(day);
      if (j >= 6) {
        j = 0;
      } else {
        j++;
      }
    }
    calendar.daysNameWrapper = div;
    calendar.wrapper.appendChild(div);
  }

  function fillDays() {
    let div = document.createElement("div");
    div.classList.add("days-wrapper");
    for