<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Assignment 7 &#8211; Making Things Interactive, Spring 2022</title>
	<atom:link href="https://courses.ideate.cmu.edu/48-339/s2022/?feed=rss2&#038;cat=17" rel="self" type="application/rss+xml" />
	<link>https://courses.ideate.cmu.edu/48-339/s2022</link>
	<description>Making Things Interactive</description>
	<lastBuildDate>Mon, 04 Apr 2022 20:10:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.9</generator>
	<item>
		<title>Assignment 7: Sound with Meaning</title>
		<link>https://courses.ideate.cmu.edu/48-339/s2022/?p=2409</link>
					<comments>https://courses.ideate.cmu.edu/48-339/s2022/?p=2409#respond</comments>
		
		<dc:creator><![CDATA[eperceva@andrew.cmu.edu]]></dc:creator>
		<pubDate>Tue, 29 Mar 2022 01:58:36 +0000</pubDate>
				<category><![CDATA[Assignment 7]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://courses.ideate.cmu.edu/48-339/s2022/?p=2409</guid>

					<description><![CDATA[To develop &#8216;sound with meaning,&#8217; I wrote a sketch using the tone() function to replicate the &#8216;wah wah wah&#8217; trombone sound. Sketch and video below. &#160; void setup() { tone(7, 293.66, 1000); delay(1000); noTone(7); delay(500); tone(7,277.18,1000); delay(1000); noTone(7); delay(500); tone(7,261.63,1000); delay(1000); noTone(7); delay(500); tone(7,246.94,3000); delay(1500); noTone(7); delay(3000); } void loop() { } &#160; I had &#8230; <a href="https://courses.ideate.cmu.edu/48-339/s2022/?p=2409" class="more-link">Continue reading<span class="screen-reader-text"> "Assignment 7: Sound with Meaning"</span></a>]]></description>
										<content:encoded><![CDATA[<p>To develop &#8216;sound with meaning,&#8217; I wrote a sketch using the tone() function to replicate the &#8216;wah wah wah&#8217; trombone sound. Sketch and video below.</p>
<p><iframe loading="lazy" title="Sound Assignment 07" width="840" height="473" src="https://www.youtube.com/embed/1qOPTaWGlQs?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></p>
<p>&nbsp;</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">void setup() {

  tone(7, 293.66, 1000);
  delay(1000);
  noTone(7);
  delay(500);
  tone(7,277.18,1000);
  delay(1000);
  noTone(7);
  delay(500);
  tone(7,261.63,1000);
  delay(1000);
  noTone(7);
  delay(500);
  tone(7,246.94,3000);
  delay(1500);
  noTone(7);
  delay(3000);
}

void loop() {


}</pre>
<p>&nbsp;</p>
<p>I had a 60 hertz hum with the original power supply I used the first time around. Switching to another power reduced the issue, but it&#8217;s still there.</p>
<p><strong>Resources</strong></p>
<p>More background on the Teensy audio library and MQS:</p>
<p>https://melp242.blogspot.com/2020/10/audio-output-on-teensy-4x-boards.html</p>
<p>Note frequencies:</p>
<p>https://pages.mtu.edu/~suits/notefreqs.html</p>
]]></content:encoded>
					
					<wfw:commentRss>https://courses.ideate.cmu.edu/48-339/s2022/?feed=rss2&#038;p=2409</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Assignment 7: Sound that has meaning</title>
		<link>https://courses.ideate.cmu.edu/48-339/s2022/?p=2411</link>
					<comments>https://courses.ideate.cmu.edu/48-339/s2022/?p=2411#respond</comments>
		
		<dc:creator><![CDATA[judsonk@andrew.cmu.edu]]></dc:creator>
		<pubDate>Sat, 26 Mar 2022 15:16:04 +0000</pubDate>
				<category><![CDATA[Assignment 7]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://courses.ideate.cmu.edu/48-339/s2022/?p=2411</guid>

					<description><![CDATA[Description: This project was meant to convey emotions through sound by playing a song corresponding to the user&#8217;s emotions when a button is pressed. Currently there are only 3 buttons for 3 different sounds/songs but the idea is to be able to hook up more and more as songs stick out as conveying your emotions. &#8230; <a href="https://courses.ideate.cmu.edu/48-339/s2022/?p=2411" class="more-link">Continue reading<span class="screen-reader-text"> "Assignment 7: Sound that has meaning"</span></a>]]></description>
										<content:encoded><![CDATA[<h2>Description:</h2>
<p>This project was meant to convey emotions through sound by playing a song corresponding to the user&#8217;s emotions when a button is pressed. Currently there are only 3 buttons for 3 different sounds/songs but the idea is to be able to hook up more and more as songs stick out as conveying your emotions. The main components for this build are buttons, resistors, a speaker and amplifier, and the Teensy 4.1. When each button is pressed, a certain song corresponding to a different emotion will start to play through. When the song is over, it waits for the next button to be pressed and does not repeat the current sound. When each button is pressed, the current song being played will stop playing and switch to the next song corresponding to the button press. As of now, button 0 plays the Jaws intense sound that signifies a stress and anxiety. Button 1 plays an African Safari game sound that signifies being happy and adventurous. Button 2 plays a relaxing song to convey peace and relaxation.</p>
<h2>Video:</h2>
<p><a href="https://drive.google.com/file/d/1CMMD9j9sRveaiGJDtseF089ZUQ_BY7ep/view?usp=sharing">Demo Video</a></p>
<h2>Images:</h2>
<p><img loading="lazy" class="alignnone wp-image-2430 size-full" src="https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Overall-Image-Assignment-7-1-scaled-e1648305843625.jpg" alt="" width="1881" height="1760" srcset="https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Overall-Image-Assignment-7-1-scaled-e1648305843625.jpg 1881w, https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Overall-Image-Assignment-7-1-scaled-e1648305843625-300x281.jpg 300w, https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Overall-Image-Assignment-7-1-scaled-e1648305843625-1024x958.jpg 1024w, https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Overall-Image-Assignment-7-1-scaled-e1648305843625-768x719.jpg 768w, https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Overall-Image-Assignment-7-1-scaled-e1648305843625-1536x1437.jpg 1536w, https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Overall-Image-Assignment-7-1-scaled-e1648305843625-1200x1123.jpg 1200w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></p>
<h2>Code:</h2>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">/*
 * Assignment 7: Sound with Meaning
 * Judson Kyle
 * judsonk
 * 
 * Description: This sketch plays a sound corresponding to the users mood at the
 *              time. Depending on the button pressed, a sound corresponding to
 *              one of three emotions will play. These emotions are intense/stressed,
 *              happy/upbeat, and peaceful/relaxed corresponding to buttons 0, 1,
 *              and 2 respectively. Each sound will only play once through to the
 *              end and not repeat after that.
 */

#include &lt;Audio.h&gt;
#include &lt;Wire.h&gt;
#include &lt;SPI.h&gt;
#include &lt;SD.h&gt;
#include &lt;SerialFlash.h&gt;

AudioPlaySdWav           playWav1;
AudioMixer4              mixer1;         //xy=647,408
AudioOutputMQS           mqs1;           //xy=625,279
AudioConnection          patchCord1(playWav1, 0, mqs1, 0);
AudioConnection          patchCord2(playWav1, 1, mqs1, 1);

#define SDCARD_CS_PIN    BUILTIN_SDCARD
#define SDCARD_MOSI_PIN  11  // not actually used
#define SDCARD_SCK_PIN   13  // not actually used

#define SWITCH0   33
#define SWITCH1   34
#define SWITCH2   35
#define SWITCH3   37
#define SWITCH4   38
#define SWITCH5   39

#define BUTTON0   16
#define BUTTON1   17
#define BUTTON2   18

unsigned long currTime = 0;
unsigned long debounceTime = 0;
volatile unsigned long startTime = 0;

volatile bool DEBOUNCE = false;

int numButtons = 3;

volatile int state = 0;

const char* currFileName = "Shark Attack Shortened.WAV";

void setup(void)
{
  // Wait for at least 3 seconds for the USB serial connection
  Serial.begin (9600);

  AudioMemory(8);

  pinMode(SWITCH0, INPUT);
  pinMode(SWITCH1, INPUT);
  pinMode(SWITCH2, INPUT);
  pinMode(SWITCH3, INPUT);
  pinMode(SWITCH4, INPUT);
  pinMode(SWITCH5, INPUT);

  attachInterrupt(digitalPinToInterrupt(BUTTON0), button0Pressed, CHANGE);
  attachInterrupt(digitalPinToInterrupt(BUTTON1), button1Pressed, CHANGE);
  attachInterrupt(digitalPinToInterrupt(BUTTON2), button2Pressed, CHANGE);

  SPI.setMOSI(SDCARD_MOSI_PIN);
  SPI.setSCK(SDCARD_SCK_PIN);
  if (!(SD.begin(SDCARD_CS_PIN))) {
    // stop here, but print a message repetitively
    while (1) {
      Serial.println("Unable to access the SD card");
      delay(500);
    }
  }

}

void loop (void)
{
  currTime = millis();
  static int prevState = 0;

  if (prevState != state) {
    if (playWav1.isPlaying()) {
      playWav1.stop();
    }
    switch (state) {
      case 0: //Play intense sound
        currFileName = "Shark Attack Shortened.WAV";
        playWav1.play(currFileName);
        printPlayState(currFileName);
        delay(5);
        break;
      case 1: //Play fun/upbeat sound
        currFileName = "African_fun_long.WAV";
        playWav1.play(currFileName);
        printPlayState(currFileName);
        delay(5);
        break;
      case 2: //Play peaceful sound
        currFileName = "With-You-in-My-Arms-SSJ011001.WAV";
        playWav1.play(currFileName);
        printPlayState(currFileName);
        delay(5);
        break;
    }
  }
  prevState = state;
  
  //Update debounce state
  DEBOUNCE = abs(currTime - startTime) &lt; debounceTime;
}

//Button 0 interrupt function
void button0Pressed() {
  if ((digitalRead(BUTTON0) &lt; 1) &amp;&amp; !DEBOUNCE) {
    state = 0;
    startTime = currTime;
    DEBOUNCE = true;
  }
}

//Button 1 interrupt function
void button1Pressed() {
  if ((digitalRead(BUTTON1) &lt; 1) &amp;&amp; !DEBOUNCE) {
    state = 1;
    startTime = currTime;
    DEBOUNCE = true;
  }
}

//Button 2 interrupt function
void button2Pressed() {
  if ((digitalRead(BUTTON2) &lt; 1) &amp;&amp; !DEBOUNCE) {
    state = 2;
    startTime = currTime;
    DEBOUNCE = true;
  }
}

//Print out the current cong being played or return an error message if the song isn't being played
void printPlayState(const char* fileName) {
  if (!playWav1.isPlaying()) {
    Serial.print("Error playing: ");
    Serial.println(fileName);
    delay(5);
  }
  else {
    Serial.print("Playing: ");
    Serial.println(fileName);
    delay(5);
  }
}</pre>
<h2>Electrical Schematic:</h2>
<p><img loading="lazy" class="alignnone size-full wp-image-2431" src="https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment_7_Electrical_Schematic_schem.png" alt="" width="1761" height="1008" srcset="https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment_7_Electrical_Schematic_schem.png 1761w, https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment_7_Electrical_Schematic_schem-300x172.png 300w, https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment_7_Electrical_Schematic_schem-1024x586.png 1024w, https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment_7_Electrical_Schematic_schem-768x440.png 768w, https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment_7_Electrical_Schematic_schem-1536x879.png 1536w, https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment_7_Electrical_Schematic_schem-1200x687.png 1200w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://courses.ideate.cmu.edu/48-339/s2022/?feed=rss2&#038;p=2411</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Assignment 7: Sound with Meaning &#8211; James Kyle</title>
		<link>https://courses.ideate.cmu.edu/48-339/s2022/?p=2414</link>
					<comments>https://courses.ideate.cmu.edu/48-339/s2022/?p=2414#respond</comments>
		
		<dc:creator><![CDATA[jkyle1@andrew.cmu.edu]]></dc:creator>
		<pubDate>Sat, 26 Mar 2022 14:33:32 +0000</pubDate>
				<category><![CDATA[Assignment 7]]></category>
		<guid isPermaLink="false">https://courses.ideate.cmu.edu/48-339/s2022/?p=2414</guid>

					<description><![CDATA[Concept: For my sound with meaning, I tried to recreate the jaws &#8220;duuuuuuuuuh&#8230;duh&#8221; tune on an interrupt as an indication that someone is approaching. I tried creating my own tune using the tone() function and playing F1 for 1 second and then and F1# for a quarter second but it wasn&#8217;t realistic enough for me. &#8230; <a href="https://courses.ideate.cmu.edu/48-339/s2022/?p=2414" class="more-link">Continue reading<span class="screen-reader-text"> "Assignment 7: Sound with Meaning &#8211; James Kyle"</span></a>]]></description>
										<content:encoded><![CDATA[<p><span style="text-decoration: underline"><strong>Concept:</strong></span></p>
<p>For my sound with meaning, I tried to recreate the jaws &#8220;duuuuuuuuuh&#8230;duh&#8221; tune on an interrupt as an indication that someone is approaching. I tried creating my own tune using the tone() function and playing F1 for 1 second and then and F1# for a quarter second but it wasn&#8217;t realistic enough for me. I ended up using an SD card loaded with some ambient noise and a clip from the Jaws theme song to indicate the states of the device. When the button is pressed, it triggers the Jaws snippet and then goes back to ambient noise once the tune is finished.</p>
<p><span style="text-decoration: underline"><strong>Demo Video:</strong></span></p>
<div style="width: 360px;" class="wp-video"><!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->
<video class="wp-video-shortcode" id="video-2414-1" width="360" height="640" preload="metadata" controls="controls"><source type="video/mp4" src="https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment-7-Demo-2.mp4?_=1" /><a href="https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment-7-Demo-2.mp4">https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment-7-Demo-2.mp4</a></video></div>
<p><span style="text-decoration: underline"><strong>Circuit Diagram:</strong></span></p>
<p><img loading="lazy" class="alignnone wp-image-2427" src="https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment-7-Circuit-300x172.png" alt="" width="903" height="518" srcset="https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment-7-Circuit-300x172.png 300w, https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment-7-Circuit-1024x588.png 1024w, https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment-7-Circuit-768x441.png 768w, https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment-7-Circuit-1536x882.png 1536w, https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment-7-Circuit-1200x689.png 1200w, https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment-7-Circuit.png 1755w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></p>
<p><span style="text-decoration: underline"><strong>Woes:</strong></span></p>
<p>I faced a lot of issues getting the sound to play from the amplifier and here are some things I learned. First and foremost, the amplifier needs to be tuned to the correct volume so that you can clearly hear you sound. When it wasn&#8217;t tuned correctly, I would get a lot of static or muffled versions of the sound I was trying to play. I also ran into the problem of playing the tunes too fast which gave me a beeping machine error type f sound. From experimenting with the circuit and code a little, I have pinned this problem down to playing tunes too fast in succession (not waiting for the tunes to finish before playing it again).</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://courses.ideate.cmu.edu/48-339/s2022/?feed=rss2&#038;p=2414</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://courses.ideate.cmu.edu/48-339/s2022/wp-content/uploads/2022/03/Assignment-7-Demo-2.mp4" length="2568742" type="video/mp4" />

			</item>
		<item>
		<title>Assignment 7: sound with meaning</title>
		<link>https://courses.ideate.cmu.edu/48-339/s2022/?p=2392</link>
					<comments>https://courses.ideate.cmu.edu/48-339/s2022/?p=2392#respond</comments>
		
		<dc:creator><![CDATA[Jet Townsend]]></dc:creator>
		<pubDate>Fri, 18 Mar 2022 02:11:24 +0000</pubDate>
				<category><![CDATA[Assignment 7]]></category>
		<guid isPermaLink="false">https://courses.ideate.cmu.edu/48-339/s2022/?p=2392</guid>

					<description><![CDATA[For this assignment, using a Teensy, generate sound-over-time and sound-by-interrupt that conveys meaning, feeling, or specific content.  You can generate sound with a speaker or a kinetic device (ex: door chime) or some other novel invention.  I should be able to figure out what I&#8217;m hearing and what it means with no advise/help. This is &#8230; <a href="https://courses.ideate.cmu.edu/48-339/s2022/?p=2392" class="more-link">Continue reading<span class="screen-reader-text"> "Assignment 7: sound with meaning"</span></a>]]></description>
										<content:encoded><![CDATA[<p>For this assignment, using a Teensy, generate sound-over-time and sound-by-interrupt that conveys meaning, feeling, or specific content.  You can generate sound with a speaker or a kinetic device (ex: door chime) or some other novel invention.  I should be able to figure out what I&#8217;m hearing and what it means with no advise/help.</p>
<p>This is a good time to use push buttons or other inputs to trigger sound and another input to define the type of sound.</p>
<p>This is also where interrupts are very useful.</p>
<p>My  phone *doesn’t* do this well.  If I am listening to music and someone rings my doorbell at home, my phone continues to play music *and* the doorbell notification sound at the same time.  What it should do is stop the music, play the notification, then give me the opportunity to talk to the person at the door, then continue playing music.</p>
<p>Due next class.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://courses.ideate.cmu.edu/48-339/s2022/?feed=rss2&#038;p=2392</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
