Blog final
After all classes, I am at the end of submitting my final project. The project is more about what I have learned in class. My purpose of doing this project to show a step by step progress within programming language and platforms. Also, to understand how javascript works and what are main components of Java which allows you to make things happened within your browser and other platforms. Personally, I found java interesting and helpful to understand the logic behind complex structures.
Concept Initial concept of the project was to create a web-based music production system where audience will be able to create their own music and they can use it to perform it live but this idea seems to be a big idea for this class I think this was not possible as I am a starter with JavaScript so I decided to make this idea simple and possible to do so I came up with idea of using some device which I can trigger and use it to produce sound within web browser. where I can generate sound through gestures. and this is my first step towards learning how we can generate sound using body gestural movements. However, gestures can be defined in different ways but typ of gesture which I am using is hand gestures, One of the main reason of using hand gestures is because I am using MYO hand band.
What is MYO
\The Myo armband is a gesture recognition device worn on the forearm and manufactured by Thalmic Labs. The Myo enables the user to control technology wirelessly using various hand motions. It uses a set of electromyographic (EMG) sensors that sense electrical activity in the forearm muscles, combined with a gyroscope, accelerometer, and magnetometer to recognize gestures. The Myo can be used to control video games, presentations, music and visual entertainment. It differs from the Leap Motion device as it is worn rather than a 3D array of cameras that sense motion in the environment.
Process
The process involves 6 weeks in which we start with basic understanding and learning of javascript within webs Brower.
The first week was all about HTML/CSS/JS where we learn basic web system and its architecture
HTML <html>
  <head>     <link rel="stylesheet" type="text/css" href="style.css">  </head>
<body>
  <div id="thing1"></div>   <div id="thing2"></div>   <div id="thing3"></div>   <div id="thing4"></div>   <div id="thing5"></div>
JS
var thing1= document.getElementById('thing'); thing1.onclick=function(){ Â Â Â console.log('clicked');
};
var divs = document.getElementsByTagName('div'); console.log(divs);
//string delimiter fun console.log("hello I'm adam"); console.log('"hello" said adam');
based on this code next 3 weeks were all about adding thing into it such as button and next was click the button to generate sounds. How to use web music API their I learn a new concept of APIs within web browser. Â
after 3 weeks of learning. We get into a new thing which is CHUCK
ChucK is a programming language for real-time sound synthesis and music creation. It is open-source and freely available on MacOS X, Windows, and Linux. ChucK presents a unique time-based, concurrent programming model that's precise and expressive (we call this strongly-timed), dynamic control rates, and the ability to add and modify code on-the-fly. In addition, ChucK supports MIDI, OpenSoundControl, HID device, and multi-channel audio. It's fun and easy to learn, and offers composers, researchers, and performers a powerful programming tool for building and experimenting with complex audio synthesis/analysis programs, and real-time interactive music.
While exploring chuck I learn a lot as I am interested in music and sound and this platform was all about sound so I took advantage of this class and try to build my own sounds.
Such as in chuck there are 3 things common which are
SqrOsc TriOsc SawOsc
And here I tried to merge all these values to see what sound it creates this experiment was pretty much successful Â
SinOsc s => dac;
0.6 => s.gain; 220 => s.freq; 1::second => now;
0.5 => s.gain; 440 => s.freq; 2::second => now;
0.3 => s.gain; 330 => s.freq; 3::second => now;
on the next step I started working on my final project first I decide to my final project within a web browser but unfortunately, I was not able to run MYO with a web browser. Then I decided to my project with another platform which Is processing.
processing which is a java based platform. Which is a really good platform to write the interactive scripts. for the sound part I tried using CHUCK But due to some issues with OSC-I was not able to make my Chuck talk with processing so I ended up using pre-made sound  I found this easy to understand how I put sound in my script.During my process, I also did some experiments with flocking.js which is another javascript library to deal with sound production in the browser. But since I decided not to use web browser so I canât use flocking.js for this purpose.
What is Flocking.js Flocking is a JavaScript audio synthesis framework designed for artists and musicians who are building creative and experimental Web-based sound projects. It runs in Firefox, Chrome, Safari, and Node.js on Mac OS X, Windows, Linux, iOS, and Android. Flocking is different. Its goal is to promote a uniquely community-minded approach to instrument design and composition. In Flocking, unit generators and synths are specified declaratively as JSON, making it easy to save, share, and manipulate your synthesis algorithms. Send your synths via Ajax, save them for later using HTML5 local data storage, or algorithmically produce new instruments on the fly. So is started my final project with importing library
import ddf.minim.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; import ddf.minim.signals.*;
// processing sound library and Myo Library
import de.voidplus.myo.*;
Minim minim;
//minim library object, we will call function of this library using this object.
AudioPlayer play0,play1,play2,play3,play4; Â //this is the variable to produce sound Myo myo;
PImage[] img; boolean[] active;
void setup() { Â size(800, 200); Â background(255);
 myo = new Myo(this);  //lockingPolicy = new String("none");  myo.setLockingPolicy(Myo.LockingPolicy.NONE);  myo.unlock(Myo.Unlock.TIMED);  myo.setFrequency(10);
// loading pre-define gestures from MYO
 img = new PImage[5];  img[0] = loadImage("data/double_tab.png");  img[1] = loadImage("data/spread_fingers.png");  img[2] = loadImage("data/wave_right.png");  img[3] = loadImage("data/wave_left.png");  img[4] = loadImage("data/make_a_fist.png");
 active = new boolean[5];  resetImages();
 minim = new Minim(this);  play0 = minim.loadFile("data/snare1.mp3");  play1 = minim.loadFile("data/martin.mp3");  play2 = minim.loadFile("data/kick.mp3");  play3 = minim.loadFile("data/hip_hop_bass_line.mp3");  play4 = minim.loadFile("data/hihat-open.mp3"); }
void resetImages(){ Â for(int i = 0; i<5; i++){ Â Â active[i] = false; Â } }
void draw() { Â background(255); Â // ...
 for (int i = 0; i<5; i++) {   tint(255, (active[i]) ? 100 : 50);   image(img[i], ((140*i)+(i*10))+30, 30, 140, 140);  } }
void myoOnPose(Device myo, long timestamp, Pose pose) {
 if (!pose.getType().toString().equals("REST")) {   resetImages();  }
 switch (pose.getType()) {  case REST:   // resetImages();   break;  case FIST:   active[4] = true;   myo.vibrate();   play0.loop();   break;  case FINGERS_SPREAD:   myo.vibrate();   active[1] = true;   play1.loop();   break;  case DOUBLE_TAP:   active[0] = true;   myo.vibrate();   play2.loop();   break;  case WAVE_IN:   active[2] = true;   myo.vibrate();   play3.loop();   break;  case WAVE_OUT:   active[3] = true;   myo.vibrate();   play4.loop();   break;  default:   break;  } }
void myoOnLock(Device myo, long timestamp) { Â resetImages(); }
void myoOnUnLock(Device myo, long timestamp) { Â resetImages(); }
so, on every hand gestures, I am generating a sound and this sound is automatically looped in the code so it will play on loop since I am a new user to MYO so I donât have a good command on it but this was fun to use MYO to produce music in this way.
Future Integrations
For future, I would like to explore the same area but adding more features in it such as using MYO with the web browser and doing same music production thing with MYO. But also I am very interested in Playing around with CHUCK and how I can use chuck code in such process. Â Â






