Updates from February, 2011 Toggle Comment Threads | Keyboard Shortcuts

  • hilalkoyuncu 11:27 pm on February 3, 2011 Permalink | Reply  

    Hilal’s talking robot, internal organs exposed 

    My arduino has this whole speech for you, click to listen.

    http://www.youtube.com/watch?v=3BFc1iQ1TqU

    Sounds/Codes:

    Pitch library that I created for ardu: hilal_pitch.h

    
    #define A0	9091
    #define A0S	8581
    #define B_0	8099
    #define C1	7644
    #define C1S	7216
    #define D1	6811
    #define D1S	6428
    #define E1	6068
    #define F1	5727
    #define F1S	5405
    #define G1	5102
    #define G1S	4816
    #define A1	4545
    #define A1S	4290
    #define B_1	4050
    #define C2	3822
    #define C2S	3608
    #define D2	3405
    #define D2S	3214
    #define E2	3034
    #define F2	2863
    #define F2S	2703
    #define G2	2551
    #define G2S	2408
    #define A2	2273
    #define A2S	2145
    #define B2	2025
    #define C3	1911
    #define C3S	1804
    #define D3	1703
    #define D3S	1607
    #define E3	1517
    #define F3	1432
    #define F3S	1351
    #define G3	1276
    #define G3S	1204
    #define A3	1136
    #define A3S	1073
    #define B3	1012
    #define C4	956
    #define C4S	902
    #define D4	851
    #define D4S	804
    #define E4	758
    #define F4	716
    #define F4S	676
    #define G4	638
    #define G4S	602
    #define A4	568
    #define A4S	536
    #define B4	506
    #define C5	478
    #define C5S	451
    #define D5	426
    #define D5S	402
    #define E5	379
    #define F5	358
    #define F5S	338
    #define G5	319
    #define G5S	301
    #define A5	284
    #define A5S	268
    #define B5	253
    #define C6	239
    #define C6S	225
    #define D6	213
    #define D6S	201
    #define E6	190
    #define F6	179
    #define F6S	169
    #define G6	159
    #define G6S	150
    #define A6	142
    #define A6S	134
    #define B6	127
    #define C7	119
    #define C7S	113
    #define D7	106
    #define D7S	100
    #define E7	95
    #define F7	89
    #define F7S	84
    #define G7	80
    #define G7S	75
    #define A7	71
    #define A7S	67
    #define B7	63
    #define C8	60
    #define  R     0
    
    

    Hello I’m on! :

     
    /* Play HelloImOn 
     * -----------
     *
     * Program to play a simple HelloImOn 
     *
     * Tones are created by quickly pulsing a speaker on and off 
     *   using PWM, to create signature frequencies.
     *
     * Each note has a frequency, created by varying the period of 
     *  vibration, measured in microseconds. We'll use pulse-width
     *  modulation (PWM) to create that vibration.
    
     * We calculate the pulse-width to be half the period; we pulse 
     *  the speaker HIGH for 'pulse-width' microseconds, then LOW 
     *  for 'pulse-width' microseconds.
     *  This pulsing creates a vibration of the desired frequency.
     *
     * (cleft) 2005 D. Cuartielles for K3
     * Refactoring and comments 2006 clay.shirky@nyu.edu
     * See NOTES in comments at end for possible improvements
     */
    
    // TONES  ==========================================
    // Start by defining the relationship between 
    //       note, period, &  frequency. 
    
    
    // SETUP ============================================
    
     #include "hilal_pitch.h"
     
    // Set up speaker on a PWM pin (digital 9, 10 or 11)
    int speakerOut = 9;
    // Do we want debugging on serial out? 1 for yes, 0 for no
    int DEBUG = 1;
    
    void setup() { 
      pinMode(speakerOut, OUTPUT);
      if (DEBUG) { 
        Serial.begin(9600); // Set serial out if we want debugging
      } 
    }
    
    // HelloImOn  and TIMING  =======================================
    //  HelloImOn [] is an array of notes, accompanied by beats[], 
    //  which sets each note's relative length (higher #, longer note) 
    
    int HelloImOn[] = { F2S, A2, D3, F3S, A3, D5S,  R };
    int beats[]  = { 8, 8, 8, 8, 8, 32, 16};
    int MAX_COUNT = sizeof(HelloImOn )/2; // HelloImOn  length, for looping.
    
    // Set overall tempo
    long tempo = 10000;
    // Set length of pause between notes
    int pause = 1000;
    // Loop variable to increase Rest length
    int rest_count = 110; //<-BLETCHEROUS HACK; See NOTES
    
    // Initialize core variables
    int ton = 0;
    int beat = 0;
    long duration  = 0;
    
    // PLAY TONE  ==============================================
    // Pulse the speaker to play a tone for a particular duration
    void playTone() {
      long elapsed_time = 0;
      if (ton > 0) { // if this isn't a Rest beat, while the tone has 
        //  played less long than 'duration', pulse speaker HIGH and LOW
        while (elapsed_time < duration) {
    
          digitalWrite(speakerOut,HIGH);
          delayMicroseconds(ton / 2);
    
          // DOWN
          digitalWrite(speakerOut, LOW);
          delayMicroseconds(ton / 2);
    
          // Keep track of how long we pulsed
          elapsed_time += (ton);
        } 
      }
      else { // Rest beat; loop times delay
        for (int j = 0; j < rest_count; j++) { // See NOTE on rest_count
          delayMicroseconds(duration);  
        }                                
      }                                 
    }
    
    // LET THE WILD RUMPUS BEGIN =============================
    void loop() {
      // Set up a counter to pull from HelloImOn [] and beats[]
      for (int i=0; i<MAX_COUNT; i++) {
        ton = HelloImOn [i];
        beat = beats[i];
    
        duration = beat * tempo; // Set up timing
    
        playTone(); 
        // A pause between notes...
        delayMicroseconds(pause);
    
        if (DEBUG) { // If debugging, report loop, tone, beat, and duration
          Serial.print(i);
          Serial.print(":");
          Serial.print(beat);
          Serial.print(" ");    
          Serial.print(ton);
          Serial.print(" ");
          Serial.println(duration);
        }
      }
    }
    
    /*
     * NOTES
     * The program purports to hold a tone for 'duration' microseconds.
     *  Lies lies lies! It holds for at least 'duration' microseconds, _plus_
     *  any overhead created by incremeting elapsed_time (could be in excess of 
     *  3K microseconds) _plus_ overhead of looping and two digitalWrites()
     *  
     * As a result, a tone of 'duration' plays much more slowly than a rest
     *  of 'duration.' rest_count creates a loop variable to bring 'rest' beats 
     *  in line with 'tone' beats of the same length. 
     * 
     * rest_count will be affected by chip architecture and speed, as well as 
     *  overhead from any program mods. Past behavior is no guarantee of future 
     *  performance. Your mileage may vary. Light fuse and get away.
     *  
     * This could use a number of enhancements:
     * ADD code to let the programmer specify how many times the HelloImOn  should
     *     loop before stopping
     * ADD another octave
     * MOVE tempo, pause, and rest_count to #define statements
     * RE-WRITE to include volume, using analogWrite, as with the second program at
     *          http://www.arduino.cc/en/Tutorial/PlayHelloImOn 
     * ADD code to make the tempo settable by pot or other input device
     * ADD code to take tempo or volume settable by serial communication 
     *          (Requires 0005 or higher.)
     * ADD code to create a tone offset (higer or lower) through pot etc
     * REPLACE random HelloImOn  with opening bars to 'Smoke on the Water'
     */
    
    
    
    

    Yes!:

     
    /* Play Yes
     * -----------
     *
     * Program to play a simple Yes
     *
     * Tones are created by quickly pulsing a speaker on and off 
     *   using PWM, to create signature frequencies.
     *
     * Each note has a frequency, created by varying the period of 
     *  vibration, measured in microseconds. We'll use pulse-width
     *  modulation (PWM) to create that vibration.
    
     * We calculate the pulse-width to be half the period; we pulse 
     *  the speaker HIGH for 'pulse-width' microseconds, then LOW 
     *  for 'pulse-width' microseconds.
     *  This pulsing creates a vibration of the desired frequency.
     *
     * (cleft) 2005 D. Cuartielles for K3
     * Refactoring and comments 2006 clay.shirky@nyu.edu
     * See NOTES in comments at end for possible improvements
     */
    
    // TONES  ==========================================
    // Start by defining the relationship between 
    //       note, period, &  frequency. 
    
     #include "hilal_pitch.h"
     
    // SETUP ============================================
    // Set up speaker on a PWM pin (digital 9, 10 or 11)
    int speakerOut = 9;
    // Do we want debugging on serial out? 1 for yes, 0 for no
    int DEBUG = 1;
    
    void setup() { 
      pinMode(speakerOut, OUTPUT);
      if (DEBUG) { 
        Serial.begin(9600); // Set serial out if we want debugging
      } 
    }
    
    // Yes and TIMING  =======================================
    //  Yes[] is an array of notes, accompanied by beats[], 
    //  which sets each note's relative length (higher #, longer note) 
     
    int Yes[] = {F3S,F3S,R };
    int beats[]  = { 8,8, 16};
    int MAX_COUNT = sizeof(Yes)/2; // Yes length, for looping.
    
    // Set overall tempo
    long tempo = 10000;
    // Set length of pause between notes
    int pause = 1000;
    // Loop variable to increase Rest length
    int rest_count = 110; //<-BLETCHEROUS HACK; See NOTES
    
    // Initialize core variables
    int ton = 0;
    int beat = 0;
    long duration  = 0;
    
    // PLAY TONE  ==============================================
    // Pulse the speaker to play a tone for a particular duration
    void playTone() {
      long elapsed_time = 0;
      if (ton > 0) { // if this isn't a Rest beat, while the tone has 
        //  played less long than 'duration', pulse speaker HIGH and LOW
        while (elapsed_time < duration) {
    
          digitalWrite(speakerOut,HIGH);
          delayMicroseconds(ton / 2);
    
          // DOWN
          digitalWrite(speakerOut, LOW);
          delayMicroseconds(ton / 2);
    
          // Keep track of how long we pulsed
          elapsed_time += (ton);
        } 
      }
      else { // Rest beat; loop times delay
        for (int j = 0; j < rest_count; j++) { // See NOTE on rest_count
          delayMicroseconds(duration);  
        }                                
      }                                 
    }
    
    // LET THE WILD RUMPUS BEGIN =============================
    void loop() {
      // Set up a counter to pull from Yes[] and beats[]
      for (int i=0; i<MAX_COUNT; i++) {
        ton = Yes[i];
        beat = beats[i];
    
        duration = beat * tempo; // Set up timing
    
        playTone(); 
        // A pause between notes...
        delayMicroseconds(pause);
    
        if (DEBUG) { // If debugging, report loop, tone, beat, and duration
          Serial.print(i);
          Serial.print(":");
          Serial.print(beat);
          Serial.print(" ");    
          Serial.print(ton);
          Serial.print(" ");
          Serial.println(duration);
        }
      }
    }
    
    /*
     * NOTES
     * The program purports to hold a tone for 'duration' microseconds.
     *  Lies lies lies! It holds for at least 'duration' microseconds, _plus_
     *  any overhead created by incremeting elapsed_time (could be in excess of 
     *  3K microseconds) _plus_ overhead of looping and two digitalWrites()
     *  
     * As a result, a tone of 'duration' plays much more slowly than a rest
     *  of 'duration.' rest_count creates a loop variable to bring 'rest' beats 
     *  in line with 'tone' beats of the same length. 
     * 
     * rest_count will be affected by chip architecture and speed, as well as 
     *  overhead from any program mods. Past behavior is no guarantee of future 
     *  performance. Your mileage may vary. Light fuse and get away.
     *  
     * This could use a number of enhancements:
     * ADD code to let the programmer specify how many times the Yes should
     *     loop before stopping
     * ADD another octave
     * MOVE tempo, pause, and rest_count to #define statements
     * RE-WRITE to include volume, using analogWrite, as with the second program at
     *          http://www.arduino.cc/en/Tutorial/PlayYes
     * ADD code to make the tempo settable by pot or other input device
     * ADD code to take tempo or volume settable by serial communication 
     *          (Requires 0005 or higher.)
     * ADD code to create a tone offset (higer or lower) through pot etc
     * REPLACE random Yes with opening bars to 'Smoke on the Water'
     */
    
    
    
    

    I’m growing!!!:

     
    /* Play ImGrowing
     * -----------
     *
     * Program to play a simple ImGrowing
     *
     * Tones are created by quickly pulsing a speaker on and off 
     *   using PWM, to create signature frequencies.
     *
     * Each note has a frequency, created by varying the period of 
     *  vibration, measured in microseconds. We'll use pulse-width
     *  modulation (PWM) to create that vibration.
    
     * We calculate the pulse-width to be half the period; we pulse 
     *  the speaker HIGH for 'pulse-width' microseconds, then LOW 
     *  for 'pulse-width' microseconds.
     *  This pulsing creates a vibration of the desired frequency.
     *
     * (cleft) 2005 D. Cuartielles for K3
     * Refactoring and comments 2006 clay.shirky@nyu.edu
     * See NOTES in comments at end for possible improvements
     */
    
    // TONES  ==========================================
    // Start by defining the relationship between 
    //       note, period, &  frequency. 
    
    
    // Define a special note, 'R', to represent a rest
    
    
    
    
    // SETUP ============================================
    
    #include "hilal_pitch.h"
    
    // Set up speaker on a PWM pin (digital 9, 10 or 11)
    
    
    "
    
    int speakerOut = 9;
    // Do we want debugging on serial out? 1 for yes, 0 for no
    int DEBUG = 1;
    
    void setup() { 
      pinMode(speakerOut, OUTPUT);
      if (DEBUG) { 
        Serial.begin(9600); // Set serial out if we want debugging
      } 
    }
    
    // ImGrowing and TIMING  =======================================
    //  ImGrowing[] is an array of notes, accompanied by beats[], 
    //  which sets each note's relative length (higher #, longer note) 
     
    int ImGrowing[] = {C3,D3,E3,F3,G3,A3,B3,C4,D4,E4,F4,G4,A4,B4,C5S, R };
    int beats[]  = {4,4,4,4,4,4,4,4,4,4,4,4,4,4,24,8};
    int MAX_COUNT = sizeof(ImGrowing)/2; // ImGrowing length, for looping.
    
    // Set overall tempo
    long tempo = 10000;
    // Set length of pause between notes
    int pause = 1000;
    // Loop variable to increase Rest length
    int rest_count = 110; //<-BLETCHEROUS HACK; See NOTES
    
    // Initialize core variables
    int ton = 0;
    int beat = 0;
    long duration  = 0;
    
    // PLAY TONE  ==============================================
    // Pulse the speaker to play a tone for a particular duration
    void playTone() {
      long elapsed_time = 0;
      if (ton > 0) { // if this isn't a Rest beat, while the tone has 
        //  played less long than 'duration', pulse speaker HIGH and LOW
        while (elapsed_time < duration) {
    
          digitalWrite(speakerOut,HIGH);
          delayMicroseconds(ton / 2);
    
          // DOWN
          digitalWrite(speakerOut, LOW);
          delayMicroseconds(ton / 2);
    
          // Keep track of how long we pulsed
          elapsed_time += (ton);
        } 
      }
      else { // Rest beat; loop times delay
        for (int j = 0; j < rest_count; j++) { // See NOTE on rest_count
          delayMicroseconds(duration);  
        }                                
      }                                 
    }
    
    // LET THE WILD RUMPUS BEGIN =============================
    void loop() {
      // Set up a counter to pull from ImGrowing[] and beats[]
      for (int i=0; i<MAX_COUNT; i++) {
        ton = ImGrowing[i];
        beat = beats[i];
    
        duration = beat * tempo; // Set up timing
    
        playTone(); 
        // A pause between notes...
        delayMicroseconds(pause);
    
        if (DEBUG) { // If debugging, report loop, tone, beat, and duration
          Serial.print(i);
          Serial.print(":");
          Serial.print(beat);
          Serial.print(" ");    
          Serial.print(ton);
          Serial.print(" ");
          Serial.println(duration);
        }
      }
    }
    
    /*
     * NOTES
     * The program purports to hold a tone for 'duration' microseconds.
     *  Lies lies lies! It holds for at least 'duration' microseconds, _plus_
     *  any overhead created by incremeting elapsed_time (could be in excess of 
     *  3K microseconds) _plus_ overhead of looping and two digitalWrites()
     *  
     * As a result, a tone of 'duration' plays much more slowly than a rest
     *  of 'duration.' rest_count creates a loop variable to bring 'rest' beats 
     *  in line with 'tone' beats of the same length. 
     * 
     * rest_count will be affected by chip architecture and speed, as well as 
     *  overhead from any program mods. Past behavior is no guarantee of future 
     *  performance. Your mileage may vary. Light fuse and get away.
     *  
     * This could use a number of enhancements:
     * ADD code to let the programmer specify how many times the ImGrowing should
     *     loop before stopping
     * ADD another octave
     * MOVE tempo, pause, and rest_count to #define statements
     * RE-WRITE to include volume, using analogWrite, as with the second program at
     *          http://www.arduino.cc/en/Tutorial/PlayImGrowing
     * ADD code to make the tempo settable by pot or other input device
     * ADD code to take tempo or volume settable by serial communication 
     *          (Requires 0005 or higher.)
     * ADD code to create a tone offset (higer or lower) through pot etc
     * REPLACE random ImGrowing with opening bars to 'Smoke on the Water'
     */
    
    
    
    

    I’m happy:

    
    
    // Define a special note, 'R', to represent a rest
    
    
    // SETUP ============================================
    
     #include "hilal_pitch.h"
     
    // Set up speaker on a PWM pin (digital 9, 10 or 11)
    int speakerOut = 9;
    // Do we want debugging on serial out? 1 for yes, 0 for no
    int DEBUG = 1;
    
    void setup() { 
      pinMode(speakerOut, OUTPUT);
      if (DEBUG) { 
        Serial.begin(9600); // Set serial out if we want debugging
      } 
    }
    
    // ImHappy and TIMING  =======================================
    //  ImHappy[] is an array of notes, accompanied by beats[], 
    //  which sets each note's relative length (higher #, longer note) 
     
    int ImHappy[] = {C3S,R, C3S,F3S,R };
    int beats[]  = { 16, 2, 8, 64, 32 };
    int MAX_COUNT = sizeof(ImHappy)/2; // ImHappy length, for looping.
    
    // Set overall tempo
    long tempo = 10000;
    // Set length of pause between notes
    int pause = 1000;
    // Loop variable to increase Rest length
    int rest_count = 110; //<-BLETCHEROUS HACK; See NOTES
    
    // Initialize core variables
    int ton = 0;
    int beat = 0;
    long duration  = 0;
    
    // PLAY TONE  ==============================================
    // Pulse the speaker to play a tone for a particular duration
    void playTone() {
      long elapsed_time = 0;
      if (ton > 0) { // if this isn't a Rest beat, while the tone has 
        //  played less long than 'duration', pulse speaker HIGH and LOW
        while (elapsed_time < duration) {
    
          digitalWrite(speakerOut,HIGH);
          delayMicroseconds(ton / 2);
    
          // DOWN
          digitalWrite(speakerOut, LOW);
          delayMicroseconds(ton / 2);
    
          // Keep track of how long we pulsed
          elapsed_time += (ton);
        } 
      }
      else { // Rest beat; loop times delay
        for (int j = 0; j < rest_count; j++) { // See NOTE on rest_count
          delayMicroseconds(duration);  
        }                                
      }                                 
    }
    
    // LET THE WILD RUMPUS BEGIN =============================
    void loop() {
      // Set up a counter to pull from ImHappy[] and beats[]
      for (int i=0; i<MAX_COUNT; i++) {
        ton = ImHappy[i];
        beat = beats[i];
    
        duration = beat * tempo; // Set up timing
    
        playTone(); 
        // A pause between notes...
        delayMicroseconds(pause);
    
        if (DEBUG) { // If debugging, report loop, tone, beat, and duration
          Serial.print(i);
          Serial.print(":");
          Serial.print(beat);
          Serial.print(" ");    
          Serial.print(ton);
          Serial.print(" ");
          Serial.println(duration);
        }
      }
    }
    
    /*
     * NOTES
     * The program purports to hold a tone for 'duration' microseconds.
     *  Lies lies lies! It holds for at least 'duration' microseconds, _plus_
     *  any overhead created by incremeting elapsed_time (could be in excess of 
     *  3K microseconds) _plus_ overhead of looping and two digitalWrites()
     *  
     * As a result, a tone of 'duration' plays much more slowly than a rest
     *  of 'duration.' rest_count creates a loop variable to bring 'rest' beats 
     *  in line with 'tone' beats of the same length. 
     * 
     * rest_count will be affected by chip architecture and speed, as well as 
     *  overhead from any program mods. Past behavior is no guarantee of future 
     *  performance. Your mileage may vary. Light fuse and get away.
     *  
     * This could use a number of enhancements:
     * ADD code to let the programmer specify how many times the ImHappy should
     *     loop before stopping
     * ADD another octave
     * MOVE tempo, pause, and rest_count to #define statements
     * RE-WRITE to include volume, using analogWrite, as with the second program at
     *          http://www.arduino.cc/en/Tutorial/PlayImHappy
     * ADD code to make the tempo settable by pot or other input device
     * ADD code to take tempo or volume settable by serial communication 
     *          (Requires 0005 or higher.)
     * ADD code to create a tone offset (higer or lower) through pot etc
     * REPLACE random ImHappy with opening bars to 'Smoke on the Water'
     */
    
    
    
    

    No!!!:

     
    /* Play No
     * -----------
     *
     * Program to play a simple No
     *
     * Tones are created by quickly pulsing a speaker on and off 
     *   using PWM, to create signature frequencies.
     *
     * Each note has a frequency, created by varying the period of 
     *  vibration, measured in microseconds. We'll use pulse-width
     *  modulation (PWM) to create that vibration.
    
     * We calculate the pulse-width to be half the period; we pulse 
     *  the speaker HIGH for 'pulse-width' microseconds, then LOW 
     *  for 'pulse-width' microseconds.
     *  This pulsing creates a vibration of the desired frequency.
     *
     * (cleft) 2005 D. Cuartielles for K3
     * Refactoring and comments 2006 clay.shirky@nyu.edu
     * See NOTES in comments at end for possible improvements
     */
    
    // TONES  ==========================================
    // Start by defining the relationship between 
    //       note, period, &  frequency. 
    
     #include "hilal_pitch.h"
    
    // SETUP ============================================
    // Set up speaker on a PWM pin (digital 9, 10 or 11)
    int speakerOut = 9;
    // Do we want debugging on serial out? 1 for No, 0 for no
    int DEBUG = 1;
    
    void setup() { 
      pinMode(speakerOut, OUTPUT);
      if (DEBUG) { 
        Serial.begin(9600); // Set serial out if we want debugging
      } 
    }
    
    // No and TIMING  =======================================
    //  No[] is an array of notes, accompanied by beats[], 
    //  which sets each note's relative length (higher #, longer note) 
     
    int No[] = {C1S, R };
    int beats[]  = { 64, 16};
    int MAX_COUNT = sizeof(No)/2; // No length, for looping.
    
    // Set overall tempo
    long tempo = 10000;
    // Set length of pause between notes
    int pause = 1000;
    // Loop variable to increase Rest length
    int rest_count = 110; //<-BLETCHEROUS HACK; See NOTES
    
    // Initialize core variables
    int ton = 0;
    int beat = 0;
    long duration  = 0;
    
    // PLAY TONE  ==============================================
    // Pulse the speaker to play a tone for a particular duration
    void playTone() {
      long elapsed_time = 0;
      if (ton > 0) { // if this isn't a Rest beat, while the tone has 
        //  played less long than 'duration', pulse speaker HIGH and LOW
        while (elapsed_time < duration) {
    
          digitalWrite(speakerOut,HIGH);
          delayMicroseconds(ton / 2);
    
          // DOWN
          digitalWrite(speakerOut, LOW);
          delayMicroseconds(ton / 2);
    
          // Keep track of how long we pulsed
          elapsed_time += (ton);
        } 
      }
      else { // Rest beat; loop times delay
        for (int j = 0; j < rest_count; j++) { // See NOTE on rest_count
          delayMicroseconds(duration);  
        }                                
      }                                 
    }
    
    // LET THE WILD RUMPUS BEGIN =============================
    void loop() {
      // Set up a counter to pull from No[] and beats[]
      for (int i=0; i<MAX_COUNT; i++) {
        ton = No[i];
        beat = beats[i];
    
        duration = beat * tempo; // Set up timing
    
        playTone(); 
        // A pause between notes...
        delayMicroseconds(pause);
    
        if (DEBUG) { // If debugging, report loop, tone, beat, and duration
          Serial.print(i);
          Serial.print(":");
          Serial.print(beat);
          Serial.print(" ");    
          Serial.print(ton);
          Serial.print(" ");
          Serial.println(duration);
        }
      }
    }
    
    /*
     * NOTES
     * The program purports to hold a tone for 'duration' microseconds.
     *  Lies lies lies! It holds for at least 'duration' microseconds, _plus_
     *  any overhead created by incremeting elapsed_time (could be in excess of 
     *  3K microseconds) _plus_ overhead of looping and two digitalWrites()
     *  
     * As a result, a tone of 'duration' plays much more slowly than a rest
     *  of 'duration.' rest_count creates a loop variable to bring 'rest' beats 
     *  in line with 'tone' beats of the same length. 
     * 
     * rest_count will be affected by chip architecture and speed, as well as 
     *  overhead from any program mods. Past behavior is no guarantee of future 
     *  performance. Your mileage may vary. Light fuse and get away.
     *  
     * This could use a number of enhancements:
     * ADD code to let the programmer specify how many times the No should
     *     loop before stopping
     * ADD another octave
     * MOVE tempo, pause, and rest_count to #define statements
     * RE-WRITE to include volume, using analogWrite, as with the second program at
     *          http://www.arduino.cc/en/Tutorial/PlayNo
     * ADD code to make the tempo settable by pot or other input device
     * ADD code to take tempo or volume settable by serial communication 
     *          (Requires 0005 or higher.)
     * ADD code to create a tone offset (higer or lower) through pot etc
     * REPLACE random No with opening bars to 'Smoke on the Water'
     */
    
    
    
    

    Help!!I’m running out of battery:

     
    /* Play Help
     * -----------
     *
     * Program to play a simple Help
     *
     * Tones are created by quickly pulsing a speaker on and off 
     *   using PWM, to create signature frequencies.
     *
     * Each Helpte has a frequency, created by varying the period of 
     *  vibration, measured in microseconds. We'll use pulse-width
     *  modulation (PWM) to create that vibration.
    
     * We calculate the pulse-width to be half the period; we pulse 
     *  the speaker HIGH for 'pulse-width' microseconds, then LOW 
     *  for 'pulse-width' microseconds.
     *  This pulsing creates a vibration of the desired frequency.
     *
     * (cleft) 2005 D. Cuartielles for K3
     * Refactoring and comments 2006 clay.shirky@nyu.edu
     * See HelpTES in comments at end for possible improvements
     */
    
    // TONES  ==========================================
    // Start by defining the relationship between 
    //       Helpte, period, &  frequency. 
    
    
    // SETUP ============================================
    
     #include "hilal_pitch.h"
     
    // Set up speaker on a PWM pin (digital 9, 10 or 11)
    int speakerOut = 9;
    // Do we want debugging on serial out? 1 for Help, 0 for Help
    int DEBUG = 1;
    
    void setup() { 
      pinMode(speakerOut, OUTPUT);
      if (DEBUG) { 
        Serial.begin(9600); // Set serial out if we want debugging
      } 
    }
    
    // Help and TIMING  =======================================
    //  Help[] is an array of Helptes, accompanied by beats[], 
    //  which sets each Helpte's relative length (higher #, longer Helpte) 
     
    int Help[] = {C3,F2 };
    int beats[]  = { 7,7};
    int MAX_COUNT = sizeof(Help)/2; // Help length, for looping.
    
    // Set overall tempo
    long tempo = 10000;
    // Set length of pause between Helptes
    int pause = 1000;
    // Loop variable to increase Rest length
    int rest_count = 110; //<-BLETCHEROUS HACK; See HelpTES
    
    // Initialize core variables
    int ton = 0;
    int beat = 0;
    long duration  = 0;
    
    // PLAY TONE  ==============================================
    // Pulse the speaker to play a tone for a particular duration
    void playTone() {
      long elapsed_time = 0;
      if (ton > 0) { // if this isn't a Rest beat, while the tone has 
        //  played less long than 'duration', pulse speaker HIGH and LOW
        while (elapsed_time < duration) {
    
          digitalWrite(speakerOut,HIGH);
          delayMicroseconds(ton / 2);
    
          // DOWN
          digitalWrite(speakerOut, LOW);
          delayMicroseconds(ton / 2);
    
          // Keep track of how long we pulsed
          elapsed_time += (ton);
        } 
      }
      else { // Rest beat; loop times delay
        for (int j = 0; j < rest_count; j++) { // See HelpTE on rest_count
          delayMicroseconds(duration);  
        }                                
      }                                 
    }
    
    // LET THE WILD RUMPUS BEGIN =============================
    void loop() {
      // Set up a counter to pull from Help[] and beats[]
      for (int i=0; i<MAX_COUNT; i++) {
        ton = Help[i];
        beat = beats[i];
    
        duration = beat * tempo; // Set up timing
    
        playTone(); 
        // A pause between Helptes...
        delayMicroseconds(pause);
    
        if (DEBUG) { // If debugging, report loop, tone, beat, and duration
          Serial.print(i);
          Serial.print(":");
          Serial.print(beat);
          Serial.print(" ");    
          Serial.print(ton);
          Serial.print(" ");
          Serial.println(duration);
        }
      }
    }
    
    /*
     * HelpTES
     * The program purports to hold a tone for 'duration' microseconds.
     *  Lies lies lies! It holds for at least 'duration' microseconds, _plus_
     *  any overhead created by incremeting elapsed_time (could be in excess of 
     *  3K microseconds) _plus_ overhead of looping and two digitalWrites()
     *  
     * As a result, a tone of 'duration' plays much more slowly than a rest
     *  of 'duration.' rest_count creates a loop variable to bring 'rest' beats 
     *  in line with 'tone' beats of the same length. 
     * 
     * rest_count will be affected by chip architecture and speed, as well as 
     *  overhead from any program mods. Past behavior is Help guarantee of future 
     *  performance. Your mileage may vary. Light fuse and get away.
     *  
     * This could use a number of enhancements:
     * ADD code to let the programmer specify how many times the Help should
     *     loop before stopping
     * ADD aHelpther octave
     * MOVE tempo, pause, and rest_count to #define statements
     * RE-WRITE to include volume, using analogWrite, as with the second program at
     *          http://www.arduiHelp.cc/en/Tutorial/PlayHelp
     * ADD code to make the tempo settable by pot or other input device
     * ADD code to take tempo or volume settable by serial communication 
     *          (Requires 0005 or higher.)
     * ADD code to create a tone offset (higer or lower) through pot etc
     * REPLACE random Help with opening bars to 'Smoke on the Water'
     */
    
    
    
    

    I’m sad:

     
    /* Play ImSad
     * -----------
     *
     * Program to play a simple ImSad
     *
     * Tones are created by quickly pulsing a speaker on and off 
     *   using PWM, to create signature frequencies.
     *
     * Each ImSadte has a frequency, created by varying the period of 
     *  vibration, measured in microseconds. We'll use pulse-width
     *  modulation (PWM) to create that vibration.
    
     * We calculate the pulse-width to be half the period; we pulse 
     *  the speaker HIGH for 'pulse-width' microseconds, then LOW 
     *  for 'pulse-width' microseconds.
     *  This pulsing creates a vibration of the desired frequency.
     *
     * (cleft) 2005 D. Cuartielles for K3
     * Refactoring and comments 2006 clay.shirky@nyu.edu
     * See ImSadTES in comments at end for possible improvements
     */
    
    // TONES  ==========================================
    // Start by defining the relationship between 
    //       ImSadte, period, &  frequency. 
    
    // Define a special ImSadte, 'R', to represent a rest
    
    
    // SETUP ============================================
    
     #include "hilal_pitch.h"
     
    // Set up speaker on a PWM pin (digital 9, 10 or 11)
    
    int speakerOut = 9;
    // Do we want debugging on serial out? 1 for ImSad, 0 for ImSad
    int DEBUG = 1;
    
    void setup() { 
      pinMode(speakerOut, OUTPUT);
      if (DEBUG) { 
        Serial.begin(9600); // Set serial out if we want debugging
      } 
    }
    
    // ImSad and TIMING  =======================================
    //  ImSad[] is an array of ImSadtes, accompanied by beats[], 
    //  which sets each ImSadte's relative length (higher #, longer ImSadte) 
     
    int ImSad[] = {F2, F2S,C3S, C2S, R };
    int beats[]  = { 32,32,32,80, 16};
    int MAX_COUNT = sizeof(ImSad)/2; // ImSad length, for looping.
    
    // Set overall tempo
    long tempo = 10000;
    // Set length of pause between ImSadtes
    int pause = 1000;
    // Loop variable to increase Rest length
    int rest_count = 110; //<-BLETCHEROUS HACK; See ImSadTES
    
    // Initialize core variables
    int ton = 0;
    int beat = 0;
    long duration  = 0;
    
    // PLAY TONE  ==============================================
    // Pulse the speaker to play a tone for a particular duration
    void playTone() {
      long elapsed_time = 0;
      if (ton > 0) { // if this isn't a Rest beat, while the tone has 
        //  played less long than 'duration', pulse speaker HIGH and LOW
        while (elapsed_time < duration) {
    
          digitalWrite(speakerOut,HIGH);
          delayMicroseconds(ton / 2);
    
          // DOWN
          digitalWrite(speakerOut, LOW);
          delayMicroseconds(ton / 2);
    
          // Keep track of how long we pulsed
          elapsed_time += (ton);
        } 
      }
      else { // Rest beat; loop times delay
        for (int j = 0; j < rest_count; j++) { // See ImSadTE on rest_count
          delayMicroseconds(duration);  
        }                                
      }                                 
    }
    
    // LET THE WILD RUMPUS BEGIN =============================
    void loop() {
      // Set up a counter to pull from ImSad[] and beats[]
      for (int i=0; i<MAX_COUNT; i++) {
        ton = ImSad[i];
        beat = beats[i];
    
        duration = beat * tempo; // Set up timing
    
        playTone(); 
        // A pause between ImSadtes...
        delayMicroseconds(pause);
    
        if (DEBUG) { // If debugging, report loop, tone, beat, and duration
          Serial.print(i);
          Serial.print(":");
          Serial.print(beat);
          Serial.print(" ");    
          Serial.print(ton);
          Serial.print(" ");
          Serial.println(duration);
        }
      }
    }
    
    /*
     * ImSadTES
     * The program purports to hold a tone for 'duration' microseconds.
     *  Lies lies lies! It holds for at least 'duration' microseconds, _plus_
     *  any overhead created by incremeting elapsed_time (could be in excess of 
     *  3K microseconds) _plus_ overhead of looping and two digitalWrites()
     *  
     * As a result, a tone of 'duration' plays much more slowly than a rest
     *  of 'duration.' rest_count creates a loop variable to bring 'rest' beats 
     *  in line with 'tone' beats of the same length. 
     * 
     * rest_count will be affected by chip architecture and speed, as well as 
     *  overhead from any program mods. Past behavior is ImSad guarantee of future 
     *  performance. Your mileage may vary. Light fuse and get away.
     *  
     * This could use a number of enhancements:
     * ADD code to let the programmer specify how many times the ImSad should
     *     loop before stopping
     * ADD aImSadther octave
     * MOVE tempo, pause, and rest_count to #define statements
     * RE-WRITE to include volume, using analogWrite, as with the second program at
     *          http://www.arduiImSad.cc/en/Tutorial/PlayImSad
     * ADD code to make the tempo settable by pot or other input device
     * ADD code to take tempo or volume settable by serial communication 
     *          (Requires 0005 or higher.)
     * ADD code to create a tone offset (higer or lower) through pot etc
     * REPLACE random ImSad with opening bars to 'Smoke on the Water'
     */
    
    
    

    Bye I’m off. :

     
    /* Play ByeImOff
     * -----------
     *
     * Program to play a simple ByeImOff
     *
     * Tones are created by quickly pulsing a speaker on and off 
     *   using PWM, to create signature frequencies.
     *
     * Each note has a frequency, created by varying the period of 
     *  vibration, measured in microseconds. We'll use pulse-width
     *  modulation (PWM) to create that vibration.
    
     * We calculate the pulse-width to be half the period; we pulse 
     *  the speaker HIGH for 'pulse-width' microseconds, then LOW 
     *  for 'pulse-width' microseconds.
     *  This pulsing creates a vibration of the desired frequency.
     *
     * (cleft) 2005 D. Cuartielles for K3
     * Refactoring and comments 2006 clay.shirky@nyu.edu
     * See NOTES in comments at end for possible improvements
     */
    
    // TONES  ==========================================
    // Start by defining the relationship between 
    //       note, period, &  frequency. 
    
    
    // Define a special note, 'R', to represent a rest
    
    // SETUP ============================================
    
    #include "hilal_pitch.h"
    
    // Set up speaker on a PWM pin (digital 9, 10 or 11)
    int speakerOut = 9;
    // Do we want debugging on serial out? 1 for yes, 0 for no
    int DEBUG = 1;
    
    void setup() { 
      pinMode(speakerOut, OUTPUT);
      if (DEBUG) { 
        Serial.begin(9600); // Set serial out if we want debugging
      } 
    }
    
    // ByeImOff and TIMING  =======================================
    //  ByeImOff[] is an array of notes, accompanied by beats[], 
    //  which sets each note's relative length (higher #, longer note) 
     
    int ByeImOff[] = { D5S, A3, F3S, D3, A2, F2S, R };
    int beats[]  = { 8, 8, 8, 8,8, 32, 16};
    int MAX_COUNT = sizeof(ByeImOff)/2; // ByeImOff length, for looping.
    
    // Set overall tempo
    long tempo = 10000;
    // Set length of pause between notes
    int pause = 1000;
    // Loop variable to increase Rest length
    int rest_count = 110; //<-BLETCHEROUS HACK; See NOTES
    
    // Initialize core variables
    int ton = 0;
    int beat = 0;
    long duration  = 0;
    
    // PLAY TONE  ==============================================
    // Pulse the speaker to play a tone for a particular duration
    void playTone() {
      long elapsed_time = 0;
      if (ton > 0) { // if this isn't a Rest beat, while the tone has 
        //  played less long than 'duration', pulse speaker HIGH and LOW
        while (elapsed_time < duration) {
    
          digitalWrite(speakerOut,HIGH);
          delayMicroseconds(ton / 2);
    
          // DOWN
          digitalWrite(speakerOut, LOW);
          delayMicroseconds(ton / 2);
    
          // Keep track of how long we pulsed
          elapsed_time += (ton);
        } 
      }
      else { // Rest beat; loop times delay
        for (int j = 0; j < rest_count; j++) { // See NOTE on rest_count
          delayMicroseconds(duration);  
        }                                
      }                                 
    }
    
    // LET THE WILD RUMPUS BEGIN =============================
    void loop() {
      // Set up a counter to pull from ByeImOff[] and beats[]
      for (int i=0; i<MAX_COUNT; i++) {
        ton = ByeImOff[i];
        beat = beats[i];
    
        duration = beat * tempo; // Set up timing
    
        playTone(); 
        // A pause between notes...
        delayMicroseconds(pause);
    
        if (DEBUG) { // If debugging, report loop, tone, beat, and duration
          Serial.print(i);
          Serial.print(":");
          Serial.print(beat);
          Serial.print(" ");    
          Serial.print(ton);
          Serial.print(" ");
          Serial.println(duration);
        }
      }
    }
    
    /*
     * NOTES
     * The program purports to hold a tone for 'duration' microseconds.
     *  Lies lies lies! It holds for at least 'duration' microseconds, _plus_
     *  any overhead created by incremeting elapsed_time (could be in excess of 
     *  3K microseconds) _plus_ overhead of looping and two digitalWrites()
     *  
     * As a result, a tone of 'duration' plays much more slowly than a rest
     *  of 'duration.' rest_count creates a loop variable to bring 'rest' beats 
     *  in line with 'tone' beats of the same length. 
     * 
     * rest_count will be affected by chip architecture and speed, as well as 
     *  overhead from any program mods. Past behavior is no guarantee of future 
     *  performance. Your mileage may vary. Light fuse and get away.
     *  
     * This could use a number of enhancements:
     * ADD code to let the programmer specify how many times the ByeImOff should
     *     loop before stopping
     * ADD another octave
     * MOVE tempo, pause, and rest_count to #define statements
     * RE-WRITE to include volume, using analogWrite, as with the second program at
     *          http://www.arduino.cc/en/Tutorial/PlayByeImOff
     * ADD code to make the tempo settable by pot or other input device
     * ADD code to take tempo or volume settable by serial communication 
     *          (Requires 0005 or higher.)
     * ADD code to create a tone offset (higer or lower) through pot etc
     * REPLACE random ByeImOff with opening bars to 'Smoke on the Water'
     */
    
    
    
    

     

     
  • lpercifield 11:16 pm on February 3, 2011 Permalink | Reply  

    LCD details 

    Here is the link to the LCD setup

     
  • scottpeterman 11:09 pm on February 3, 2011 Permalink | Reply  

    Whine-bot 

    Here is my very whiny robot. He complains when you wake him up! He whines no for the right button and grudgingly whines yes for the left button. But after three yeses he gets mad. You’ve got to go Jack Bauer style and twist his arm! Eventually he’ll relent. If you twist too long though, he’ll crash. Literally. Hold both buttons for a more humane reset.


    (More …)

     
  • thisisvictorkim 9:57 pm on February 3, 2011 Permalink | Reply  

    Intro 

    Hi. My name is Victor Kim.  I graduated with a BFA from Syracuse University in illustration.  While there I also “minored” in DJ’ing and had a weekly radio show on WERW.  After graduation I took on very few illustration freelance projects and a few design and video related internships that were dead ends and nowhere near what I wanted out of a creative based career.  My illustration portfolio can be viewed at vjkim.com while my general parsons blog is at vjkim.com/parsons/blog.  Also you can find some mixes i put together at sd3.vjkim.com.

    The real reason why I’m in computation is because I feel that I’ll be able to pick up on the principles of interactivity while learning about programming.  Two birds with one stone, maximizing those tuition $$$$$$ (dollars).  I’m generally interested in programming since coming to MFADT so I wanted to make sure I was in a Major Studio with colleagues of the same mindset who would inspire and push me during the semester.  I’m not really sure where my direction is with the tools I will soon learn to be honest.  I have general interests in music performance, particularly within the DJ and electronic based realms, an industry that requires its participants to spend thousands of dollars of equipment…

     
  • thisisvictorkim 9:47 pm on February 3, 2011 Permalink | Reply  

    Arduino Beep Bop Boopin’ 

    http://vimeo.com/19540512

    I hacked the “toneMelody” example in Arduino to make my robot phrases

    /*  Melody

    Plays a melody

    circuit:

    • 8-ohm speaker on digital pin 8

    created 21 Jan 2010

    modified 14 Oct 2010

    by Tom Igoe
    This example code is in the public domain.

    http://arduino.cc/en/Tutorial/Tone  */

    #include “pitches.h”
    // notes in the melody:

    int melody[] = {

    NOTE_D3, NOTE_F3, NOTE_AS3,

    0, NOTE_D4, NOTE_AS3,

    0, NOTE_D4, NOTE_AS3, NOTE_F3, NOTE_D3, NOTE_F3, NOTE_AS2,

    0, NOTE_C5, 0, NOTE_C3, NOTE_FS3, NOTE_DS3,

    0, NOTE_C4, NOTE_F4, NOTE_A4, NOTE_C5, NOTE_A4, NOTE_F4, NOTE_C4, NOTE_F4, NOTE_A4, NOTE_C5, NOTE_A4, NOTE_F4,

    0, NOTE_C4, NOTE_CS4, NOTE_C4, NOTE_CS4, NOTE_C4, NOTE_CS4, NOTE_C4, NOTE_CS4,

    0, NOTE_C4, NOTE_CS4, NOTE_C4, NOTE_CS4, NOTE_C4, NOTE_CS4, NOTE_C4, NOTE_CS4,

    0, NOTE_A4, NOTE_B4, NOTE_C5, 0, NOTE_C4};
    // note durations: 4 = quarter note, 8 = eighth note, etc.:

    int noteDurations[] = {

    8,8,8, 4, 8,8, 1, 8,8,2, 8, 8,2, 1, 8, 1,  8,8,8, 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 1,  16, 16, 16, 16, 16, 16, 16, 16, 1, 16, 16, 16, 16, 16, 16, 16, 16, 1,  16,16,16, 4, 4

    };
    void setup() {

    // iterate over the notes of the melody:

    for (int thisNote = 0; thisNote < 56; thisNote++) {
    // to calculate the note duration, take one second

    // divided by the note type.

    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.

    int noteDuration = 1000/noteDurations[thisNote];

    tone(8, melody[thisNote],noteDuration);
    // to distinguish the notes, set a minimum time between them.

    // the note’s duration + 30% seems to work well:

    int pauseBetweenNotes = noteDuration * 2;

    delay(pauseBetweenNotes);

    // stop the tone playing:

    noTone(8);  }

    }
    void loop() {  // no need to repeat the melody.}

     
  • catherine 9:08 pm on February 3, 2011 Permalink | Reply  

    emotional homework. 

     

    My Arduino would like to say:
    I’m on!
    I’m happy!
    I’m in trouble!
    Yes!
    No!
    Good Bye!

    I had some trouble creating sound because I am very musically inclined. I tried my best to get my Arduino to speak the way I intended it to sound.

    Here is my code.

     
  • Oylum 7:56 pm on February 3, 2011 Permalink | Reply  

    Gestural Sounds 

    We are required to create sounds to represent emotions or “gesture” and I am so bad at music. I even didn’t know the names of the notes in English, so it was a bit hard for me to program the sounds.

    I used Virtuoso Iphone app to learn and familiarize myself with US type of music notes.  Then, I wrote the code (I used the Tone Tutorial by Tom Igoe to write the notes and music)  for 6 types of gestures:

    1. Hello

    2. Alert-Alarm

    3. Bye

    4. Sad

    5.Tension

    6. Dying

    I also assigned 6 buttons to activate these 6 sound.

     

    My sourcecode is here.

     
  • lpercifield 7:21 pm on February 3, 2011 Permalink | Reply  

    Arduino Speaks 

    I made my arduino talk!

    Arduino Speaks from Leif Percifield on Vimeo.

    Phrases:

    1. Hello

    2. Good Bye

    3. I’m Happy

    4. I’m dying

    5. ALERT

    6. I understand

    Code is available here

     

    In class writing February 3rd:

    Did you have any pleasant or not-so-nice surprises when experimenting with “emotive beeps”?

     

    For the most part I found it pretty straight forward to create the emotions that I wanted. There was a little bit of trouble separating the different positive and negative sounds. The positive sounds tended to have a rising tone and the negative sounds had a falling tone. The method that I used to separate them was length and number of total tones.

     

     
  • lpercifield 7:12 pm on February 3, 2011 Permalink | Reply  

    Arduino Plays Mario 

    So this is what my tone project was supposed to sound like (replaced a broken speaker).

    Arduino Mario from Leif Percifield on Vimeo.

    Code available here

     

     
  • lpercifield 6:56 pm on February 3, 2011 Permalink | Reply  

    Leif Percifield 

    Hello all,

    The main interest I have in this computation class is a better understanding of low voltage wireless communication and interaction. I have some experience with Xbee communication but want to work on the embedded systems aspect of Arduino. You can check out some of the work I’ve done with Xbee and Arduino here.

     
  • Lee 6:38 pm on February 3, 2011 Permalink | Reply  

    Beep Boop Lee 

    The peizo I have sounds pretty poor at all octaves unfortunately. There’s hardly any discernible difference between notes and this translates even worse being picked up by my computers microphone. Ah well, check out the video and my code is posted below.

    #include “pitches.h”

    // notes in the melody:
    int hello[] = {
    NOTE_F5, NOTE_G5, NOTE_A5, NOTE_B5, NOTE_C6,0, NOTE_A5,0,0,0};
    // note durations: 4 = quarter note, 8 = eighth note, etc.:
    int helloDurations[] = {
    16, 16, 16, 16 ,8,4,4,1,1,1};

    int goodbye[] = {
    NOTE_E4, NOTE_D4, NOTE_C4, 0,0,0};
    int goodbyeDurations[] = {
    2,4,1,1,1,1};

    int happy[] = {
    NOTE_E7, NOTE_D7, NOTE_A7, NOTE_D7, NOTE_A7, NOTE_D7, NOTE_A7, NOTE_G7,0,0,0};
    int happyDurations[] = {
    8,16,16,16,16,16,16,2,1,1,1};

    int sad[] = {
    NOTE_B4, 0, NOTE_G4, 0, NOTE_E4, 0, NOTE_D4,0,0,0};
    int sadDurations[] = {
    2,4,2,4,2,4,1,1,1,1};

    int yes[] = {
    NOTE_CS7,0,NOTE_E7,0,0,0};
    int yesDurations[] = {
    8,16,8,1,1,1};

    int no[] = {
    NOTE_DS5,0,NOTE_DS5,0,0,0};
    int noDurations[] = {
    8,16,8,1,1,1};

    int dyeing[] = {
    NOTE_AS4, NOTE_E4, NOTE_AS4, NOTE_E4, NOTE_AS4, NOTE_E4, NOTE_AS4, NOTE_E4, NOTE_AS4, 0,0,0};
    int dyeingDurations[] = {
    8,8,8,8,8,8,8,8,8,0,0,0};

    void setup() {
    // iterate over the notes of the melody:

    for (int thisNote = 0; thisNote < 10; thisNote++) {
    int helloDuration = 1000/helloDurations[thisNote];
    tone(8, hello[thisNote],helloDuration);
    int pauseBetweenNotes = helloDuration * 1.30;
    delay(pauseBetweenNotes);
    }

    for (int thisNote = 0; thisNote < 6; thisNote++) {
    int goodbyeDuration = 1000/goodbyeDurations[thisNote];
    tone(8, goodbye[thisNote],goodbyeDuration);
    int pauseBetweenNotes = goodbyeDuration * 1.30;
    delay(pauseBetweenNotes);
    }

    for (int thisNote = 0; thisNote < 11; thisNote++) {
    int happyDuration = 1000/happyDurations[thisNote];
    tone(8, happy[thisNote],happyDuration);
    int pauseBetweenNotes = happyDuration * 1.30;
    delay(pauseBetweenNotes);
    }

    for (int thisNote = 0; thisNote < 10; thisNote++) {
    int sadDuration = 1000/sadDurations[thisNote];
    tone(8, sad[thisNote],sadDuration);
    int pauseBetweenNotes = sadDuration * 1.30;
    delay(pauseBetweenNotes);
    }

    for (int thisNote = 0; thisNote < 6; thisNote++) {
    int yesDuration = 1000/yesDurations[thisNote];
    tone(8, yes[thisNote],yesDuration);
    int pauseBetweenNotes = yesDuration * 1.30;
    delay(pauseBetweenNotes);
    }

    for (int thisNote = 0; thisNote < 6; thisNote++) {
    int noDuration = 1000/noDurations[thisNote];
    tone(8, no[thisNote],noDuration);
    int pauseBetweenNotes = noDuration * 1.30;
    delay(pauseBetweenNotes);
    }

    for (int thisNote = 0; thisNote < 12; thisNote++) {
    int dyeingDuration = 1000/dyeingDurations[thisNote];
    tone(8, dyeing[thisNote],dyeingDuration);
    int pauseBetweenNotes = dyeingDuration * 1.30;
    delay(pauseBetweenNotes);
    }
    }

    void loop() {
    // no need to repeat the melody.
    }

     
  • Chris Piuggi 5:59 pm on February 3, 2011 Permalink | Reply  

    Anthropomorphic Sounds 

    After much tinkering I was able to put together some intriguing sounds. I also was able to load all content into two Multidimensional Arrays, which helped with organization. If anyone is looking into how to do that, please see my code.

    Overall I felt that this assignment was more challenging that I had initially thought. Music and sound is a whole new way of thinking for me, and there were moments that I felt out of my confort zone, however with enough tinkering and changing I began to see what types of combinations would create responses.

    I attempted to give a voice, to these sounds, as if they were coming for the same person/object, and attempted to mimic the syllables and sounds in the words/ phrases I tried to create.

    Phrases  Created:   I’m on/ready, Yes, No, I’m Learning, I’m trying to warn you, I’m Confused.

    View my code here

     
  • Lee 5:06 pm on February 3, 2011 Permalink | Reply  

    A moment with Lee Williams 

    Hi, it’s me Lee. My background is in graphics design and before coming to Parsons I worked in the magazine publishing industry. I worked for Time Inc. in the custom pub department and then landed a Associate Art Director gig at Runner’s World magazine. You can check out my previous work at leewilliams.me. That was all fine and good, but everyone knows print is dead. So, here I am now.

    I have never really coded anything except some flash script before coming to Parsons, but I’ve really fallen for it since getting my hands dirty in bootcamp. I’ve tried to squeeze in as many code courses as possible and am focusing on ubiquitous mobile computing. I really want to create interesting applications that can extend beyond the screen. There’s really no reason why our powerful little computers in our pocket can’t communicate with all the digital stuff we surround ourselves with. I’m also interested in algorithmic logic and life simulations. I believe menu based, yes no sort of interfaces need to evolve to be more predictive of their users intentions and to assist users in finding what they really want. What my focus will be when I come out with this MFA I have no clue, but for now I’m trying to soak up as much new knowledge as possible.

     
  • Alvaro Soto 7:02 am on February 3, 2011 Permalink | Reply  

    Beep Beep Boop / Alvaro 

    Ok guys, thought I would never finish this Beep Beep Boo but here it is:

    my bipolar monologue goes like this:

    Hello, I am on

    I am Happy

    I am Angry

    I am Dying

    I need to alert you to do something

    By! Im turning off

    I decided to use 6 push buttons (but I just had three with me so I would post the video later today when I get some more). Each of the push buttons represents one phrase or sentence. The code is the same code from the Arduino website but I added the interaction and of course created different melodies.

    I used an Ipad app (virtuoso) to listen to the tones, although they are not very similar to the beep sound, it actually helps.

    More push buttons need to be connected but the code is ready for the 6 of them

    Here is the code (sorry for posting it directly here, if somebody knows, could you please let me/us know how to link the code? I think the blog looks messy with all that, but maybe is just me)

    /*
    HelloImon

    Plays a HelloImon

    circuit:

    • 8-ohm speaker on digital pin 8

    created 21 Jan 2010
    modified 14 Oct 2010
    by Tom Igoe

    This example code is in the public domain.

    http://arduino.cc/en/Tutorial/Tone

    modified 2 jan 2011
    by Alvaro Soto

    This code will play a short melody representing sentences in beeps
    Hello, Im on
    Im Happy
    Im angry
    Im dying
    I need to alert you to do something
    Bye, Im turning off

    */
    #include “pitches.h”

    int ledPin = 4; // LED to turn on when melody is playing

    // notes for the melody Hello Im on :
    int HelloImon[] = {NOTE_C5, NOTE_B6,NOTE_B6};
    // note durations: 4 = quarter note, 8 = eighth note, etc.:
    int noteDurations[] = {8, 8,4 };
    int button7 = 7;

    int button7State = 0;

    // notes for the melody Im Happy:
    int ImHappy[] = {NOTE_F6, NOTE_G6,NOTE_F6, NOTE_G6,NOTE_F6, NOTE_G6,NOTE_F6, NOTE_G6,NOTE_F6, NOTE_G6};
    // note durations: 4 = quarter note, 8 = eighth note, etc.:
    int noteDurations2[] = {16,16,16,16,16,16,16,16,16,16};
    int button6 = 6;
    int button6State = 0;

    // notes for the melody Im Angry:
    int ImAngry[] = {NOTE_B0, NOTE_B0,NOTE_B0, NOTE_B0,NOTE_B0, NOTE_B0,NOTE_B0, NOTE_B0,NOTE_B0, NOTE_B0};
    // note durations: 4 = quarter note, 8 = eighth note, etc.:
    int noteDurations3[] = {4,8,8,8,8,8,8,8,8,8};
    int button5 = 5;
    int button5State = 0;

    //notes for the melody Im Dying
    int ImDying[] = {NOTE_B2, NOTE_A2,NOTE_G2, NOTE_F2,NOTE_E2, NOTE_D2,NOTE_C2,NOTE_C2};
    // note durations: 4 = quarter note, 8 = eighth note, etc.:
    int noteDurations4[] = {2,2,8,8,8,8,8,4};
    int button3 = 3;
    int button3State = 0;

    //notes for the melody Im I need to alert you to do something
    int Alertyou[] = {NOTE_B6, NOTE_B6,NOTE_B6, NOTE_B6,NOTE_B6, NOTE_B6};
    // note durations: 4 = quarter note, 8 = eighth note, etc.:
    int noteDurations5[] = {4,4,4,4,4,4};
    int button2 = 2;
    int button2State = 0;

    //Bye Im turning off
    int Imoff[] = {NOTE_C8, NOTE_B7,NOTE_A7, NOTE_G7,NOTE_F7, NOTE_E7,NOTE_D7,NOTE_C7};
    // note durations: 4 = quarter note, 8 = eighth note, etc.:
    int noteDurations6[] = {2,2,8,8,8,8,8,4};
    int button1 = 12;
    int button1State = 0;

    void setup() {

    pinMode(button7,INPUT);
    pinMode(button6,INPUT);
    pinMode(button5,INPUT);
    pinMode(ledPin,OUTPUT);

    }

    void loop() {

    //Hello Im on————————————————-

    button7State = digitalRead(button7);
    if (button7State == HIGH){

    digitalWrite(ledPin,HIGH);

    // iterate over the notes of the HelloImon:
    for (int thisNote = 0; thisNote < 4; thisNote++) {

    // to calculate the note duration, take one second
    // divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 1000/noteDurations[thisNote];
    tone(8, HelloImon[thisNote],noteDuration);

    // to distinguish the notes, set a minimum time between them.
    // the note’s duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(8);
    }
    }else{
    digitalWrite(ledPin,LOW);
    }

    //Im Happy———————————————————-

    button6State = digitalRead(button6);
    if (button6State == HIGH){

    digitalWrite(ledPin,HIGH);

    // iterate over the notes of the HelloImon:
    for (int thisNote = 0; thisNote < 11; thisNote++) {

    // to calculate the note duration, take one second
    // divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 1000/noteDurations2[thisNote];
    tone(8, ImHappy[thisNote],noteDuration);

    // to distinguish the notes, set a minimum time between them.
    // the note’s duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(8);
    }
    }else{
    digitalWrite(ledPin,LOW);
    }

    // Im Angry———————————————

    button5State = digitalRead(button5);
    if (button5State == HIGH){

    digitalWrite(ledPin,HIGH);

    // iterate over the notes of the HelloImon:
    for (int thisNote = 0; thisNote < 11; thisNote++) {

    // to calculate the note duration, take one second
    // divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 1000/noteDurations3[thisNote];
    tone(8, ImAngry[thisNote],noteDuration);

    // to distinguish the notes, set a minimum time between them.
    // the note’s duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(8);
    }
    }else{
    digitalWrite(ledPin,LOW);
    }

    // Im Dying —————————————————-

    button3State = digitalRead(button3);
    if (button3State == HIGH){

    digitalWrite(ledPin,HIGH);

    // iterate over the notes of the HelloImon:
    for (int thisNote = 0; thisNote < 9; thisNote++) {

    // to calculate the note duration, take one second
    // divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 1000/noteDurations4[thisNote];
    tone(8, ImDying[thisNote],noteDuration);

    // to distinguish the notes, set a minimum time between them.
    // the note’s duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(8);
    }
    }else{
    digitalWrite(ledPin,LOW);
    }

    // I need to alert you to do something——————————

    button2State = digitalRead(button2);
    if (button2State == HIGH){

    digitalWrite(ledPin,HIGH);

    // iterate over the notes of the HelloImon:
    for (int thisNote = 0; thisNote < 7; thisNote++) {

    // to calculate the note duration, take one second
    // divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 1000/noteDurations5[thisNote];
    tone(8, Alertyou[thisNote],noteDuration);

    // to distinguish the notes, set a minimum time between them.
    // the note’s duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(8);
    }
    }else{
    digitalWrite(ledPin,LOW);
    }

    // Bye! Im turning off

    button1State = digitalRead(button1);
    if (button1State == HIGH){

    digitalWrite(ledPin,HIGH);

    // iterate over the notes of the HelloImon:
    for (int thisNote = 0; thisNote < 9; thisNote++) {

    // to calculate the note duration, take one second
    // divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 1000/noteDurations5[thisNote];
    tone(8, Imoff[thisNote],noteDuration);

    // to distinguish the notes, set a minimum time between them.
    // the note’s duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(8);
    }
    }else{
    digitalWrite(ledPin,LOW);
    }

    }

    Here is the video

     
  • minho 6:43 am on February 3, 2011 Permalink | Reply  

    Emotional tones 

    http://a.parsons.edu/~kimm541/DSC_4228.MOV

     

     

    #define  v     18000
    #define  x     10000
    #define  z     8000
    #define  c     3830    // 261 Hz
    #define  d     3400    // 294 Hz
    #define  e     3038    // 329 Hz
    #define  f     2864    // 349 Hz
    #define  g     2550    // 392 Hz
    #define  a     2272    // 440 Hz
    #define  b     2028    // 493 Hz
    #define  C     1912    // 523 Hz
    #define  D     1680
    #define  E     1500
    #define  F     1350
    #define  G     1200
    #define  A     1050
    #define  B     912
    // Define a special note, ‘R’, to represent a rest
    #define  R     0

    // SETUP ============================================
    // Set up speaker on a PWM pin (digital 9, 10 or 11)
    int speakerOut = 9;
    // Do we want debugging on serial out? 1 for yes, 0 for no
    int DEBUG = 1;

    void setup() {
    pinMode(speakerOut, OUTPUT);
    if (DEBUG) {
    Serial.begin(9600); // Set serial out if we want debugging
    }
    }

    // MELODY and TIMING  =======================================
    //  melody[] is an array of notes, accompanied by beats[],
    //  which sets each note’s relative length (higher #, longer note)
    int hellom[] = {c,  c};
    int beats[]  = {16, 64};
    int dyingm[] = {  v,  R, z, v };
    int beats2[] = { 200, 8, 8, 32 };
    int happym[] = {  c,  C,  g,  e,  C,  g,  z,  e,  z,    c,  C,  g,  f,  C,  g,  z,  f,  z,     c,  C,  g,  e,  C,  g,  z,  e,  z,     d,  e,  f,  z,  f,  g,  g,  z,  g,  a,  a,  z,  C,  R};
    int beats3[] = { 16, 16, 16,  16, 8,  8, 16, 16, 16,   16, 16, 16, 16,  8,  8, 16, 16, 16,    16, 16, 16,  16, 8,  8, 16, 16, 16,     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8, 16, 16};
    int sadm[]   = {z,  x,  z,  z,  x,  x};
    int beats4[] = {36, 36, 36, 36, 36, 200};
    int yesm[]   = {d, b, E};
    int beats5[] = {8, 16, 32};
    int nom[]    = {B,  B,  B,  B,  B,  B};
    int beats6[] = {8,  8,  8,  8,  8,  8};

    int MAX_COUNT = sizeof(hellom) / 2;
    int MAX_COUNT2 = sizeof(dyingm) / 2;
    int MAX_COUNT3 = sizeof(happym) / 2;
    int MAX_COUNT4 = sizeof(sadm) / 2;
    int MAX_COUNT5 = sizeof(yesm) / 2;
    int MAX_COUNT6 = sizeof(nom) / 2;// Melody length, for looping.

    // Set overall tempo
    long tempo = 10000;
    // Set length of pause between notes
    int pause = 1000;
    // Loop variable to increase Rest length
    int rest_count = 100; //<-BLETCHEROUS HACK; See NOTES

    // Initialize core variables
    int tone1 = 0;
    int beat = 0;
    long duration  = 0;

    // PLAY tone1  ==============================================
    // Pulse the speaker to play a tone1 for a particular duration
    void playtone1() {
    long elapsed_time = 0;
    if (tone1 > 0) { // if this isn’t a Rest beat, while the tone1 has
    //  played less long than ‘duration’, pulse speaker HIGH and LOW
    while (elapsed_time < duration) {

    digitalWrite(speakerOut,HIGH);
    delayMicroseconds(tone1 / 2);

    // DOWN
    digitalWrite(speakerOut, LOW);
    delayMicroseconds(tone1 / 2);

    // Keep track of how long we pulsed
    elapsed_time += (tone1);
    }
    }
    else { // Rest beat; loop times delay
    for (int j = 0; j < rest_count; j++) { // See NOTE on rest_count
    delayMicroseconds(duration);
    }
    }
    }

    // LET THE WILD RUMPUS BEGIN =============================
    void loop() {
    // play each sound in order, with a pause between each one.
    delay(3000);
    hello();
    delay(3000);
    dying();
    delay(3000);
    happy();
    delay(3000);
    sad();
    delay(3000);
    yes();
    delay(3000);
    no();
    delay(5000);
    }

    void hello() {
    // Set up a counter to pull from melody[] and beats[]
    for (int i=0; i<MAX_COUNT; i++) {
    tone1 = hellom[i];
    beat = beats[i];

    duration = beat * tempo; // Set up timing

    playtone1();
    // A pause between notes…
    delayMicroseconds(pause);
    //noTone(speakerOut);

    }
    }

    void dying() {
    // Set up a counter to pull from melody[] and beats[]
    for (int i=0; i<MAX_COUNT2; i++) {
    tone1 = dyingm[i];
    beat = beats2[i];

    duration = beat * tempo; // Set up timing

    playtone1();
    // A pause between notes…
    delayMicroseconds(pause);
    //noTone(speakerOut);

    }
    }

    void happy() {
    // Set up a counter to pull from melody[] and beats[]
    for (int i=0; i<MAX_COUNT3; i++) {
    tone1 = happym[i];
    beat = beats3[i];

    duration = beat * tempo; // Set up timing

    playtone1();
    // A pause between notes…
    delayMicroseconds(pause);
    //noTone(speakerOut);

    }
    }

    void sad() {
    // Set up a counter to pull from melody[] and beats[]
    for (int i=0; i<MAX_COUNT4; i++) {
    tone1 = sadm[i];
    beat = beats4[i];

    duration = beat * tempo; // Set up timing

    playtone1();
    // A pause between notes…
    delayMicroseconds(pause);
    //noTone(speakerOut);

    }
    }

    void yes() {
    // Set up a counter to pull from melody[] and beats[]
    for (int i=0; i<MAX_COUNT5; i++) {
    tone1 = yesm[i];
    beat = beats5[i];

    duration = beat * tempo; // Set up timing

    playtone1();
    // A pause between notes…
    delayMicroseconds(pause);
    //noTone(speakerOut);

    }
    }

    void no() {
    // Set up a counter to pull from melody[] and beats[]
    for (int i=0; i<MAX_COUNT6; i++) {
    tone1 = nom[i];
    beat = beats6[i];

    duration = beat * tempo; // Set up timing

    playtone1();
    // A pause between notes…
    delayMicroseconds(pause);
    //noTone(speakerOut);

    }
    }

     
  • breegeek 6:16 am on February 3, 2011 Permalink | Reply  

    Emotive Bleeps 

    Well, I will save my more complex code for another day…my brain is sputtering.

    I hooked up the arduino to the speaker and ended up making 6 separate sketches for the emotions.

    Here’s a picture of the circuit…

    the video: http://vimeo.com/19512551

     

    hello – something cheery and salutary

    haha – I attempted to make a laughing sound, like a twitter

    level UP – sorta inspired by Zelda’s “I got something!” sound

    yes/no – sort of went for the ding and buzzer

    I’m dying – inspired by the sound toys make when their batteries start to lose juice

    bai – a shut down sound

     
  • andywallace 5:54 am on February 3, 2011 Permalink | Reply  

    Emotional Tones 

    Another sound project. Between this and AV systems, I feel like I’m being tossed into the deep end of the pool. I’ve never worked with audio, but this is certainly a good way to learn. I tried to pull together a few sounds that a potential little robot could use to express itself.

    First I threw together a simple device to let me test out the different sounds I could get out of my piezo. After some basic experimentation, I found the range of acceptable sounds (defined as them not hurting my ear) to be 50-1000 Hz. I mapped this to the range of a potentiometer (0-1024) and set it so that the piezo would play at the relevant frequency to the level of the potentiometer. While testing, I added two additional things: A potentiometer to control the volume of the piezo, and a switch that could silence the piezo without having to unplug it (I found myself uploading the code a lot, and got tired of the constant buzz resulting from keeping it plugged in.

    Here’s the code for that one

    I used the same physical device when creating the individual emotional sounds. It was easy to work on the code for the individual sounds, and then upload the tester, just to see what tones I thought would work for the one I was working on.

    For the final code, I wrote a simple loop function that calls a specific sound. Actually playing each sound is handled by a separate function. Because the way the sounds were generated tended to vary a bit from sound to sound, and each one is fairly short, it didn’t make sense to me to create a standardized way of handling it (such as in the melody example, where any array of notes and durations could have been fed to it).

    Creating the actual sounds consisted mostly of trial and error, just seeing what seemed right for each emotion. For most of the tones used, I simply found a tone manually to me that fit, although there were several that I used actual notes for, hence the inclusion of pitches.h (available in the examples that come with Arduino). Most are comprised of two or three beeps of varying lengths and a few do sweeps across a range of frequencies.

    In then end, the device has 8 expressions: “Hello”, “Yes”, “No”, “I’m happy”, “I’m sad”, “Thank you”, “I need to alert you” and “I’m dying”. They’re all my babies, but I think the happiness sound is my favorite.

    I only recently got the potentiometer I’m using for this project. It’s a big old black one and it has a great feel to it, so I thought I could use that to scroll between the options for the sounds. The range of 1024 is broken up into 8 segments, each of which is mapped to a sound. When the device is not playing anything, the current sound selection is displayed on the serial window (This requires the device to be attached to the computer in order to see what sound will be played). When the selection is made, a switch is flipped and the sound loops until it is put back down.

    I had originally intended to use a push button to activate the sound, but I ran into a bug which I assume has to be with the way I built the circuit, since I tried using code that has previously worked with it. The button reads 0 until it is pressed down, at which point it reads 1 for the rest of eternity. Instead I am using my switch as an analog input. The switch has a very satisfying feel to it anyway, though, so I decided not to worry too much about it for now.

    As the picture shows, my final setup wound up being almost identical to the test device. I moved a few things around to make them less cramped, but that was it. I really liked the tactile sensation that comes from using that specific potentiometer and switch, so I was happy to keep them.

    Given a bit more time, I would have liked to use LEDs with labels to signify which sound would be played, but as it is, the interface is easy to use, and I believe the sounds do a good job of expressing their inteded meaning.

    CODE

     

    IN CLASS WRITING RESPONSE:

    Prompt: Any pleasant or not-so-nice surprises while experimenting with the emotive beeps?

    What stands out is struggling for over an hour with a simple push button. For the life of me, I could not get it to work, which was infuriating given the basic nature of it. I looked over my wiring and could find nothing. Looking as it again this morning, the problem was obvious: I hadn’t ever connected the loop to ground. How I missed this yesterday? No idea.

    I definitely had some difficulty getting sounds that felt like the emotions  was trying to convey. I woud play a tone and think to myself “this will be perfect for the next part of the sequence” only to realize that it could not have been more wrong. As I mentioned, I have never really worked with sound, so it was interesting ti see just how the different tones interacted with each other.

     
  • Thom Hines 1:57 am on February 3, 2011 Permalink | Reply  

    Emotional Audial Gestures 

    The sounds I was going for, in order, are:

    1) Alarm: “Emergency!”
    similar to a naval ships alarm, this has a linear rise in pitch, which is sustained at the end. It gives a sense of urgency.

     

    2) Positive: “I’m happy”
    a simple melody played one note at a time. Like our speech patterns when we want to convey something positive, the pitch and tone go up at the end.

    3) Spooky: “Something Strange (in the neighborhood)”
    a base frequence switches back and forth between 600Hz and 800Hz, with a vibrato for effect. It uses two for loops to control the panning sound, and to switch between the base tones.

    4) Negative: “That’s not good.”
    an oscillating pattern that is very dissonant. It consists of two atonal sounds being played in rapid succession.

    5) Dying: “I’m dying… boo.”
    a decelerating pattern that lowers the frequency and period of the sound over time, giving it the feel of a device that is quickly losing power.

    6) Bye: “Signing off.”
    a normal melody, played in linear order

     

    And here is the code that made it all possible.

     

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel