<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rkolhe</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rkolhe"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Rkolhe"/>
	<updated>2026-09-16T02:55:58Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=121276</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=121276"/>
		<updated>2018-12-08T01:12:20Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''== &lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode). Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Design'''==&lt;br /&gt;
Our design and plan of work is split into two set of tasks- Initial steps and Subsequent steps.&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps'''===&lt;br /&gt;
* To create a new example program- media/examples/oscillator.rs that exercises the different oscillator types&lt;br /&gt;
* To implement the processing algorithm for the different oscillator types like Sine, Square, Sawtooth, Triangle and a Custom wave based on user's input in media/audio/src/oscillator_node.rs so that the example programs in media/examples/oscillator.rs sound correct.&lt;br /&gt;
* To implement the missing ConstantSource node type in a new constant_source.rs file in the directory media/audio/src that produces a constant tone based a stored value that can be modified.&lt;br /&gt;
* To create the DOM interface for ConstantSourceNode and implement the createConstantSource API for BaseAudioContext&lt;br /&gt;
* To connect the DOM interface to the underlying backend node by processing the unimplemented message type.&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps'''===&lt;br /&gt;
* To implement the backend for StereoPannerNode in the media crate by creating a new node. To create a runnable example for the same.&lt;br /&gt;
* To create the DOM interface for StereoPannerNode and implement the createStereoPannerNode API for BaseAudioContext&lt;br /&gt;
* To create the DOM interface for IIRFilterNode and implement the createIIRFilterNode API for BaseAudioContext.&lt;br /&gt;
* To implement the backend for IIRFilterNode based on the specification's processing model and create a runnable example&lt;br /&gt;
&lt;br /&gt;
[[File:initialsteps.png]]&lt;br /&gt;
[[File:Subsequentsteps.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Files (to be) modified'''==&lt;br /&gt;
* media/audio/src/oscillator_node.rs&lt;br /&gt;
* media/audio/src/constant_source_node.rs&lt;br /&gt;
* media/audio/src/node.rs&lt;br /&gt;
* media/audio/src/lib.rs&lt;br /&gt;
* media/audio/src/render_thread.rs&lt;br /&gt;
* media/audio/src/param.rs&lt;br /&gt;
* media/examples/oscillator.rs&lt;br /&gt;
* media/examples/constant_source.rs&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
Our current implementation involves audio processing for Sine, Square, Sawtooth and Triangle waveforms and we are working on generating the Custom wave. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
The following changes have been done in the &amp;lt;code&amp;gt;oscillator_node.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;audio/src/&amp;lt;/code&amp;gt; directory where the function to generate the waveforms is written&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt; oscillator.rs &amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;media/examples/ &amp;lt;/code&amp;gt; directory has been created by us which generates objects and calls methods to run the different oscillator type examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
extern crate servo_media;&lt;br /&gt;
&lt;br /&gt;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorNodeOptions;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Sawtooth;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Triangle;&lt;br /&gt;
//use servo_media::audio::oscillator_node::OscillatorType::Sine;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Custom;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Square;&lt;br /&gt;
use servo_media::ServoMedia;&lt;br /&gt;
use std::sync::Arc;&lt;br /&gt;
use std::{thread, time};&lt;br /&gt;
&lt;br /&gt;
fn run_example(servo_media: Arc&amp;lt;ServoMedia&amp;gt;) {&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let mut options = OscillatorNodeOptions::default();&lt;br /&gt;
    let osc1 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc1.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc1,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Square;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc2 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc2.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc2,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Sawtooth;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc3 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc3.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc3,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Triangle;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc4 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc4.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc4,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Custom;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc5 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc5.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc5,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fn main() {&lt;br /&gt;
    if let Ok(servo_media) = ServoMedia::get() {&lt;br /&gt;
        run_example(servo_media);&lt;br /&gt;
    } else {&lt;br /&gt;
        unreachable!();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
We created the &amp;lt;code&amp;gt;constant_source_node.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;audio/src/&amp;lt;/code&amp;gt; directory which has the function to generate a constant tone&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use block::Chunk;&lt;br /&gt;
use block::Tick;&lt;br /&gt;
use node::{AudioNodeEngine, AudioScheduledSourceNodeMessage, OnEndedCallback};&lt;br /&gt;
use node::BlockInfo;&lt;br /&gt;
use node::{AudioNodeType, ChannelInfo, ShouldPlay};&lt;br /&gt;
use param::{Param, ParamType};&lt;br /&gt;
&lt;br /&gt;
#[derive(Copy, Clone, Debug)]&lt;br /&gt;
pub struct ConstantSourceNodeOptions {&lt;br /&gt;
    pub offset: f32,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl Default for ConstantSourceNodeOptions {&lt;br /&gt;
    fn default() -&amp;gt; Self {&lt;br /&gt;
        ConstantSourceNodeOptions { offset: 1. }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#[derive(AudioScheduledSourceNode,AudioNodeCommon)]&lt;br /&gt;
pub(crate) struct ConstantSourceNode {&lt;br /&gt;
    channel_info: ChannelInfo,&lt;br /&gt;
    offset: Param,&lt;br /&gt;
    start_at: Option&amp;lt;Tick&amp;gt;,&lt;br /&gt;
    stop_at: Option&amp;lt;Tick&amp;gt;,&lt;br /&gt;
    onended_callback: Option&amp;lt;OnEndedCallback&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl ConstantSourceNode {&lt;br /&gt;
    pub fn new(options: ConstantSourceNodeOptions, channel_info: ChannelInfo) -&amp;gt; Self {&lt;br /&gt;
        Self {&lt;br /&gt;
            channel_info,&lt;br /&gt;
            offset: Param::new(options.offset.into()),&lt;br /&gt;
            start_at: None,&lt;br /&gt;
            stop_at: None,&lt;br /&gt;
            onended_callback: None,&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pub fn update_parameters(&amp;amp;mut self, info: &amp;amp;BlockInfo, tick: Tick) -&amp;gt; bool {&lt;br /&gt;
        self.offset.update(info, tick)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl AudioNodeEngine for ConstantSourceNode {&lt;br /&gt;
    fn node_type(&amp;amp;self) -&amp;gt; AudioNodeType {&lt;br /&gt;
        AudioNodeType::ConstantSourceNode&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    fn process(&amp;amp;mut self, mut inputs: Chunk, info: &amp;amp;BlockInfo) -&amp;gt; Chunk {&lt;br /&gt;
&lt;br /&gt;
        debug_assert!(inputs.len() == 0);&lt;br /&gt;
&lt;br /&gt;
        inputs.blocks.push(Default::default());&lt;br /&gt;
&lt;br /&gt;
        let (start_at, stop_at) = match self.should_play_at(info.frame) {&lt;br /&gt;
            ShouldPlay::No =&amp;gt; {&lt;br /&gt;
                return inputs;&lt;br /&gt;
            }&lt;br /&gt;
            ShouldPlay::Between(start, end) =&amp;gt; (start, end),&lt;br /&gt;
        };&lt;br /&gt;
&lt;br /&gt;
        {&lt;br /&gt;
            inputs.blocks[0].explicit_silence();&lt;br /&gt;
&lt;br /&gt;
            let mut iter = inputs.blocks[0].iter();&lt;br /&gt;
            let mut offset = self.offset.value();&lt;br /&gt;
            while let Some(mut frame) = iter.next() {&lt;br /&gt;
                let tick = frame.tick();&lt;br /&gt;
                if tick &amp;lt; start_at {&lt;br /&gt;
                    continue;&lt;br /&gt;
                } else if tick &amp;gt; stop_at {&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
                if self.update_parameters(info, frame.tick()) {&lt;br /&gt;
                    offset = self.offset.value();&lt;br /&gt;
                }&lt;br /&gt;
                frame.mutate_with(|sample, _| *sample = offset);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        inputs&lt;br /&gt;
    }&lt;br /&gt;
    fn input_count(&amp;amp;self) -&amp;gt; u32{&lt;br /&gt;
        0&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    fn get_param(&amp;amp;mut self, id: ParamType) -&amp;gt; &amp;amp;mut Param {&lt;br /&gt;
        match id {&lt;br /&gt;
            ParamType::Offset =&amp;gt; &amp;amp;mut self.offset,&lt;br /&gt;
            _ =&amp;gt; panic!(&amp;quot;Unknown param {:?} for the offset&amp;quot;, id),&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    make_message_handler!(AudioScheduledSourceNode: handle_source_node_message);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We created the &amp;lt;code&amp;gt;constant_source.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;examples/&amp;lt;/code&amp;gt; directory which realizes the implementation of Constant Source Node&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
extern crate servo_media;&lt;br /&gt;
&lt;br /&gt;
use servo_media::audio::constant_source_node::ConstantSourceNodeOptions;&lt;br /&gt;
use servo_media::audio::gain_node::GainNodeOptions;&lt;br /&gt;
use servo_media::audio::param::{ParamType, RampKind, UserAutomationEvent};&lt;br /&gt;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};&lt;br /&gt;
use servo_media::ServoMedia;&lt;br /&gt;
use std::sync::Arc;&lt;br /&gt;
use std::{thread, time};&lt;br /&gt;
&lt;br /&gt;
fn run_example(servo_media: Arc&amp;lt;ServoMedia&amp;gt;) {&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
&lt;br /&gt;
    let mut cs_options = ConstantSourceNodeOptions::default();&lt;br /&gt;
    cs_options.offset = 0.;&lt;br /&gt;
    let cs = context.create_node(&lt;br /&gt;
        AudioNodeInit::ConstantSourceNode(cs_options.clone()),&lt;br /&gt;
        Default::default(),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    let mut gain_options = GainNodeOptions::default();&lt;br /&gt;
    gain_options.gain = 0.1;&lt;br /&gt;
    let gain = context.create_node(&lt;br /&gt;
&lt;br /&gt;
        AudioNodeInit::GainNode(gain_options.clone()),&lt;br /&gt;
&lt;br /&gt;
        Default::default(),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    let osc = context.create_node(&lt;br /&gt;
       AudioNodeInit::OscillatorNode(Default::default()),&lt;br /&gt;
       Default::default(),&lt;br /&gt;
   );&lt;br /&gt;
&lt;br /&gt;
   context.connect_ports(osc.output(0), gain.input(0));&lt;br /&gt;
   context.connect_ports(cs.output(0), gain.param(ParamType::Gain));&lt;br /&gt;
   context.connect_ports(gain.output(0), dest.input(0));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
&lt;br /&gt;
        gain,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 1., 1.5),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 0.1, 3.0),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 1., 4.5),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 0.1, 6.0),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(9000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fn main() {&lt;br /&gt;
    if let Ok(servo_media) = ServoMedia::get() {&lt;br /&gt;
        run_example(servo_media);&lt;br /&gt;
    } else {&lt;br /&gt;
        unreachable!();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&amp;lt;strong&amp;gt;12/07-  A Servo team member (@ferjm: Fernando Jimenez Moreno) &amp;lt;b&amp;gt;merged&amp;lt;/b&amp;gt; the pull request (#164)&amp;lt;/strong&amp;gt;&lt;br /&gt;
[[File:merged164-2.png]]&lt;br /&gt;
&lt;br /&gt;
12/06- Completed the changes stated in the review for Constant Source Node example. The updated pull request can be accessed via [https://github.com/servo/media/pull/164 here]&lt;br /&gt;
&lt;br /&gt;
11/9- The formatted changes have been committed as said in the review.The changes to the formatting can be seen [https://github.com/Avanthikaa/media/commit/5d8cdfc029daf69122c64f8bfcceaec6f80916a4 here]&lt;br /&gt;
&lt;br /&gt;
[[File:format_commit.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Running a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
4) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./constant_source&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=121263</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=121263"/>
		<updated>2018-12-08T00:57:50Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''== &lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode). Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Design'''==&lt;br /&gt;
Our design and plan of work is split into two set of tasks- Initial steps and Subsequent steps.&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps'''===&lt;br /&gt;
* To create a new example program- media/examples/oscillator.rs that exercises the different oscillator types&lt;br /&gt;
* To implement the processing algorithm for the different oscillator types like Sine, Square, Sawtooth, Triangle and a Custom wave based on user's input in media/audio/src/oscillator_node.rs so that the example programs in media/examples/oscillator.rs sound correct.&lt;br /&gt;
* To implement the missing ConstantSource node type in a new constant_source.rs file in the directory media/audio/src that produces a constant tone based a stored value that can be modified.&lt;br /&gt;
* To create the DOM interface for ConstantSourceNode and implement the createConstantSource API for BaseAudioContext&lt;br /&gt;
* To connect the DOM interface to the underlying backend node by processing the unimplemented message type.&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps'''===&lt;br /&gt;
* To implement the backend for StereoPannerNode in the media crate by creating a new node. To create a runnable example for the same.&lt;br /&gt;
* To create the DOM interface for StereoPannerNode and implement the createStereoPannerNode API for BaseAudioContext&lt;br /&gt;
* To create the DOM interface for IIRFilterNode and implement the createIIRFilterNode API for BaseAudioContext.&lt;br /&gt;
* To implement the backend for IIRFilterNode based on the specification's processing model and create a runnable example&lt;br /&gt;
&lt;br /&gt;
[[File:initialsteps.png]]&lt;br /&gt;
[[File:Subsequentsteps.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Files (to be) modified'''==&lt;br /&gt;
* media/audio/src/oscillator_node.rs&lt;br /&gt;
* media/audio/src/constant_source_node.rs&lt;br /&gt;
* media/audio/src/node.rs&lt;br /&gt;
* media/audio/src/lib.rs&lt;br /&gt;
* media/audio/src/render_thread.rs&lt;br /&gt;
* media/audio/src/param.rs&lt;br /&gt;
* media/examples/oscillator.rs&lt;br /&gt;
* media/examples/constant_source.rs&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
Our current implementation involves audio processing for Sine, Square, Sawtooth and Triangle waveforms and we are working on generating the Custom wave. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
The following changes have been done in the &amp;lt;code&amp;gt;oscillator_node.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;audio/src/&amp;lt;/code&amp;gt; directory where the function to generate the waveforms is written&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt; oscillator.rs &amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;media/examples/ &amp;lt;/code&amp;gt; directory has been created by us which generates objects and calls methods to run the different oscillator type examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
extern crate servo_media;&lt;br /&gt;
&lt;br /&gt;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorNodeOptions;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Sawtooth;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Triangle;&lt;br /&gt;
//use servo_media::audio::oscillator_node::OscillatorType::Sine;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Custom;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Square;&lt;br /&gt;
use servo_media::ServoMedia;&lt;br /&gt;
use std::sync::Arc;&lt;br /&gt;
use std::{thread, time};&lt;br /&gt;
&lt;br /&gt;
fn run_example(servo_media: Arc&amp;lt;ServoMedia&amp;gt;) {&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let mut options = OscillatorNodeOptions::default();&lt;br /&gt;
    let osc1 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc1.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc1,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Square;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc2 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc2.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc2,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Sawtooth;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc3 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc3.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc3,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Triangle;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc4 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc4.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc4,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Custom;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc5 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc5.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc5,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fn main() {&lt;br /&gt;
    if let Ok(servo_media) = ServoMedia::get() {&lt;br /&gt;
        run_example(servo_media);&lt;br /&gt;
    } else {&lt;br /&gt;
        unreachable!();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
We created the &amp;lt;code&amp;gt;constant_source_node.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;audio/src/&amp;lt;/code&amp;gt; directory which has the function to generate a constant tone&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use block::Chunk;&lt;br /&gt;
use block::Tick;&lt;br /&gt;
use node::{AudioNodeEngine, AudioScheduledSourceNodeMessage, OnEndedCallback};&lt;br /&gt;
use node::BlockInfo;&lt;br /&gt;
use node::{AudioNodeType, ChannelInfo, ShouldPlay};&lt;br /&gt;
use param::{Param, ParamType};&lt;br /&gt;
&lt;br /&gt;
#[derive(Copy, Clone, Debug)]&lt;br /&gt;
pub struct ConstantSourceNodeOptions {&lt;br /&gt;
    pub offset: f32,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl Default for ConstantSourceNodeOptions {&lt;br /&gt;
    fn default() -&amp;gt; Self {&lt;br /&gt;
        ConstantSourceNodeOptions { offset: 1. }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#[derive(AudioScheduledSourceNode,AudioNodeCommon)]&lt;br /&gt;
pub(crate) struct ConstantSourceNode {&lt;br /&gt;
    channel_info: ChannelInfo,&lt;br /&gt;
    offset: Param,&lt;br /&gt;
    start_at: Option&amp;lt;Tick&amp;gt;,&lt;br /&gt;
    stop_at: Option&amp;lt;Tick&amp;gt;,&lt;br /&gt;
    onended_callback: Option&amp;lt;OnEndedCallback&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl ConstantSourceNode {&lt;br /&gt;
    pub fn new(options: ConstantSourceNodeOptions, channel_info: ChannelInfo) -&amp;gt; Self {&lt;br /&gt;
        Self {&lt;br /&gt;
            channel_info,&lt;br /&gt;
            offset: Param::new(options.offset.into()),&lt;br /&gt;
            start_at: None,&lt;br /&gt;
            stop_at: None,&lt;br /&gt;
            onended_callback: None,&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pub fn update_parameters(&amp;amp;mut self, info: &amp;amp;BlockInfo, tick: Tick) -&amp;gt; bool {&lt;br /&gt;
        self.offset.update(info, tick)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl AudioNodeEngine for ConstantSourceNode {&lt;br /&gt;
    fn node_type(&amp;amp;self) -&amp;gt; AudioNodeType {&lt;br /&gt;
        AudioNodeType::ConstantSourceNode&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    fn process(&amp;amp;mut self, mut inputs: Chunk, info: &amp;amp;BlockInfo) -&amp;gt; Chunk {&lt;br /&gt;
&lt;br /&gt;
        debug_assert!(inputs.len() == 0);&lt;br /&gt;
&lt;br /&gt;
        inputs.blocks.push(Default::default());&lt;br /&gt;
&lt;br /&gt;
        let (start_at, stop_at) = match self.should_play_at(info.frame) {&lt;br /&gt;
            ShouldPlay::No =&amp;gt; {&lt;br /&gt;
                return inputs;&lt;br /&gt;
            }&lt;br /&gt;
            ShouldPlay::Between(start, end) =&amp;gt; (start, end),&lt;br /&gt;
        };&lt;br /&gt;
&lt;br /&gt;
        {&lt;br /&gt;
            inputs.blocks[0].explicit_silence();&lt;br /&gt;
&lt;br /&gt;
            let mut iter = inputs.blocks[0].iter();&lt;br /&gt;
            let mut offset = self.offset.value();&lt;br /&gt;
            while let Some(mut frame) = iter.next() {&lt;br /&gt;
                let tick = frame.tick();&lt;br /&gt;
                if tick &amp;lt; start_at {&lt;br /&gt;
                    continue;&lt;br /&gt;
                } else if tick &amp;gt; stop_at {&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
                if self.update_parameters(info, frame.tick()) {&lt;br /&gt;
                    offset = self.offset.value();&lt;br /&gt;
                }&lt;br /&gt;
                frame.mutate_with(|sample, _| *sample = offset);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        inputs&lt;br /&gt;
    }&lt;br /&gt;
    fn input_count(&amp;amp;self) -&amp;gt; u32{&lt;br /&gt;
        0&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    fn get_param(&amp;amp;mut self, id: ParamType) -&amp;gt; &amp;amp;mut Param {&lt;br /&gt;
        match id {&lt;br /&gt;
            ParamType::Offset =&amp;gt; &amp;amp;mut self.offset,&lt;br /&gt;
            _ =&amp;gt; panic!(&amp;quot;Unknown param {:?} for the offset&amp;quot;, id),&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    make_message_handler!(AudioScheduledSourceNode: handle_source_node_message);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We created the &amp;lt;code&amp;gt;constant_source.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;examples/&amp;lt;/code&amp;gt; directory which realizes the implementation of Constant Source Node&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
extern crate servo_media;&lt;br /&gt;
&lt;br /&gt;
use servo_media::audio::constant_source_node::ConstantSourceNodeOptions;&lt;br /&gt;
use servo_media::audio::gain_node::GainNodeOptions;&lt;br /&gt;
use servo_media::audio::param::{ParamType, RampKind, UserAutomationEvent};&lt;br /&gt;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};&lt;br /&gt;
use servo_media::ServoMedia;&lt;br /&gt;
use std::sync::Arc;&lt;br /&gt;
use std::{thread, time};&lt;br /&gt;
&lt;br /&gt;
fn run_example(servo_media: Arc&amp;lt;ServoMedia&amp;gt;) {&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
&lt;br /&gt;
    let mut cs_options = ConstantSourceNodeOptions::default();&lt;br /&gt;
    cs_options.offset = 0.;&lt;br /&gt;
    let cs = context.create_node(&lt;br /&gt;
        AudioNodeInit::ConstantSourceNode(cs_options.clone()),&lt;br /&gt;
        Default::default(),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    let mut gain_options = GainNodeOptions::default();&lt;br /&gt;
    gain_options.gain = 0.1;&lt;br /&gt;
    let gain = context.create_node(&lt;br /&gt;
&lt;br /&gt;
        AudioNodeInit::GainNode(gain_options.clone()),&lt;br /&gt;
&lt;br /&gt;
        Default::default(),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    let osc = context.create_node(&lt;br /&gt;
       AudioNodeInit::OscillatorNode(Default::default()),&lt;br /&gt;
       Default::default(),&lt;br /&gt;
   );&lt;br /&gt;
&lt;br /&gt;
   context.connect_ports(osc.output(0), gain.input(0));&lt;br /&gt;
   context.connect_ports(cs.output(0), gain.param(ParamType::Gain));&lt;br /&gt;
   context.connect_ports(gain.output(0), dest.input(0));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
&lt;br /&gt;
        gain,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 1., 1.5),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 0.1, 3.0),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 1., 4.5),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 0.1, 6.0),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(9000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fn main() {&lt;br /&gt;
    if let Ok(servo_media) = ServoMedia::get() {&lt;br /&gt;
        run_example(servo_media);&lt;br /&gt;
    } else {&lt;br /&gt;
        unreachable!();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&amp;lt;strong&amp;gt;12/07-  A Servo team member (@ferjm: Fernando Jimenez Moreno) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request (#164)&amp;lt;/strong&amp;gt;&lt;br /&gt;
[[File:merged164-2.png]]&lt;br /&gt;
&lt;br /&gt;
12/06- Completed the changes stated in the review for Constant Source Node example. The updated pull request can be accessed via [https://github.com/servo/media/pull/164 here]&lt;br /&gt;
&lt;br /&gt;
11/9- The formatted changes have been committed as said in the review.The changes to the formatting can be seen [https://github.com/Avanthikaa/media/commit/5d8cdfc029daf69122c64f8bfcceaec6f80916a4 here]&lt;br /&gt;
&lt;br /&gt;
[[File:format_commit.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Running a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
4) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./constant_source&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Merged164-2.png&amp;diff=121262</id>
		<title>File:Merged164-2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Merged164-2.png&amp;diff=121262"/>
		<updated>2018-12-08T00:57:25Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=121260</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=121260"/>
		<updated>2018-12-08T00:55:51Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''== &lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode). Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Design'''==&lt;br /&gt;
Our design and plan of work is split into two set of tasks- Initial steps and Subsequent steps.&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps'''===&lt;br /&gt;
* To create a new example program- media/examples/oscillator.rs that exercises the different oscillator types&lt;br /&gt;
* To implement the processing algorithm for the different oscillator types like Sine, Square, Sawtooth, Triangle and a Custom wave based on user's input in media/audio/src/oscillator_node.rs so that the example programs in media/examples/oscillator.rs sound correct.&lt;br /&gt;
* To implement the missing ConstantSource node type in a new constant_source.rs file in the directory media/audio/src that produces a constant tone based a stored value that can be modified.&lt;br /&gt;
* To create the DOM interface for ConstantSourceNode and implement the createConstantSource API for BaseAudioContext&lt;br /&gt;
* To connect the DOM interface to the underlying backend node by processing the unimplemented message type.&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps'''===&lt;br /&gt;
* To implement the backend for StereoPannerNode in the media crate by creating a new node. To create a runnable example for the same.&lt;br /&gt;
* To create the DOM interface for StereoPannerNode and implement the createStereoPannerNode API for BaseAudioContext&lt;br /&gt;
* To create the DOM interface for IIRFilterNode and implement the createIIRFilterNode API for BaseAudioContext.&lt;br /&gt;
* To implement the backend for IIRFilterNode based on the specification's processing model and create a runnable example&lt;br /&gt;
&lt;br /&gt;
[[File:initialsteps.png]]&lt;br /&gt;
[[File:Subsequentsteps.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Files (to be) modified'''==&lt;br /&gt;
* media/audio/src/oscillator_node.rs&lt;br /&gt;
* media/audio/src/constant_source_node.rs&lt;br /&gt;
* media/audio/src/node.rs&lt;br /&gt;
* media/audio/src/lib.rs&lt;br /&gt;
* media/audio/src/render_thread.rs&lt;br /&gt;
* media/audio/src/param.rs&lt;br /&gt;
* media/examples/oscillator.rs&lt;br /&gt;
* media/examples/constant_source.rs&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
Our current implementation involves audio processing for Sine, Square, Sawtooth and Triangle waveforms and we are working on generating the Custom wave. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
The following changes have been done in the &amp;lt;code&amp;gt;oscillator_node.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;audio/src/&amp;lt;/code&amp;gt; directory where the function to generate the waveforms is written&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt; oscillator.rs &amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;media/examples/ &amp;lt;/code&amp;gt; directory has been created by us which generates objects and calls methods to run the different oscillator type examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
extern crate servo_media;&lt;br /&gt;
&lt;br /&gt;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorNodeOptions;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Sawtooth;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Triangle;&lt;br /&gt;
//use servo_media::audio::oscillator_node::OscillatorType::Sine;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Custom;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Square;&lt;br /&gt;
use servo_media::ServoMedia;&lt;br /&gt;
use std::sync::Arc;&lt;br /&gt;
use std::{thread, time};&lt;br /&gt;
&lt;br /&gt;
fn run_example(servo_media: Arc&amp;lt;ServoMedia&amp;gt;) {&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let mut options = OscillatorNodeOptions::default();&lt;br /&gt;
    let osc1 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc1.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc1,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Square;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc2 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc2.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc2,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Sawtooth;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc3 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc3.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc3,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Triangle;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc4 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc4.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc4,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Custom;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc5 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc5.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc5,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fn main() {&lt;br /&gt;
    if let Ok(servo_media) = ServoMedia::get() {&lt;br /&gt;
        run_example(servo_media);&lt;br /&gt;
    } else {&lt;br /&gt;
        unreachable!();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
We created the &amp;lt;code&amp;gt;constant_source_node.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;audio/src/&amp;lt;/code&amp;gt; directory which has the function to generate a constant tone&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use block::Chunk;&lt;br /&gt;
use block::Tick;&lt;br /&gt;
use node::{AudioNodeEngine, AudioScheduledSourceNodeMessage, OnEndedCallback};&lt;br /&gt;
use node::BlockInfo;&lt;br /&gt;
use node::{AudioNodeType, ChannelInfo, ShouldPlay};&lt;br /&gt;
use param::{Param, ParamType};&lt;br /&gt;
&lt;br /&gt;
#[derive(Copy, Clone, Debug)]&lt;br /&gt;
pub struct ConstantSourceNodeOptions {&lt;br /&gt;
    pub offset: f32,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl Default for ConstantSourceNodeOptions {&lt;br /&gt;
    fn default() -&amp;gt; Self {&lt;br /&gt;
        ConstantSourceNodeOptions { offset: 1. }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#[derive(AudioScheduledSourceNode,AudioNodeCommon)]&lt;br /&gt;
pub(crate) struct ConstantSourceNode {&lt;br /&gt;
    channel_info: ChannelInfo,&lt;br /&gt;
    offset: Param,&lt;br /&gt;
    start_at: Option&amp;lt;Tick&amp;gt;,&lt;br /&gt;
    stop_at: Option&amp;lt;Tick&amp;gt;,&lt;br /&gt;
    onended_callback: Option&amp;lt;OnEndedCallback&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl ConstantSourceNode {&lt;br /&gt;
    pub fn new(options: ConstantSourceNodeOptions, channel_info: ChannelInfo) -&amp;gt; Self {&lt;br /&gt;
        Self {&lt;br /&gt;
            channel_info,&lt;br /&gt;
            offset: Param::new(options.offset.into()),&lt;br /&gt;
            start_at: None,&lt;br /&gt;
            stop_at: None,&lt;br /&gt;
            onended_callback: None,&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pub fn update_parameters(&amp;amp;mut self, info: &amp;amp;BlockInfo, tick: Tick) -&amp;gt; bool {&lt;br /&gt;
        self.offset.update(info, tick)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl AudioNodeEngine for ConstantSourceNode {&lt;br /&gt;
    fn node_type(&amp;amp;self) -&amp;gt; AudioNodeType {&lt;br /&gt;
        AudioNodeType::ConstantSourceNode&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    fn process(&amp;amp;mut self, mut inputs: Chunk, info: &amp;amp;BlockInfo) -&amp;gt; Chunk {&lt;br /&gt;
&lt;br /&gt;
        debug_assert!(inputs.len() == 0);&lt;br /&gt;
&lt;br /&gt;
        inputs.blocks.push(Default::default());&lt;br /&gt;
&lt;br /&gt;
        let (start_at, stop_at) = match self.should_play_at(info.frame) {&lt;br /&gt;
            ShouldPlay::No =&amp;gt; {&lt;br /&gt;
                return inputs;&lt;br /&gt;
            }&lt;br /&gt;
            ShouldPlay::Between(start, end) =&amp;gt; (start, end),&lt;br /&gt;
        };&lt;br /&gt;
&lt;br /&gt;
        {&lt;br /&gt;
            inputs.blocks[0].explicit_silence();&lt;br /&gt;
&lt;br /&gt;
            let mut iter = inputs.blocks[0].iter();&lt;br /&gt;
            let mut offset = self.offset.value();&lt;br /&gt;
            while let Some(mut frame) = iter.next() {&lt;br /&gt;
                let tick = frame.tick();&lt;br /&gt;
                if tick &amp;lt; start_at {&lt;br /&gt;
                    continue;&lt;br /&gt;
                } else if tick &amp;gt; stop_at {&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
                if self.update_parameters(info, frame.tick()) {&lt;br /&gt;
                    offset = self.offset.value();&lt;br /&gt;
                }&lt;br /&gt;
                frame.mutate_with(|sample, _| *sample = offset);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        inputs&lt;br /&gt;
    }&lt;br /&gt;
    fn input_count(&amp;amp;self) -&amp;gt; u32{&lt;br /&gt;
        0&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    fn get_param(&amp;amp;mut self, id: ParamType) -&amp;gt; &amp;amp;mut Param {&lt;br /&gt;
        match id {&lt;br /&gt;
            ParamType::Offset =&amp;gt; &amp;amp;mut self.offset,&lt;br /&gt;
            _ =&amp;gt; panic!(&amp;quot;Unknown param {:?} for the offset&amp;quot;, id),&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    make_message_handler!(AudioScheduledSourceNode: handle_source_node_message);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We created the &amp;lt;code&amp;gt;constant_source.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;examples/&amp;lt;/code&amp;gt; directory which realizes the implementation of Constant Source Node&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
extern crate servo_media;&lt;br /&gt;
&lt;br /&gt;
use servo_media::audio::constant_source_node::ConstantSourceNodeOptions;&lt;br /&gt;
use servo_media::audio::gain_node::GainNodeOptions;&lt;br /&gt;
use servo_media::audio::param::{ParamType, RampKind, UserAutomationEvent};&lt;br /&gt;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};&lt;br /&gt;
use servo_media::ServoMedia;&lt;br /&gt;
use std::sync::Arc;&lt;br /&gt;
use std::{thread, time};&lt;br /&gt;
&lt;br /&gt;
fn run_example(servo_media: Arc&amp;lt;ServoMedia&amp;gt;) {&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
&lt;br /&gt;
    let mut cs_options = ConstantSourceNodeOptions::default();&lt;br /&gt;
    cs_options.offset = 0.;&lt;br /&gt;
    let cs = context.create_node(&lt;br /&gt;
        AudioNodeInit::ConstantSourceNode(cs_options.clone()),&lt;br /&gt;
        Default::default(),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    let mut gain_options = GainNodeOptions::default();&lt;br /&gt;
    gain_options.gain = 0.1;&lt;br /&gt;
    let gain = context.create_node(&lt;br /&gt;
&lt;br /&gt;
        AudioNodeInit::GainNode(gain_options.clone()),&lt;br /&gt;
&lt;br /&gt;
        Default::default(),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    let osc = context.create_node(&lt;br /&gt;
       AudioNodeInit::OscillatorNode(Default::default()),&lt;br /&gt;
       Default::default(),&lt;br /&gt;
   );&lt;br /&gt;
&lt;br /&gt;
   context.connect_ports(osc.output(0), gain.input(0));&lt;br /&gt;
   context.connect_ports(cs.output(0), gain.param(ParamType::Gain));&lt;br /&gt;
   context.connect_ports(gain.output(0), dest.input(0));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
&lt;br /&gt;
        gain,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 1., 1.5),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 0.1, 3.0),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 1., 4.5),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 0.1, 6.0),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(9000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fn main() {&lt;br /&gt;
    if let Ok(servo_media) = ServoMedia::get() {&lt;br /&gt;
        run_example(servo_media);&lt;br /&gt;
    } else {&lt;br /&gt;
        unreachable!();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&amp;lt;strong&amp;gt;12/07-  A Servo team member (@ferjm: Fernando Jimenez Moreno) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request (#164)&amp;lt;/strong&amp;gt;&lt;br /&gt;
[[File:Merged 164.png]]&lt;br /&gt;
&lt;br /&gt;
12/06- Completed the changes stated in the review for Constant Source Node example. The updated pull request can be accessed via [https://github.com/servo/media/pull/164 here]&lt;br /&gt;
&lt;br /&gt;
11/9- The formatted changes have been committed as said in the review.The changes to the formatting can be seen [https://github.com/Avanthikaa/media/commit/5d8cdfc029daf69122c64f8bfcceaec6f80916a4 here]&lt;br /&gt;
&lt;br /&gt;
[[File:format_commit.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Running a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
4) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./constant_source&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Merged_164.png&amp;diff=121259</id>
		<title>File:Merged 164.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Merged_164.png&amp;diff=121259"/>
		<updated>2018-12-08T00:54:24Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=121249</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=121249"/>
		<updated>2018-12-08T00:49:08Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''== &lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode). Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Design'''==&lt;br /&gt;
Our design and plan of work is split into two set of tasks- Initial steps and Subsequent steps.&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps'''===&lt;br /&gt;
* To create a new example program- media/examples/oscillator.rs that exercises the different oscillator types&lt;br /&gt;
* To implement the processing algorithm for the different oscillator types like Sine, Square, Sawtooth, Triangle and a Custom wave based on user's input in media/audio/src/oscillator_node.rs so that the example programs in media/examples/oscillator.rs sound correct.&lt;br /&gt;
* To implement the missing ConstantSource node type in a new constant_source.rs file in the directory media/audio/src that produces a constant tone based a stored value that can be modified.&lt;br /&gt;
* To create the DOM interface for ConstantSourceNode and implement the createConstantSource API for BaseAudioContext&lt;br /&gt;
* To connect the DOM interface to the underlying backend node by processing the unimplemented message type.&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps'''===&lt;br /&gt;
* To implement the backend for StereoPannerNode in the media crate by creating a new node. To create a runnable example for the same.&lt;br /&gt;
* To create the DOM interface for StereoPannerNode and implement the createStereoPannerNode API for BaseAudioContext&lt;br /&gt;
* To create the DOM interface for IIRFilterNode and implement the createIIRFilterNode API for BaseAudioContext.&lt;br /&gt;
* To implement the backend for IIRFilterNode based on the specification's processing model and create a runnable example&lt;br /&gt;
&lt;br /&gt;
[[File:initialsteps.png]]&lt;br /&gt;
[[File:Subsequentsteps.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Files (to be) modified'''==&lt;br /&gt;
* media/audio/src/oscillator_node.rs&lt;br /&gt;
* media/audio/src/constant_source_node.rs&lt;br /&gt;
* media/audio/src/node.rs&lt;br /&gt;
* media/audio/src/lib.rs&lt;br /&gt;
* media/audio/src/render_thread.rs&lt;br /&gt;
* media/audio/src/param.rs&lt;br /&gt;
* media/examples/oscillator.rs&lt;br /&gt;
* media/examples/constant_source.rs&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
Our current implementation involves audio processing for Sine, Square, Sawtooth and Triangle waveforms and we are working on generating the Custom wave. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
The following changes have been done in the &amp;lt;code&amp;gt;oscillator_node.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;audio/src/&amp;lt;/code&amp;gt; directory where the function to generate the waveforms is written&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt; oscillator.rs &amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;media/examples/ &amp;lt;/code&amp;gt; directory has been created by us which generates objects and calls methods to run the different oscillator type examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
extern crate servo_media;&lt;br /&gt;
&lt;br /&gt;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorNodeOptions;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Sawtooth;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Triangle;&lt;br /&gt;
//use servo_media::audio::oscillator_node::OscillatorType::Sine;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Custom;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Square;&lt;br /&gt;
use servo_media::ServoMedia;&lt;br /&gt;
use std::sync::Arc;&lt;br /&gt;
use std::{thread, time};&lt;br /&gt;
&lt;br /&gt;
fn run_example(servo_media: Arc&amp;lt;ServoMedia&amp;gt;) {&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let mut options = OscillatorNodeOptions::default();&lt;br /&gt;
    let osc1 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc1.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc1,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Square;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc2 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc2.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc2,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Sawtooth;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc3 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc3.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc3,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Triangle;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc4 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc4.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc4,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Custom;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc5 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc5.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc5,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fn main() {&lt;br /&gt;
    if let Ok(servo_media) = ServoMedia::get() {&lt;br /&gt;
        run_example(servo_media);&lt;br /&gt;
    } else {&lt;br /&gt;
        unreachable!();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
We created the &amp;lt;code&amp;gt;constant_source_node.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;audio/src/&amp;lt;/code&amp;gt; directory which has the function to generate a constant tone&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use block::Chunk;&lt;br /&gt;
use block::Tick;&lt;br /&gt;
use node::{AudioNodeEngine, AudioScheduledSourceNodeMessage, OnEndedCallback};&lt;br /&gt;
use node::BlockInfo;&lt;br /&gt;
use node::{AudioNodeType, ChannelInfo, ShouldPlay};&lt;br /&gt;
use param::{Param, ParamType};&lt;br /&gt;
&lt;br /&gt;
#[derive(Copy, Clone, Debug)]&lt;br /&gt;
pub struct ConstantSourceNodeOptions {&lt;br /&gt;
    pub offset: f32,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl Default for ConstantSourceNodeOptions {&lt;br /&gt;
    fn default() -&amp;gt; Self {&lt;br /&gt;
        ConstantSourceNodeOptions { offset: 1. }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#[derive(AudioScheduledSourceNode,AudioNodeCommon)]&lt;br /&gt;
pub(crate) struct ConstantSourceNode {&lt;br /&gt;
    channel_info: ChannelInfo,&lt;br /&gt;
    offset: Param,&lt;br /&gt;
    start_at: Option&amp;lt;Tick&amp;gt;,&lt;br /&gt;
    stop_at: Option&amp;lt;Tick&amp;gt;,&lt;br /&gt;
    onended_callback: Option&amp;lt;OnEndedCallback&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl ConstantSourceNode {&lt;br /&gt;
    pub fn new(options: ConstantSourceNodeOptions, channel_info: ChannelInfo) -&amp;gt; Self {&lt;br /&gt;
        Self {&lt;br /&gt;
            channel_info,&lt;br /&gt;
            offset: Param::new(options.offset.into()),&lt;br /&gt;
            start_at: None,&lt;br /&gt;
            stop_at: None,&lt;br /&gt;
            onended_callback: None,&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pub fn update_parameters(&amp;amp;mut self, info: &amp;amp;BlockInfo, tick: Tick) -&amp;gt; bool {&lt;br /&gt;
        self.offset.update(info, tick)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl AudioNodeEngine for ConstantSourceNode {&lt;br /&gt;
    fn node_type(&amp;amp;self) -&amp;gt; AudioNodeType {&lt;br /&gt;
        AudioNodeType::ConstantSourceNode&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    fn process(&amp;amp;mut self, mut inputs: Chunk, info: &amp;amp;BlockInfo) -&amp;gt; Chunk {&lt;br /&gt;
&lt;br /&gt;
        debug_assert!(inputs.len() == 0);&lt;br /&gt;
&lt;br /&gt;
        inputs.blocks.push(Default::default());&lt;br /&gt;
&lt;br /&gt;
        let (start_at, stop_at) = match self.should_play_at(info.frame) {&lt;br /&gt;
            ShouldPlay::No =&amp;gt; {&lt;br /&gt;
                return inputs;&lt;br /&gt;
            }&lt;br /&gt;
            ShouldPlay::Between(start, end) =&amp;gt; (start, end),&lt;br /&gt;
        };&lt;br /&gt;
&lt;br /&gt;
        {&lt;br /&gt;
            inputs.blocks[0].explicit_silence();&lt;br /&gt;
&lt;br /&gt;
            let mut iter = inputs.blocks[0].iter();&lt;br /&gt;
            let mut offset = self.offset.value();&lt;br /&gt;
            while let Some(mut frame) = iter.next() {&lt;br /&gt;
                let tick = frame.tick();&lt;br /&gt;
                if tick &amp;lt; start_at {&lt;br /&gt;
                    continue;&lt;br /&gt;
                } else if tick &amp;gt; stop_at {&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
                if self.update_parameters(info, frame.tick()) {&lt;br /&gt;
                    offset = self.offset.value();&lt;br /&gt;
                }&lt;br /&gt;
                frame.mutate_with(|sample, _| *sample = offset);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        inputs&lt;br /&gt;
    }&lt;br /&gt;
    fn input_count(&amp;amp;self) -&amp;gt; u32{&lt;br /&gt;
        0&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    fn get_param(&amp;amp;mut self, id: ParamType) -&amp;gt; &amp;amp;mut Param {&lt;br /&gt;
        match id {&lt;br /&gt;
            ParamType::Offset =&amp;gt; &amp;amp;mut self.offset,&lt;br /&gt;
            _ =&amp;gt; panic!(&amp;quot;Unknown param {:?} for the offset&amp;quot;, id),&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    make_message_handler!(AudioScheduledSourceNode: handle_source_node_message);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We created the &amp;lt;code&amp;gt;constant_source.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;examples/&amp;lt;/code&amp;gt; directory which realizes the implementation of Constant Source Node&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
extern crate servo_media;&lt;br /&gt;
&lt;br /&gt;
use servo_media::audio::constant_source_node::ConstantSourceNodeOptions;&lt;br /&gt;
use servo_media::audio::gain_node::GainNodeOptions;&lt;br /&gt;
use servo_media::audio::param::{ParamType, RampKind, UserAutomationEvent};&lt;br /&gt;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};&lt;br /&gt;
use servo_media::ServoMedia;&lt;br /&gt;
use std::sync::Arc;&lt;br /&gt;
use std::{thread, time};&lt;br /&gt;
&lt;br /&gt;
fn run_example(servo_media: Arc&amp;lt;ServoMedia&amp;gt;) {&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
&lt;br /&gt;
    let mut cs_options = ConstantSourceNodeOptions::default();&lt;br /&gt;
    cs_options.offset = 0.;&lt;br /&gt;
    let cs = context.create_node(&lt;br /&gt;
        AudioNodeInit::ConstantSourceNode(cs_options.clone()),&lt;br /&gt;
        Default::default(),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    let mut gain_options = GainNodeOptions::default();&lt;br /&gt;
    gain_options.gain = 0.1;&lt;br /&gt;
    let gain = context.create_node(&lt;br /&gt;
&lt;br /&gt;
        AudioNodeInit::GainNode(gain_options.clone()),&lt;br /&gt;
&lt;br /&gt;
        Default::default(),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    let osc = context.create_node(&lt;br /&gt;
       AudioNodeInit::OscillatorNode(Default::default()),&lt;br /&gt;
       Default::default(),&lt;br /&gt;
   );&lt;br /&gt;
&lt;br /&gt;
   context.connect_ports(osc.output(0), gain.input(0));&lt;br /&gt;
   context.connect_ports(cs.output(0), gain.param(ParamType::Gain));&lt;br /&gt;
   context.connect_ports(gain.output(0), dest.input(0));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
&lt;br /&gt;
        gain,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 1., 1.5),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 0.1, 3.0),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 1., 4.5),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        cs,&lt;br /&gt;
        AudioNodeMessage::SetParam(&lt;br /&gt;
            ParamType::Offset,&lt;br /&gt;
            UserAutomationEvent::RampToValueAtTime(RampKind::Linear, 0.1, 6.0),&lt;br /&gt;
        ),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(9000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fn main() {&lt;br /&gt;
    if let Ok(servo_media) = ServoMedia::get() {&lt;br /&gt;
        run_example(servo_media);&lt;br /&gt;
    } else {&lt;br /&gt;
        unreachable!();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
12/07-  A Servo team member (@ferjm: Fernando Jimenez Moreno) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request (#164)&lt;br /&gt;
&lt;br /&gt;
12/06- Completed the changes stated in the review for Constant Source Node example. The updated pull request can be accessed via [https://github.com/servo/media/pull/164 here]&lt;br /&gt;
&lt;br /&gt;
11/9- The formatted changes have been committed as said in the review.The changes to the formatting can be seen [https://github.com/Avanthikaa/media/commit/5d8cdfc029daf69122c64f8bfcceaec6f80916a4 here]&lt;br /&gt;
&lt;br /&gt;
[[File:format_commit.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Running a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
4) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./constant_source&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119024</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119024"/>
		<updated>2018-11-09T05:40:10Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
The following changes have been done in the &amp;lt;code&amp;gt;oscillator_node.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;audio/src/&amp;lt;/code&amp;gt; directory where the function to generate the waveforms is written&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt; oscillator.rs &amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;media/examples/ &amp;lt;/code&amp;gt; directory has been created by us which generates objects and calls methods to run the different oscillator type examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
extern crate servo_media;&lt;br /&gt;
&lt;br /&gt;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorNodeOptions;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Sawtooth;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Triangle;&lt;br /&gt;
//use servo_media::audio::oscillator_node::OscillatorType::Sine;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Custom;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Square;&lt;br /&gt;
use servo_media::ServoMedia;&lt;br /&gt;
use std::sync::Arc;&lt;br /&gt;
use std::{thread, time};&lt;br /&gt;
&lt;br /&gt;
fn run_example(servo_media: Arc&amp;lt;ServoMedia&amp;gt;) {&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let mut options = OscillatorNodeOptions::default();&lt;br /&gt;
    let osc1 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc1.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc1,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Square;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc2 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc2.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc2,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Sawtooth;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc3 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc3.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc3,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Triangle;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc4 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc4.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc4,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Custom;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc5 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc5.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc5,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fn main() {&lt;br /&gt;
    if let Ok(servo_media) = ServoMedia::get() {&lt;br /&gt;
        run_example(servo_media);&lt;br /&gt;
    } else {&lt;br /&gt;
        unreachable!();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
11/9- The the formatted changes have been committed as said in the review.The changes to the formatting can be seen [https://github.com/Avanthikaa/media/commit/5d8cdfc029daf69122c64f8bfcceaec6f80916a4 here]&lt;br /&gt;
&lt;br /&gt;
[[File:format_commit.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Running a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/media/pull/163 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119023</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119023"/>
		<updated>2018-11-09T05:39:55Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
The following changes have been done in the &amp;lt;code&amp;gt;oscillator_node.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;audio/src/&amp;lt;/code&amp;gt; directory where the function to generate the waveforms is written&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt; oscillator.rs &amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;media/examples/ &amp;lt;/code&amp;gt; directory has been created by us which generates objects and calls methods to run the different oscillator type examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
extern crate servo_media;&lt;br /&gt;
&lt;br /&gt;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorNodeOptions;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Sawtooth;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Triangle;&lt;br /&gt;
//use servo_media::audio::oscillator_node::OscillatorType::Sine;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Custom;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Square;&lt;br /&gt;
use servo_media::ServoMedia;&lt;br /&gt;
use std::sync::Arc;&lt;br /&gt;
use std::{thread, time};&lt;br /&gt;
&lt;br /&gt;
fn run_example(servo_media: Arc&amp;lt;ServoMedia&amp;gt;) {&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let mut options = OscillatorNodeOptions::default();&lt;br /&gt;
    let osc1 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc1.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc1,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Square;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc2 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc2.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc2,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Sawtooth;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc3 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc3.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc3,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Triangle;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc4 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc4.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc4,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Custom;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc5 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc5.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc5,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fn main() {&lt;br /&gt;
    if let Ok(servo_media) = ServoMedia::get() {&lt;br /&gt;
        run_example(servo_media);&lt;br /&gt;
    } else {&lt;br /&gt;
        unreachable!();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
11/9- The the formatted changes have been committed as said in the review.The changes to the formatting can be seen [https://github.com/Avanthikaa/media/commit/5d8cdfc029daf69122c64f8bfcceaec6f80916a4 here]&lt;br /&gt;
&lt;br /&gt;
[[File:format_commit.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Running a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/media/pull/163 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Format_commit.png&amp;diff=119022</id>
		<title>File:Format commit.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Format_commit.png&amp;diff=119022"/>
		<updated>2018-11-09T05:38:52Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119021</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119021"/>
		<updated>2018-11-09T05:38:38Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
The following changes have been done in the &amp;lt;code&amp;gt;oscillator_node.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;audio/src/&amp;lt;/code&amp;gt; directory where the function to generate the waveforms is written&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt; oscillator.rs &amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;media/examples/ &amp;lt;/code&amp;gt; directory has been created by us which generates objects and calls methods to run the different oscillator type examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
extern crate servo_media;&lt;br /&gt;
&lt;br /&gt;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorNodeOptions;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Sawtooth;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Triangle;&lt;br /&gt;
//use servo_media::audio::oscillator_node::OscillatorType::Sine;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Custom;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Square;&lt;br /&gt;
use servo_media::ServoMedia;&lt;br /&gt;
use std::sync::Arc;&lt;br /&gt;
use std::{thread, time};&lt;br /&gt;
&lt;br /&gt;
fn run_example(servo_media: Arc&amp;lt;ServoMedia&amp;gt;) {&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let mut options = OscillatorNodeOptions::default();&lt;br /&gt;
    let osc1 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc1.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc1,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Square;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc2 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc2.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc2,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Sawtooth;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc3 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc3.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc3,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Triangle;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc4 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc4.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc4,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Custom;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc5 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc5.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc5,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fn main() {&lt;br /&gt;
    if let Ok(servo_media) = ServoMedia::get() {&lt;br /&gt;
        run_example(servo_media);&lt;br /&gt;
    } else {&lt;br /&gt;
        unreachable!();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
11/9- The the formatted changes have been committed as said in the review.&lt;br /&gt;
[[File:format_commit.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes. The changes to the formatting can be seen [https://github.com/Avanthikaa/media/commit/5d8cdfc029daf69122c64f8bfcceaec6f80916a4 here] &amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Running a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/media/pull/163 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119020</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119020"/>
		<updated>2018-11-09T05:35:57Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Code Snippet */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
The following changes have been done in the &amp;lt;code&amp;gt;oscillator_node.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;audio/src/&amp;lt;/code&amp;gt; directory where the function to generate the waveforms is written&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt; oscillator.rs &amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;media/examples/ &amp;lt;/code&amp;gt; directory has been created by us which generates objects and calls methods to run the different oscillator type examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
extern crate servo_media;&lt;br /&gt;
&lt;br /&gt;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorNodeOptions;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Sawtooth;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Triangle;&lt;br /&gt;
//use servo_media::audio::oscillator_node::OscillatorType::Sine;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Custom;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Square;&lt;br /&gt;
use servo_media::ServoMedia;&lt;br /&gt;
use std::sync::Arc;&lt;br /&gt;
use std::{thread, time};&lt;br /&gt;
&lt;br /&gt;
fn run_example(servo_media: Arc&amp;lt;ServoMedia&amp;gt;) {&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let mut options = OscillatorNodeOptions::default();&lt;br /&gt;
    let osc1 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc1.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc1,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Square;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc2 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc2.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc2,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Sawtooth;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc3 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc3.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc3,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Triangle;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc4 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc4.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc4,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Custom;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc5 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc5.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc5,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fn main() {&lt;br /&gt;
    if let Ok(servo_media) = ServoMedia::get() {&lt;br /&gt;
        run_example(servo_media);&lt;br /&gt;
    } else {&lt;br /&gt;
        unreachable!();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes. The changes to the formatting can be seen [https://github.com/Avanthikaa/media/commit/5d8cdfc029daf69122c64f8bfcceaec6f80916a4 here] &amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Running a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/media/pull/163 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119019</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119019"/>
		<updated>2018-11-09T05:35:26Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Code Snippet */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
The following changes have been done in the &amp;lt;code&amp;gt;oscillator_node.rs&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;audio/src/&amp;lt;/code&amp;gt; directory where the function to generate the waveforms is written&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt; oscillator.rs &amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;media/examples/ &amp;lt;/code&amp;gt; directory has been created by us which generates objects and calls methods to run the different oscillator type examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
extern crate servo_media;&lt;br /&gt;
&lt;br /&gt;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorNodeOptions;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Sawtooth;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Triangle;&lt;br /&gt;
//use servo_media::audio::oscillator_node::OscillatorType::Sine;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Custom;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Square;&lt;br /&gt;
use servo_media::ServoMedia;&lt;br /&gt;
use std::sync::Arc;&lt;br /&gt;
use std::{thread, time};&lt;br /&gt;
&lt;br /&gt;
fn run_example(servo_media: Arc&amp;lt;ServoMedia&amp;gt;) {&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let mut options = OscillatorNodeOptions::default();&lt;br /&gt;
    let osc1 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc1.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc1,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Square;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc2 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc2.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc2,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Sawtooth;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc3 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc3.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc3,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Triangle;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc4 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc4.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc4,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Custom;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc5 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc5.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc5,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fn main() {&lt;br /&gt;
    if let Ok(servo_media) = ServoMedia::get() {&lt;br /&gt;
        run_example(servo_media);&lt;br /&gt;
    } else {&lt;br /&gt;
        unreachable!();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes. The changes to the formatting can be seen [https://github.com/Avanthikaa/media/commit/5d8cdfc029daf69122c64f8bfcceaec6f80916a4 here] &amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Running a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/media/pull/163 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119018</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119018"/>
		<updated>2018-11-09T05:35:10Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Code Snippet */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
The following changes have been done in the oscillator_node.rs file in the &amp;lt;code&amp;gt;audio/src/&amp;lt;/code&amp;gt; directory where the function to generate the waveforms is written&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt; oscillator.rs &amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;media/examples/ &amp;lt;/code&amp;gt; directory has been created by us which generates objects and calls methods to run the different oscillator type examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
extern crate servo_media;&lt;br /&gt;
&lt;br /&gt;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorNodeOptions;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Sawtooth;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Triangle;&lt;br /&gt;
//use servo_media::audio::oscillator_node::OscillatorType::Sine;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Custom;&lt;br /&gt;
use servo_media::audio::oscillator_node::OscillatorType::Square;&lt;br /&gt;
use servo_media::ServoMedia;&lt;br /&gt;
use std::sync::Arc;&lt;br /&gt;
use std::{thread, time};&lt;br /&gt;
&lt;br /&gt;
fn run_example(servo_media: Arc&amp;lt;ServoMedia&amp;gt;) {&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let mut options = OscillatorNodeOptions::default();&lt;br /&gt;
    let osc1 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc1.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc1,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Square;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc2 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc2.output(0), dest.input(0));&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc2,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Sawtooth;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc3 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc3.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc3,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Triangle;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc4 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc4.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc4,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
    let _ = context.close();&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(1000));&lt;br /&gt;
&lt;br /&gt;
    options.oscillator_type = Custom;&lt;br /&gt;
    let context = servo_media.create_audio_context(Default::default());&lt;br /&gt;
    let dest = context.dest_node();&lt;br /&gt;
    let osc5 = context.create_node(AudioNodeInit::OscillatorNode(options), Default::default());&lt;br /&gt;
    context.connect_ports(osc5.output(0), dest.input(0));&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
&lt;br /&gt;
    let _ = context.resume();&lt;br /&gt;
    context.message_node(&lt;br /&gt;
        osc5,&lt;br /&gt;
        AudioNodeMessage::AudioScheduledSourceNode(AudioScheduledSourceNodeMessage::Start(0.)),&lt;br /&gt;
    );&lt;br /&gt;
    thread::sleep(time::Duration::from_millis(3000));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fn main() {&lt;br /&gt;
    if let Ok(servo_media) = ServoMedia::get() {&lt;br /&gt;
        run_example(servo_media);&lt;br /&gt;
    } else {&lt;br /&gt;
        unreachable!();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes. The changes to the formatting can be seen [https://github.com/Avanthikaa/media/commit/5d8cdfc029daf69122c64f8bfcceaec6f80916a4 here] &amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Running a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/media/pull/163 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119017</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119017"/>
		<updated>2018-11-09T05:28:32Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes. The changes to the formatting can be seen [https://github.com/Avanthikaa/media/commit/5d8cdfc029daf69122c64f8bfcceaec6f80916a4 here] &amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Running a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/media/pull/163 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119016</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119016"/>
		<updated>2018-11-09T05:28:00Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt; The changes to the formatting can be seen [https://github.com/Avanthikaa/media/commit/5d8cdfc029daf69122c64f8bfcceaec6f80916a4 here]&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Running a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/media/pull/163 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119012</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119012"/>
		<updated>2018-11-09T05:25:45Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Verifying/ Running a build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Running a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/media/pull/163 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119011</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119011"/>
		<updated>2018-11-09T05:25:31Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Verifying a build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Verifying/ Running a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/media/pull/163 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119010</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119010"/>
		<updated>2018-11-09T05:25:08Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/media/pull/163 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119009</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119009"/>
		<updated>2018-11-09T05:24:18Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
Examples for the different sound waves can be found below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/d1/220_Hz_sine_wave.ogg Sine]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/9/92/Square_wave_1000.ogg Square]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://upload.wikimedia.org/wikipedia/commons/d/df/220_Hz_anti-aliased_triangle_wave.ogg Triangle]&lt;br /&gt;
&amp;lt;li&amp;gt;[https://en.audiofanzine.com/medias/audio/#id:473859 Sawtooth]&lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/media/pull/163 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119005</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=119005"/>
		<updated>2018-11-09T05:06:51Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
As we have implemented the processing algorithm for oscillator different oscillator types, after running the rust file the user will be able to hear the different generated waveforms based on its type. (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you are in this directory: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;target/debug&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./oscillator&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Different sounds  based on the type of oscillator (waveform) must be generated after definite interval of time.&lt;br /&gt;
&lt;br /&gt;
[[Media:triangle.ogg]]&lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/media/pull/163 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:PullReq.png&amp;diff=118997</id>
		<title>File:PullReq.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:PullReq.png&amp;diff=118997"/>
		<updated>2018-11-09T04:45:28Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118996</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118996"/>
		<updated>2018-11-09T04:45:18Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pullReq.png]]&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/media/pull/163 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118995</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118995"/>
		<updated>2018-11-09T04:42:44Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/media/pull/163 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&lt;br /&gt;
&lt;br /&gt;
https://webaudio.github.io/web-audio-api/&lt;br /&gt;
&lt;br /&gt;
https://doc.servo.org/servo/index.html  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;br /&gt;
&lt;br /&gt;
https://doc.rust-lang.org/rust-by-example/&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118994</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118994"/>
		<updated>2018-11-09T04:37:30Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Installing dependencies'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Once you complete the above steps to install dependencies, following are steps to build servo:&lt;br /&gt;
 &lt;br /&gt;
To build Servo in development mode. This is useful for development, but the resulting binary is very slow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
./mach build --dev&lt;br /&gt;
./mach run tests/html/about-mozilla.html &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or on Windows MSVC, in a normal Command Prompt (cmd.exe):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
mach.bat build --dev &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For benchmarking, performance testing, or real-world use, add the --release flag to create an optimized build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
./mach build --release&lt;br /&gt;
./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
Note: mach build will build both servo and libsimpleservo. To make compilation a bit faster, it's possible to only compile the servo binary: ./mach build --dev -p servo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118993</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118993"/>
		<updated>2018-11-09T04:28:05Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Building locally */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run &amp;lt;code&amp;gt;./mach bootstrap.&amp;lt;/code&amp;gt; If this fails, run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118992</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118992"/>
		<updated>2018-11-09T04:26:23Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Building locally */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&amp;lt;b&amp;gt;Installing Rust&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Debian-based Linuxes are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Local build instructions for Windows environments are given below:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118991</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118991"/>
		<updated>2018-11-09T04:25:12Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Building locally */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Debian-based Linuxes are given below&lt;br /&gt;
&lt;br /&gt;
1. Run the commands below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118990</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118990"/>
		<updated>2018-11-09T04:23:34Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file having the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
The initial step is to install Rust. You can do so by installing Rustup, version 1.8.0 or more recent.&lt;br /&gt;
&lt;br /&gt;
1. To install on Windows, download and run [https://win.rustup.rs/ rustup-init.exe] then follow the onscreen instructions.&lt;br /&gt;
&lt;br /&gt;
2. To install on other systems, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;curl https://sh.rustup.rs -sSf | sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other installation methds click [https://github.com/rust-lang-nursery/rustup.rs/#other-installation-methods here]&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Debian-based Linuxes are given below&lt;br /&gt;
&lt;br /&gt;
1. Run the commands below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install git curl autoconf libx11-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    gperf g++ build-essential cmake virtualenv python-pip \&lt;br /&gt;
    libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \&lt;br /&gt;
    libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \&lt;br /&gt;
    libharfbuzz-dev ccache clang \&lt;br /&gt;
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev autoconf2.13&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you using a version prior to Ubuntu 17.04 or Debian Sid, replace libssl1.0-dev with libssl-dev. Additionally, you'll need a local copy of GStreamer with a version later than 12.0. You can place it in support/linux/gstreamer/gstreamer, or run ./mach bootstrap-gstreamer to set it up.&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu 16.04 run export HARFBUZZ_SYS_NO_PKG_CONFIG=1 before building to avoid an error with harfbuzz.&lt;br /&gt;
&lt;br /&gt;
If you are on Ubuntu 14.04 and encountered errors on installing these dependencies involving libcheese, see #6158 for a workaround. You may also need to install gcc 4.9, clang 4.0, and cmake 3.2:&lt;br /&gt;
&lt;br /&gt;
If virtualenv does not exist, try python-virtualenv.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118989</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118989"/>
		<updated>2018-11-09T04:11:09Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file which contained the examples of implementation of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118988</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118988"/>
		<updated>2018-11-09T04:10:31Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Timeline */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file which contained the examples of implementstion of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118987</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118987"/>
		<updated>2018-11-09T04:10:10Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
==='''Timeline'''===&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file which contained the examples of implementstion of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118986</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118986"/>
		<updated>2018-11-09T04:09:33Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file which contained the examples of implementstion of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118985</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118985"/>
		<updated>2018-11-09T04:08:53Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file which contained the examples of implementstion of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118984</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118984"/>
		<updated>2018-11-09T04:08:09Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file which contained the examples of implementstion of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118983</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118983"/>
		<updated>2018-11-09T04:07:46Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file which contained the examples of implementstion of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118982</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118982"/>
		<updated>2018-11-09T04:07:14Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;11/8- A Servo team member (@Manishearth) &amp;lt;b&amp;gt;approved&amp;lt;/b&amp;gt; the pull request and advised us to make some minor formatting changes.&amp;lt;big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11/8- Submitted a pull request which contained the new oscillator.rs file which contained the examples of implementstion of the different OscillatorType or waveforms&lt;br /&gt;
&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118981</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118981"/>
		<updated>2018-11-09T03:59:52Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Code Snippet'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The above implementation involves the completion of the following steps as part of the intial steps:&lt;br /&gt;
&lt;br /&gt;
Initial steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;create a new example program for the media crate that exercises the different oscillator types. There will be no difference in sound yet.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;implement the processing algorithm for the different oscillator types so that the example program sounds correct.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
11/8- Members of the servo project informed us that Appveyor build status does not determine the success of a pull request. We were advised to run a bors-servo build and this succeeded. Therefore all build checks necessary for PR to pass have been completed successfully. We are waiting changes to be merged to upstream.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118980</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118980"/>
		<updated>2018-11-09T03:56:18Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Code Snippet'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
11/8- Members of the servo project informed us that Appveyor build status does not determine the success of a pull request. We were advised to run a bors-servo build and this succeeded. Therefore all build checks necessary for PR to pass have been completed successfully. We are waiting changes to be merged to upstream.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/servo/media&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/servo/media.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/media#servo-media here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 45 minutes, based on your system configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118979</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118979"/>
		<updated>2018-11-09T03:50:27Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Code Snippet'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;'''6/11 - The [https://github.com/servo/servo/pull/19038 Pull Request] was closed and the changes were merged upstream.'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3/11 - Due to 3rd party service issue (Appveyor) our build is facing issues with the continuous integration. We are working with the Servo team to resolve this.&lt;br /&gt;
&lt;br /&gt;
3/11- Members of the servo project informed us that Appveyor build status does not determine the success of a pull request. We were advised to run a bors-servo build and this succeeded. Therefore all build checks necessary for PR to pass have been completed successfully. We are waiting changes to be merged to upstream.&lt;br /&gt;
&lt;br /&gt;
[[File:Issue.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/CJ8664/servo&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/CJ8664/servo.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/servo/blob/master/README.md#building here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 30 minutes, based on your system configuration. You can build on [https://janitor.technology/ Janitor] to reduce the build time.&lt;br /&gt;
&lt;br /&gt;
==='''Building on the cloud'''===&lt;br /&gt;
&lt;br /&gt;
This is the simplest and the fastest way to deploy and test an instance of servo. No configuration is required on your machine. &lt;br /&gt;
&lt;br /&gt;
1. Go to &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;http://janitor.technology&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Click on '''New Container''' for Servo&lt;br /&gt;
&lt;br /&gt;
3. Enter your email address to gain access to your container&lt;br /&gt;
&lt;br /&gt;
4. Once logged in, go '''Containers''' on the top right. &lt;br /&gt;
&lt;br /&gt;
5. You will now see a container - Click on the '''IDE''' button to open your online IDE environment.&lt;br /&gt;
&lt;br /&gt;
6. Change directory to '''/home/user''' and create a new directory, say '''servo_test'''&lt;br /&gt;
&lt;br /&gt;
7. Go to this new directory and clone our repository as mentioned above&lt;br /&gt;
&lt;br /&gt;
8. Upon cloning you should see a /servo directory within 'servo_test' &lt;br /&gt;
&lt;br /&gt;
9. Go to /servo&lt;br /&gt;
&lt;br /&gt;
10. It is now time to build - run the following command: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach build --dev&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If all goes well you will see a success message - 'Build Completed'&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118978</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118978"/>
		<updated>2018-11-09T03:50:00Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Code Snippet */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Code Snippet'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;'''6/11 - The [https://github.com/servo/servo/pull/19038 Pull Request] was closed and the changes were merged upstream.'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3/11 - Due to 3rd party service issue (Appveyor) our build is facing issues with the continuous integration. We are working with the Servo team to resolve this.&lt;br /&gt;
&lt;br /&gt;
3/11- Members of the servo project informed us that Appveyor build status does not determine the success of a pull request. We were advised to run a bors-servo build and this succeeded. Therefore all build checks necessary for PR to pass have been completed successfully. We are waiting changes to be merged to upstream.&lt;br /&gt;
&lt;br /&gt;
[[File:Issue.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/CJ8664/servo&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/CJ8664/servo.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/servo/blob/master/README.md#building here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 30 minutes, based on your system configuration. You can build on [https://janitor.technology/ Janitor] to reduce the build time.&lt;br /&gt;
&lt;br /&gt;
==='''Building on the cloud'''===&lt;br /&gt;
&lt;br /&gt;
This is the simplest and the fastest way to deploy and test an instance of servo. No configuration is required on your machine. &lt;br /&gt;
&lt;br /&gt;
1. Go to &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;http://janitor.technology&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Click on '''New Container''' for Servo&lt;br /&gt;
&lt;br /&gt;
3. Enter your email address to gain access to your container&lt;br /&gt;
&lt;br /&gt;
4. Once logged in, go '''Containers''' on the top right. &lt;br /&gt;
&lt;br /&gt;
5. You will now see a container - Click on the '''IDE''' button to open your online IDE environment.&lt;br /&gt;
&lt;br /&gt;
6. Change directory to '''/home/user''' and create a new directory, say '''servo_test'''&lt;br /&gt;
&lt;br /&gt;
7. Go to this new directory and clone our repository as mentioned above&lt;br /&gt;
&lt;br /&gt;
8. Upon cloning you should see a /servo directory within 'servo_test' &lt;br /&gt;
&lt;br /&gt;
9. Go to /servo&lt;br /&gt;
&lt;br /&gt;
10. It is now time to build - run the following command: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach build --dev&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If all goes well you will see a success message - 'Build Completed'&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118977</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118977"/>
		<updated>2018-11-09T03:49:08Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Code Snippet */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Code Snippet'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn process(&amp;amp;mut self, mut inputs: Chunk, info: &amp;amp;BlockInfo) -&amp;gt; Chunk {&lt;br /&gt;
         // XXX Implement this properly and according to self.options&lt;br /&gt;
         // as defined in https://webaudio.github.io/web-audio-api/#oscillatornode&lt;br /&gt;
         use std::f64::consts::PI;&lt;br /&gt;
         debug_assert!(inputs.len() == 0);&lt;br /&gt;
         inputs.blocks.push(Default::default());&lt;br /&gt;
         let (start_at, stop_at) = match self.should_play_at(info.frame) {&lt;br /&gt;
             ShouldPlay::No =&amp;gt; {&lt;br /&gt;
                 return inputs;&lt;br /&gt;
             }&lt;br /&gt;
             ShouldPlay::Between(start, end) =&amp;gt; (start, end)&lt;br /&gt;
         };&lt;br /&gt;
 &lt;br /&gt;
         {&lt;br /&gt;
             inputs.blocks[0].explicit_silence();&lt;br /&gt;
             let mut iter = inputs.blocks[0].iter();&lt;br /&gt;
 &lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;'''6/11 - The [https://github.com/servo/servo/pull/19038 Pull Request] was closed and the changes were merged upstream.'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3/11 - Due to 3rd party service issue (Appveyor) our build is facing issues with the continuous integration. We are working with the Servo team to resolve this.&lt;br /&gt;
&lt;br /&gt;
3/11- Members of the servo project informed us that Appveyor build status does not determine the success of a pull request. We were advised to run a bors-servo build and this succeeded. Therefore all build checks necessary for PR to pass have been completed successfully. We are waiting changes to be merged to upstream.&lt;br /&gt;
&lt;br /&gt;
[[File:Issue.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/CJ8664/servo&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/CJ8664/servo.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/servo/blob/master/README.md#building here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 30 minutes, based on your system configuration. You can build on [https://janitor.technology/ Janitor] to reduce the build time.&lt;br /&gt;
&lt;br /&gt;
==='''Building on the cloud'''===&lt;br /&gt;
&lt;br /&gt;
This is the simplest and the fastest way to deploy and test an instance of servo. No configuration is required on your machine. &lt;br /&gt;
&lt;br /&gt;
1. Go to &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;http://janitor.technology&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Click on '''New Container''' for Servo&lt;br /&gt;
&lt;br /&gt;
3. Enter your email address to gain access to your container&lt;br /&gt;
&lt;br /&gt;
4. Once logged in, go '''Containers''' on the top right. &lt;br /&gt;
&lt;br /&gt;
5. You will now see a container - Click on the '''IDE''' button to open your online IDE environment.&lt;br /&gt;
&lt;br /&gt;
6. Change directory to '''/home/user''' and create a new directory, say '''servo_test'''&lt;br /&gt;
&lt;br /&gt;
7. Go to this new directory and clone our repository as mentioned above&lt;br /&gt;
&lt;br /&gt;
8. Upon cloning you should see a /servo directory within 'servo_test' &lt;br /&gt;
&lt;br /&gt;
9. Go to /servo&lt;br /&gt;
&lt;br /&gt;
10. It is now time to build - run the following command: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach build --dev&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If all goes well you will see a success message - 'Build Completed'&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118976</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118976"/>
		<updated>2018-11-09T03:48:20Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Code Snippet */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Code Snippet'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
fn process(&amp;amp;mut self, mut inputs: Chunk, info: &amp;amp;BlockInfo) -&amp;gt; Chunk {&lt;br /&gt;
         // XXX Implement this properly and according to self.options&lt;br /&gt;
         // as defined in https://webaudio.github.io/web-audio-api/#oscillatornode&lt;br /&gt;
         use std::f64::consts::PI;&lt;br /&gt;
         debug_assert!(inputs.len() == 0);&lt;br /&gt;
         inputs.blocks.push(Default::default());&lt;br /&gt;
         let (start_at, stop_at) = match self.should_play_at(info.frame) {&lt;br /&gt;
             ShouldPlay::No =&amp;gt; {&lt;br /&gt;
                 return inputs;&lt;br /&gt;
             }&lt;br /&gt;
             ShouldPlay::Between(start, end) =&amp;gt; (start, end)&lt;br /&gt;
         };&lt;br /&gt;
 &lt;br /&gt;
         {&lt;br /&gt;
             inputs.blocks[0].explicit_silence();&lt;br /&gt;
             let mut iter = inputs.blocks[0].iter();&lt;br /&gt;
 &lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;'''6/11 - The [https://github.com/servo/servo/pull/19038 Pull Request] was closed and the changes were merged upstream.'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3/11 - Due to 3rd party service issue (Appveyor) our build is facing issues with the continuous integration. We are working with the Servo team to resolve this.&lt;br /&gt;
&lt;br /&gt;
3/11- Members of the servo project informed us that Appveyor build status does not determine the success of a pull request. We were advised to run a bors-servo build and this succeeded. Therefore all build checks necessary for PR to pass have been completed successfully. We are waiting changes to be merged to upstream.&lt;br /&gt;
&lt;br /&gt;
[[File:Issue.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/CJ8664/servo&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/CJ8664/servo.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/servo/blob/master/README.md#building here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 30 minutes, based on your system configuration. You can build on [https://janitor.technology/ Janitor] to reduce the build time.&lt;br /&gt;
&lt;br /&gt;
==='''Building on the cloud'''===&lt;br /&gt;
&lt;br /&gt;
This is the simplest and the fastest way to deploy and test an instance of servo. No configuration is required on your machine. &lt;br /&gt;
&lt;br /&gt;
1. Go to &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;http://janitor.technology&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Click on '''New Container''' for Servo&lt;br /&gt;
&lt;br /&gt;
3. Enter your email address to gain access to your container&lt;br /&gt;
&lt;br /&gt;
4. Once logged in, go '''Containers''' on the top right. &lt;br /&gt;
&lt;br /&gt;
5. You will now see a container - Click on the '''IDE''' button to open your online IDE environment.&lt;br /&gt;
&lt;br /&gt;
6. Change directory to '''/home/user''' and create a new directory, say '''servo_test'''&lt;br /&gt;
&lt;br /&gt;
7. Go to this new directory and clone our repository as mentioned above&lt;br /&gt;
&lt;br /&gt;
8. Upon cloning you should see a /servo directory within 'servo_test' &lt;br /&gt;
&lt;br /&gt;
9. Go to /servo&lt;br /&gt;
&lt;br /&gt;
10. It is now time to build - run the following command: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach build --dev&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If all goes well you will see a success message - 'Build Completed'&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118975</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118975"/>
		<updated>2018-11-09T03:46:51Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Code Snippet */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Code Snippet'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn process(&amp;amp;mut self, mut inputs: Chunk, info: &amp;amp;BlockInfo) -&amp;gt; Chunk {&lt;br /&gt;
         // XXX Implement this properly and according to self.options&lt;br /&gt;
         // as defined in https://webaudio.github.io/web-audio-api/#oscillatornode&lt;br /&gt;
         use std::f64::consts::PI;&lt;br /&gt;
         debug_assert!(inputs.len() == 0);&lt;br /&gt;
         inputs.blocks.push(Default::default());&lt;br /&gt;
         let (start_at, stop_at) = match self.should_play_at(info.frame) {&lt;br /&gt;
             ShouldPlay::No =&amp;gt; {&lt;br /&gt;
                 return inputs;&lt;br /&gt;
             }&lt;br /&gt;
             ShouldPlay::Between(start, end) =&amp;gt; (start, end)&lt;br /&gt;
         };&lt;br /&gt;
 &lt;br /&gt;
         {&lt;br /&gt;
             inputs.blocks[0].explicit_silence();&lt;br /&gt;
             let mut iter = inputs.blocks[0].iter();&lt;br /&gt;
 &lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;'''6/11 - The [https://github.com/servo/servo/pull/19038 Pull Request] was closed and the changes were merged upstream.'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3/11 - Due to 3rd party service issue (Appveyor) our build is facing issues with the continuous integration. We are working with the Servo team to resolve this.&lt;br /&gt;
&lt;br /&gt;
3/11- Members of the servo project informed us that Appveyor build status does not determine the success of a pull request. We were advised to run a bors-servo build and this succeeded. Therefore all build checks necessary for PR to pass have been completed successfully. We are waiting changes to be merged to upstream.&lt;br /&gt;
&lt;br /&gt;
[[File:Issue.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/CJ8664/servo&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/CJ8664/servo.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/servo/blob/master/README.md#building here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 30 minutes, based on your system configuration. You can build on [https://janitor.technology/ Janitor] to reduce the build time.&lt;br /&gt;
&lt;br /&gt;
==='''Building on the cloud'''===&lt;br /&gt;
&lt;br /&gt;
This is the simplest and the fastest way to deploy and test an instance of servo. No configuration is required on your machine. &lt;br /&gt;
&lt;br /&gt;
1. Go to &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;http://janitor.technology&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Click on '''New Container''' for Servo&lt;br /&gt;
&lt;br /&gt;
3. Enter your email address to gain access to your container&lt;br /&gt;
&lt;br /&gt;
4. Once logged in, go '''Containers''' on the top right. &lt;br /&gt;
&lt;br /&gt;
5. You will now see a container - Click on the '''IDE''' button to open your online IDE environment.&lt;br /&gt;
&lt;br /&gt;
6. Change directory to '''/home/user''' and create a new directory, say '''servo_test'''&lt;br /&gt;
&lt;br /&gt;
7. Go to this new directory and clone our repository as mentioned above&lt;br /&gt;
&lt;br /&gt;
8. Upon cloning you should see a /servo directory within 'servo_test' &lt;br /&gt;
&lt;br /&gt;
9. Go to /servo&lt;br /&gt;
&lt;br /&gt;
10. It is now time to build - run the following command: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach build --dev&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If all goes well you will see a success message - 'Build Completed'&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118974</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118974"/>
		<updated>2018-11-09T03:46:04Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sine.png]]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SquareTriangleSawtooth.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Code Snippet'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn process(&amp;amp;mut self, mut inputs: Chunk, info: &amp;amp;BlockInfo) -&amp;gt; Chunk {&lt;br /&gt;
         // XXX Implement this properly and according to self.options&lt;br /&gt;
         // as defined in https://webaudio.github.io/web-audio-api/#oscillatornode&lt;br /&gt;
         use std::f64::consts::PI;&lt;br /&gt;
         debug_assert!(inputs.len() == 0);&lt;br /&gt;
         inputs.blocks.push(Default::default());&lt;br /&gt;
         let (start_at, stop_at) = match self.should_play_at(info.frame) {&lt;br /&gt;
             ShouldPlay::No =&amp;gt; {&lt;br /&gt;
                 return inputs;&lt;br /&gt;
             }&lt;br /&gt;
             ShouldPlay::Between(start, end) =&amp;gt; (start, end)&lt;br /&gt;
         };&lt;br /&gt;
 &lt;br /&gt;
         {&lt;br /&gt;
             inputs.blocks[0].explicit_silence();&lt;br /&gt;
             let mut iter = inputs.blocks[0].iter();&lt;br /&gt;
 &lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;'''6/11 - The [https://github.com/servo/servo/pull/19038 Pull Request] was closed and the changes were merged upstream.'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3/11 - Due to 3rd party service issue (Appveyor) our build is facing issues with the continuous integration. We are working with the Servo team to resolve this.&lt;br /&gt;
&lt;br /&gt;
3/11- Members of the servo project informed us that Appveyor build status does not determine the success of a pull request. We were advised to run a bors-servo build and this succeeded. Therefore all build checks necessary for PR to pass have been completed successfully. We are waiting changes to be merged to upstream.&lt;br /&gt;
&lt;br /&gt;
[[File:Issue.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/CJ8664/servo&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/CJ8664/servo.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/servo/blob/master/README.md#building here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 30 minutes, based on your system configuration. You can build on [https://janitor.technology/ Janitor] to reduce the build time.&lt;br /&gt;
&lt;br /&gt;
==='''Building on the cloud'''===&lt;br /&gt;
&lt;br /&gt;
This is the simplest and the fastest way to deploy and test an instance of servo. No configuration is required on your machine. &lt;br /&gt;
&lt;br /&gt;
1. Go to &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;http://janitor.technology&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Click on '''New Container''' for Servo&lt;br /&gt;
&lt;br /&gt;
3. Enter your email address to gain access to your container&lt;br /&gt;
&lt;br /&gt;
4. Once logged in, go '''Containers''' on the top right. &lt;br /&gt;
&lt;br /&gt;
5. You will now see a container - Click on the '''IDE''' button to open your online IDE environment.&lt;br /&gt;
&lt;br /&gt;
6. Change directory to '''/home/user''' and create a new directory, say '''servo_test'''&lt;br /&gt;
&lt;br /&gt;
7. Go to this new directory and clone our repository as mentioned above&lt;br /&gt;
&lt;br /&gt;
8. Upon cloning you should see a /servo directory within 'servo_test' &lt;br /&gt;
&lt;br /&gt;
9. Go to /servo&lt;br /&gt;
&lt;br /&gt;
10. It is now time to build - run the following command: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach build --dev&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If all goes well you will see a success message - 'Build Completed'&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:SquareTriangleSawtooth.png&amp;diff=118973</id>
		<title>File:SquareTriangleSawtooth.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:SquareTriangleSawtooth.png&amp;diff=118973"/>
		<updated>2018-11-09T03:45:05Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118972</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118972"/>
		<updated>2018-11-09T03:44:43Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function. &lt;br /&gt;
[[File:Sine.png]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:SquareTriangleSawtooth.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Code Snippet'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn process(&amp;amp;mut self, mut inputs: Chunk, info: &amp;amp;BlockInfo) -&amp;gt; Chunk {&lt;br /&gt;
         // XXX Implement this properly and according to self.options&lt;br /&gt;
         // as defined in https://webaudio.github.io/web-audio-api/#oscillatornode&lt;br /&gt;
         use std::f64::consts::PI;&lt;br /&gt;
         debug_assert!(inputs.len() == 0);&lt;br /&gt;
         inputs.blocks.push(Default::default());&lt;br /&gt;
         let (start_at, stop_at) = match self.should_play_at(info.frame) {&lt;br /&gt;
             ShouldPlay::No =&amp;gt; {&lt;br /&gt;
                 return inputs;&lt;br /&gt;
             }&lt;br /&gt;
             ShouldPlay::Between(start, end) =&amp;gt; (start, end)&lt;br /&gt;
         };&lt;br /&gt;
 &lt;br /&gt;
         {&lt;br /&gt;
             inputs.blocks[0].explicit_silence();&lt;br /&gt;
             let mut iter = inputs.blocks[0].iter();&lt;br /&gt;
 &lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;'''6/11 - The [https://github.com/servo/servo/pull/19038 Pull Request] was closed and the changes were merged upstream.'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3/11 - Due to 3rd party service issue (Appveyor) our build is facing issues with the continuous integration. We are working with the Servo team to resolve this.&lt;br /&gt;
&lt;br /&gt;
3/11- Members of the servo project informed us that Appveyor build status does not determine the success of a pull request. We were advised to run a bors-servo build and this succeeded. Therefore all build checks necessary for PR to pass have been completed successfully. We are waiting changes to be merged to upstream.&lt;br /&gt;
&lt;br /&gt;
[[File:Issue.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/CJ8664/servo&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/CJ8664/servo.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/servo/blob/master/README.md#building here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 30 minutes, based on your system configuration. You can build on [https://janitor.technology/ Janitor] to reduce the build time.&lt;br /&gt;
&lt;br /&gt;
==='''Building on the cloud'''===&lt;br /&gt;
&lt;br /&gt;
This is the simplest and the fastest way to deploy and test an instance of servo. No configuration is required on your machine. &lt;br /&gt;
&lt;br /&gt;
1. Go to &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;http://janitor.technology&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Click on '''New Container''' for Servo&lt;br /&gt;
&lt;br /&gt;
3. Enter your email address to gain access to your container&lt;br /&gt;
&lt;br /&gt;
4. Once logged in, go '''Containers''' on the top right. &lt;br /&gt;
&lt;br /&gt;
5. You will now see a container - Click on the '''IDE''' button to open your online IDE environment.&lt;br /&gt;
&lt;br /&gt;
6. Change directory to '''/home/user''' and create a new directory, say '''servo_test'''&lt;br /&gt;
&lt;br /&gt;
7. Go to this new directory and clone our repository as mentioned above&lt;br /&gt;
&lt;br /&gt;
8. Upon cloning you should see a /servo directory within 'servo_test' &lt;br /&gt;
&lt;br /&gt;
9. Go to /servo&lt;br /&gt;
&lt;br /&gt;
10. It is now time to build - run the following command: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach build --dev&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If all goes well you will see a success message - 'Build Completed'&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Sine.png&amp;diff=118971</id>
		<title>File:Sine.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Sine.png&amp;diff=118971"/>
		<updated>2018-11-09T03:43:58Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118970</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118970"/>
		<updated>2018-11-09T03:43:03Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function. &lt;br /&gt;
[[File:Sine.jpg]]&lt;br /&gt;
[[File:SquareTriangleSawtooth.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Code Snippet'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn process(&amp;amp;mut self, mut inputs: Chunk, info: &amp;amp;BlockInfo) -&amp;gt; Chunk {&lt;br /&gt;
         // XXX Implement this properly and according to self.options&lt;br /&gt;
         // as defined in https://webaudio.github.io/web-audio-api/#oscillatornode&lt;br /&gt;
         use std::f64::consts::PI;&lt;br /&gt;
         debug_assert!(inputs.len() == 0);&lt;br /&gt;
         inputs.blocks.push(Default::default());&lt;br /&gt;
         let (start_at, stop_at) = match self.should_play_at(info.frame) {&lt;br /&gt;
             ShouldPlay::No =&amp;gt; {&lt;br /&gt;
                 return inputs;&lt;br /&gt;
             }&lt;br /&gt;
             ShouldPlay::Between(start, end) =&amp;gt; (start, end)&lt;br /&gt;
         };&lt;br /&gt;
 &lt;br /&gt;
         {&lt;br /&gt;
             inputs.blocks[0].explicit_silence();&lt;br /&gt;
             let mut iter = inputs.blocks[0].iter();&lt;br /&gt;
 &lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;'''6/11 - The [https://github.com/servo/servo/pull/19038 Pull Request] was closed and the changes were merged upstream.'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3/11 - Due to 3rd party service issue (Appveyor) our build is facing issues with the continuous integration. We are working with the Servo team to resolve this.&lt;br /&gt;
&lt;br /&gt;
3/11- Members of the servo project informed us that Appveyor build status does not determine the success of a pull request. We were advised to run a bors-servo build and this succeeded. Therefore all build checks necessary for PR to pass have been completed successfully. We are waiting changes to be merged to upstream.&lt;br /&gt;
&lt;br /&gt;
[[File:Issue.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/CJ8664/servo&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/CJ8664/servo.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/servo/blob/master/README.md#building here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 30 minutes, based on your system configuration. You can build on [https://janitor.technology/ Janitor] to reduce the build time.&lt;br /&gt;
&lt;br /&gt;
==='''Building on the cloud'''===&lt;br /&gt;
&lt;br /&gt;
This is the simplest and the fastest way to deploy and test an instance of servo. No configuration is required on your machine. &lt;br /&gt;
&lt;br /&gt;
1. Go to &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;http://janitor.technology&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Click on '''New Container''' for Servo&lt;br /&gt;
&lt;br /&gt;
3. Enter your email address to gain access to your container&lt;br /&gt;
&lt;br /&gt;
4. Once logged in, go '''Containers''' on the top right. &lt;br /&gt;
&lt;br /&gt;
5. You will now see a container - Click on the '''IDE''' button to open your online IDE environment.&lt;br /&gt;
&lt;br /&gt;
6. Change directory to '''/home/user''' and create a new directory, say '''servo_test'''&lt;br /&gt;
&lt;br /&gt;
7. Go to this new directory and clone our repository as mentioned above&lt;br /&gt;
&lt;br /&gt;
8. Upon cloning you should see a /servo directory within 'servo_test' &lt;br /&gt;
&lt;br /&gt;
9. Go to /servo&lt;br /&gt;
&lt;br /&gt;
10. It is now time to build - run the following command: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach build --dev&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If all goes well you will see a success message - 'Build Completed'&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118969</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118969"/>
		<updated>2018-11-09T03:42:05Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OscillatorType&amp;quot; variable is a string which has the name of the waveform associated with it. For each waveform, we calculate the value which is used by the OscilaterNode class to generate a wave. Each type of wave has a particular output. The output is a function of phase, with each waveform having its own function. &lt;br /&gt;
[[File:Example.jpg]]&lt;br /&gt;
[[File:Example.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Code Snippet'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn process(&amp;amp;mut self, mut inputs: Chunk, info: &amp;amp;BlockInfo) -&amp;gt; Chunk {&lt;br /&gt;
         // XXX Implement this properly and according to self.options&lt;br /&gt;
         // as defined in https://webaudio.github.io/web-audio-api/#oscillatornode&lt;br /&gt;
         use std::f64::consts::PI;&lt;br /&gt;
         debug_assert!(inputs.len() == 0);&lt;br /&gt;
         inputs.blocks.push(Default::default());&lt;br /&gt;
         let (start_at, stop_at) = match self.should_play_at(info.frame) {&lt;br /&gt;
             ShouldPlay::No =&amp;gt; {&lt;br /&gt;
                 return inputs;&lt;br /&gt;
             }&lt;br /&gt;
             ShouldPlay::Between(start, end) =&amp;gt; (start, end)&lt;br /&gt;
         };&lt;br /&gt;
 &lt;br /&gt;
         {&lt;br /&gt;
             inputs.blocks[0].explicit_silence();&lt;br /&gt;
             let mut iter = inputs.blocks[0].iter();&lt;br /&gt;
 &lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;'''6/11 - The [https://github.com/servo/servo/pull/19038 Pull Request] was closed and the changes were merged upstream.'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3/11 - Due to 3rd party service issue (Appveyor) our build is facing issues with the continuous integration. We are working with the Servo team to resolve this.&lt;br /&gt;
&lt;br /&gt;
3/11- Members of the servo project informed us that Appveyor build status does not determine the success of a pull request. We were advised to run a bors-servo build and this succeeded. Therefore all build checks necessary for PR to pass have been completed successfully. We are waiting changes to be merged to upstream.&lt;br /&gt;
&lt;br /&gt;
[[File:Issue.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/CJ8664/servo&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/CJ8664/servo.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/servo/blob/master/README.md#building here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 30 minutes, based on your system configuration. You can build on [https://janitor.technology/ Janitor] to reduce the build time.&lt;br /&gt;
&lt;br /&gt;
==='''Building on the cloud'''===&lt;br /&gt;
&lt;br /&gt;
This is the simplest and the fastest way to deploy and test an instance of servo. No configuration is required on your machine. &lt;br /&gt;
&lt;br /&gt;
1. Go to &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;http://janitor.technology&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Click on '''New Container''' for Servo&lt;br /&gt;
&lt;br /&gt;
3. Enter your email address to gain access to your container&lt;br /&gt;
&lt;br /&gt;
4. Once logged in, go '''Containers''' on the top right. &lt;br /&gt;
&lt;br /&gt;
5. You will now see a container - Click on the '''IDE''' button to open your online IDE environment.&lt;br /&gt;
&lt;br /&gt;
6. Change directory to '''/home/user''' and create a new directory, say '''servo_test'''&lt;br /&gt;
&lt;br /&gt;
7. Go to this new directory and clone our repository as mentioned above&lt;br /&gt;
&lt;br /&gt;
8. Upon cloning you should see a /servo directory within 'servo_test' &lt;br /&gt;
&lt;br /&gt;
9. Go to /servo&lt;br /&gt;
&lt;br /&gt;
10. It is now time to build - run the following command: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach build --dev&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If all goes well you will see a success message - 'Build Completed'&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118968</id>
		<title>M1852 Implement missing WebAudio node support</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1852_Implement_missing_WebAudio_node_support&amp;diff=118968"/>
		<updated>2018-11-09T03:08:19Z</updated>

		<summary type="html">&lt;p&gt;Rkolhe: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''== &lt;br /&gt;
&lt;br /&gt;
==='''Servo'''===&lt;br /&gt;
Servo is a modern, high-performance browser engine designed for both application and embedded use and written in the Rust programming language.&lt;br /&gt;
It is currently developed on 64bit OS X, 64bit Linux, and Android.&lt;br /&gt;
&lt;br /&gt;
More information about Servo is available [https://servo.org here]&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''===&lt;br /&gt;
Rust is a systems programming language focuses on memory safety and concurrency. It is similar to C++ but ensures memory safety and high performance.&lt;br /&gt;
&lt;br /&gt;
More information about Rust can be found [https://www.rust-lang.org/en-US/ here]&lt;br /&gt;
&lt;br /&gt;
==='''Web Audio API'''===&lt;br /&gt;
The Web Audio API involves handling audio operations inside an audio context, and has been designed to allow modular routing. Basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. Several sources — with different types of channel layout — are supported even within a single context. This modular design provides the flexibility to create complex audio functions with dynamic effects.&lt;br /&gt;
&lt;br /&gt;
Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave.&lt;br /&gt;
&lt;br /&gt;
Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio.&lt;br /&gt;
&lt;br /&gt;
A simple, typical workflow for web audio would look something like this:&lt;br /&gt;
&lt;br /&gt;
1. Create audio context&amp;lt;br&amp;gt;&lt;br /&gt;
2. Inside the context, create sources — such as &amp;lt;audio&amp;gt;, oscillator, stream&amp;lt;br&amp;gt;&lt;br /&gt;
3. Create effects nodes, such as reverb, biquad filter, panner, compressor&amp;lt;br&amp;gt;&lt;br /&gt;
4. Choose final destination of audio, for example your system speakers&amp;lt;br&amp;gt;&lt;br /&gt;
5. Connect the sources up to the effects, and the effects to the destination.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=='''Scope'''==&lt;br /&gt;
Major browsers support the WebAudio standard which can be used to create complex media playback applications from low-level building blocks. Servo is a new, experimental browser that supports some of these building blocks (called audio nodes); the goal of this project is to to improve compatibility with web content that relies on the WebAudio API by implementing missing pieces of incomplete node types (OscillatorNode) along with entire missing nodes (ConstantSourceNode, StereoPannerNode, IIRFilterNode).&lt;br /&gt;
&lt;br /&gt;
Additional project information is available [https://github.com/servo/servo/wiki/WebAudio-nodes-student-project#implement-support-for-several-missing-webaudio-node-types here]&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The implementation involved audio processing for Sine, Square, Sawtooth and Triangle waveforms. We created a oscillator.rs file which includes examples of the given waveforms. These waveforms can be visualized using the given image:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Waveform.jpg]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Code Snippet'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn process(&amp;amp;mut self, mut inputs: Chunk, info: &amp;amp;BlockInfo) -&amp;gt; Chunk {&lt;br /&gt;
         // XXX Implement this properly and according to self.options&lt;br /&gt;
         // as defined in https://webaudio.github.io/web-audio-api/#oscillatornode&lt;br /&gt;
         use std::f64::consts::PI;&lt;br /&gt;
         debug_assert!(inputs.len() == 0);&lt;br /&gt;
         inputs.blocks.push(Default::default());&lt;br /&gt;
         let (start_at, stop_at) = match self.should_play_at(info.frame) {&lt;br /&gt;
             ShouldPlay::No =&amp;gt; {&lt;br /&gt;
                 return inputs;&lt;br /&gt;
             }&lt;br /&gt;
             ShouldPlay::Between(start, end) =&amp;gt; (start, end)&lt;br /&gt;
         };&lt;br /&gt;
 &lt;br /&gt;
         {&lt;br /&gt;
             inputs.blocks[0].explicit_silence();&lt;br /&gt;
             let mut iter = inputs.blocks[0].iter();&lt;br /&gt;
 &lt;br /&gt;
             // Convert all our parameters to the target type for calculations&lt;br /&gt;
             let vol: f32 = 1.0;&lt;br /&gt;
             let sample_rate = info.sample_rate as f64;&lt;br /&gt;
             let two_pi = 2.0 * PI;&lt;br /&gt;
 &lt;br /&gt;
             // We're carrying a phase with up to 2pi around instead of working&lt;br /&gt;
             // on the sample offset. High sample offsets cause too much inaccuracy when&lt;br /&gt;
             // converted to floating point numbers and then iterated over in 1-steps&lt;br /&gt;
             //&lt;br /&gt;
             // Also, if the frequency changes the phase should not&lt;br /&gt;
             let mut step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
             while let Some(mut frame) = iter.next() {&lt;br /&gt;
                 let tick = frame.tick();&lt;br /&gt;
                 if tick &amp;lt; start_at {&lt;br /&gt;
                     continue&lt;br /&gt;
                 } else if tick &amp;gt; stop_at {&lt;br /&gt;
                     break;&lt;br /&gt;
                 }&lt;br /&gt;
 &lt;br /&gt;
                 if self.update_parameters(info, tick) {&lt;br /&gt;
                     step = two_pi * self.frequency.value() as f64 / sample_rate;&lt;br /&gt;
                 }&lt;br /&gt;
                 let mut value = vol;&lt;br /&gt;
&lt;br /&gt;
                 //Based on the type of wave, the value is calculated using the formulae for the respective waveform &lt;br /&gt;
                 match self.oscillator_type {&lt;br /&gt;
                     OscillatorType::Sine =&amp;gt; {&lt;br /&gt;
                         value = vol * f32::sin(NumCast::from(self.phase).unwrap());&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Square =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; two_pi {&lt;br /&gt;
                                     value = vol * 1.0;&lt;br /&gt;
                                 }&lt;br /&gt;
                                 else if self.phase &amp;gt; 0.0 &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                                     value = vol * (-1.0);&lt;br /&gt;
                                 }&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Sawtooth =&amp;gt; {&lt;br /&gt;
                         value = vol * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                     }&lt;br /&gt;
 &lt;br /&gt;
                     OscillatorType::Triangle =&amp;gt; {&lt;br /&gt;
                         if self.phase &amp;gt;= 0. &amp;amp;&amp;amp; self.phase &amp;lt; PI/2.{&lt;br /&gt;
                             value = vol * 2.0 * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; PI {&lt;br /&gt;
                             value = vol * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= PI &amp;amp;&amp;amp; self.phase &amp;lt; (3.* PI/2.) {&lt;br /&gt;
                             value = vol * -1. * ( 1. - ( ( (self.phase as f64) - (PI/2.)) * (2./PI) ) as f32 );&lt;br /&gt;
                         }&lt;br /&gt;
                         else if self.phase &amp;gt;= 3.*PI/2. &amp;amp;&amp;amp; self.phase &amp;lt; 2.*PI {&lt;br /&gt;
                             value = vol * (-2.0) * ((self.phase as f64) / (PI)) as f32;&lt;br /&gt;
                         }&lt;br /&gt;
                     }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the code, different sound patterns are created with respect to each waveform (Sine, Square, Sawtooth, Triangle)&lt;br /&gt;
&lt;br /&gt;
The first step is to setup the environment for the media backend implementation. This includes cloning the servo/media directory and building it locally on the system. Once the cloning process is successfully completed, simply run : &amp;lt;b&amp;gt;cargo build&amp;lt;/b&amp;gt;. This will add all the dependencies and compile the required rust crates(libraries).&lt;br /&gt;
&lt;br /&gt;
=='''Build'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;'''6/11 - The [https://github.com/servo/servo/pull/19038 Pull Request] was closed and the changes were merged upstream.'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3/11 - Due to 3rd party service issue (Appveyor) our build is facing issues with the continuous integration. We are working with the Servo team to resolve this.&lt;br /&gt;
&lt;br /&gt;
3/11- Members of the servo project informed us that Appveyor build status does not determine the success of a pull request. We were advised to run a bors-servo build and this succeeded. Therefore all build checks necessary for PR to pass have been completed successfully. We are waiting changes to be merged to upstream.&lt;br /&gt;
&lt;br /&gt;
[[File:Issue.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have opened our pull request and are working on getting it merged based on the reviews received. Please use our forked repository till the pull request is merged.&lt;br /&gt;
&lt;br /&gt;
Forked repository: &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;https://github.com/CJ8664/servo&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone command using git:&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;git clone https://github.com/CJ8664/servo.git&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the forked repo, please follow steps [https://github.com/servo/servo/blob/master/README.md#building here] to do a build.&lt;br /&gt;
&lt;br /&gt;
Note that build may take up to 30 minutes, based on your system configuration. You can build on [https://janitor.technology/ Janitor] to reduce the build time.&lt;br /&gt;
&lt;br /&gt;
==='''Building on the cloud'''===&lt;br /&gt;
&lt;br /&gt;
This is the simplest and the fastest way to deploy and test an instance of servo. No configuration is required on your machine. &lt;br /&gt;
&lt;br /&gt;
1. Go to &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;http://janitor.technology&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Click on '''New Container''' for Servo&lt;br /&gt;
&lt;br /&gt;
3. Enter your email address to gain access to your container&lt;br /&gt;
&lt;br /&gt;
4. Once logged in, go '''Containers''' on the top right. &lt;br /&gt;
&lt;br /&gt;
5. You will now see a container - Click on the '''IDE''' button to open your online IDE environment.&lt;br /&gt;
&lt;br /&gt;
6. Change directory to '''/home/user''' and create a new directory, say '''servo_test'''&lt;br /&gt;
&lt;br /&gt;
7. Go to this new directory and clone our repository as mentioned above&lt;br /&gt;
&lt;br /&gt;
8. Upon cloning you should see a /servo directory within 'servo_test' &lt;br /&gt;
&lt;br /&gt;
9. Go to /servo&lt;br /&gt;
&lt;br /&gt;
10. It is now time to build - run the following command: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach build --dev&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If all goes well you will see a success message - 'Build Completed'&lt;br /&gt;
&lt;br /&gt;
==='''Building locally'''===&lt;br /&gt;
&lt;br /&gt;
Local build instructions for Windows environments are given below - &lt;br /&gt;
&lt;br /&gt;
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). &lt;br /&gt;
&lt;br /&gt;
The Windows x86-64 MSI installer is fine. You should change the installation to install the &amp;quot;Add python.exe to Path&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
2. Install virtualenv.&lt;br /&gt;
&lt;br /&gt;
In a normal Windows Shell (cmd.exe or &amp;quot;Command Prompt&amp;quot; from the start menu), do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;pip install virtualenv&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default settings for the installer are fine).&lt;br /&gt;
&lt;br /&gt;
4. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). &lt;br /&gt;
&lt;br /&gt;
You MUST add &amp;quot;Visual C++&amp;quot; to the list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.&lt;br /&gt;
&lt;br /&gt;
If you encountered errors with the environment above, do the following for a workaround:&lt;br /&gt;
&lt;br /&gt;
Download and install Build Tools for Visual Studio 2017&lt;br /&gt;
&lt;br /&gt;
Install python2.7 x86-x64 and virtualenv&lt;br /&gt;
&lt;br /&gt;
5. Run &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;mach.bat build -d&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt; to build&lt;br /&gt;
&lt;br /&gt;
If you have troubles with x64 type prompt as mach.bat set by default:&lt;br /&gt;
&lt;br /&gt;
you may need to choose and launch the type manually, such as x86_x64 Cross Tools Command Prompt for VS 2017 in the Windows menu.)&lt;br /&gt;
&lt;br /&gt;
cd to/the/path/servo&lt;br /&gt;
&lt;br /&gt;
python mach build -d&lt;br /&gt;
&lt;br /&gt;
Build instructions for all other environments are available [https://github.com/servo/servo here]&lt;br /&gt;
&lt;br /&gt;
==='''Verifying a build'''===&lt;br /&gt;
&lt;br /&gt;
We can quickly verify if the servo build is working by running the command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;code&amp;gt;'./mach run http://www.google.com'&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open a browser instance rendering the Google homepage. &lt;br /&gt;
&lt;br /&gt;
This should be straightforward on any environment that has rendering support - Linus, Windows, MacOS, Android&lt;br /&gt;
&lt;br /&gt;
If you are on Janitor environment, it's IDE will not provide rendering support. You might receive an error along the lines of 'No renderer found' upon executing the command.&lt;br /&gt;
&lt;br /&gt;
'''Workaround''': On the 'Container' page on janitor.technology click on '''VNC''' for your container. Click '''Connect''' on the new tab that opens up.&lt;br /&gt;
&lt;br /&gt;
You should now have remote access to a UI with a command line. Simply run the above command and the web page should render.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Testing Approach'''&lt;br /&gt;
&lt;br /&gt;
Since our implementation adds the Microdata tags into the DOM, the approach used for testing is to directly query the DOM tree using JavaScript to detect the presence of Microdata in an HTML tag within the DOM. This will confirm if the engine was able to parse these tags and add them to the DOM.&lt;br /&gt;
Also, as per the microdata specifications, the tags can be contained in any HTML tag. Therefore, the test data consists of several HTML tags like 'div', 'ul', 'li', 'span' etc.  each with a microdata ('itemprop' and 'itemtype') attribute. &lt;br /&gt;
&lt;br /&gt;
'''Test Framework'''&lt;br /&gt;
&lt;br /&gt;
We have used the 'web-platform-tests' (WPT) suite for testing. It is an existing test suite used in the Servo project. It generally consists of two test types: JavaScript tests (to test DOM features, for example) written using the testharness.js library and reference tests (to test rendered output with what's expected to ensure that the rendering is done properly) written using the W3C reftest format. Since the microdata tags do not render anything on the page, only DOM testing is in scope. &lt;br /&gt;
&lt;br /&gt;
testharness.js has been used to write the tests; it complements our testing approach as it can be called directly via JS within an HTML page. It provides a convenient API for making common assertions, and to work both for testing synchronous and asynchronous DOM features in a way that promotes clear, robust, tests. &lt;br /&gt;
&lt;br /&gt;
testharness.js returns the result of the test directly from the html page which is then used by WPT to interpret the result of the test.&lt;br /&gt;
&lt;br /&gt;
'''Test Cases'''&lt;br /&gt;
&lt;br /&gt;
In order to test our implementation, the following scenarios have been evaluated.&lt;br /&gt;
&lt;br /&gt;
'''Attribute with a single value should be stored properly''' &lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc1.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Space separated values in the attributes should be stored as different values'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Duplicate occurrence of attributes should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc3.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''Extra whitespace in the attribute list should be ignored'''&lt;br /&gt;
&lt;br /&gt;
Input Data &lt;br /&gt;
&lt;br /&gt;
[[File:tc4.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e4.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Attribute has not been set (null or empty)'''&lt;br /&gt;
&lt;br /&gt;
Input Data&lt;br /&gt;
&lt;br /&gt;
[[File:tc5.PNG]]&lt;br /&gt;
&lt;br /&gt;
Test Script&lt;br /&gt;
&lt;br /&gt;
[[File:e5.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Testing Steps'''&lt;br /&gt;
&lt;br /&gt;
Please read and perform the actions on the Build and Verification sections properly before testing.&lt;br /&gt;
&lt;br /&gt;
1) Run the command &amp;lt;big&amp;gt;&amp;lt;code&amp;gt;./mach tests-wpt /tests/wpt/mozilla/tests/mozilla/microdata/&amp;lt;/code&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) A webpage should render showing the status of the test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the output of test-wpt after the tests have been run successfully.&lt;br /&gt;
&lt;br /&gt;
[[File:Tests.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''Dependencies'''===&lt;br /&gt;
'''html5ever''' - HTML attribute names are fetched in Servo from a lookup file in the html5ever module. The html5ever module was augmented with the 'itemprop' and 'itemtype' attributes for use in Servo. &lt;br /&gt;
&lt;br /&gt;
==='''Pull Request'''===&lt;br /&gt;
&lt;br /&gt;
The pull request used to incorporate our changes upstream is available [https://github.com/servo/servo/pull/19038 here]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
http://html5doctor.com/microdata/  &lt;br /&gt;
&lt;br /&gt;
http://web-platform-tests.org/writing-tests/testharness-api.html&lt;br /&gt;
&lt;br /&gt;
https://html.spec.whatwg.org/multipage/microdata.html  &lt;br /&gt;
&lt;br /&gt;
https://code.tutsplus.com/tutorials/html5-microdata-welcome-to-the-machine--net-12356  &lt;br /&gt;
&lt;br /&gt;
http://www.servo.org&lt;/div&gt;</summary>
		<author><name>Rkolhe</name></author>
	</entry>
</feed>