{"id":1716,"date":"2020-10-27T18:52:31","date_gmt":"2020-10-27T22:52:31","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/?p=1716"},"modified":"2020-10-27T21:07:27","modified_gmt":"2020-10-28T01:07:27","slug":"funky-music-maker","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/?p=1716","title":{"rendered":"Funky Music Maker"},"content":{"rendered":"<p>After watching the videos on changes and developments in music in class, I got to thinking about what would be a cool, funky way to make music with electronics. I decided that a fun experimental music making idea would combine the ability to change the type of sound quickly on a speaker (frequency) as well as add in the taps that could go with a beat based on your leg moving up and down. This being triggered by your leg would leave a hand open to change out what is being tapped by the solenoid and thus change the sound heard from it. As someone who knows nothing about music and notes, I chose for someone to just change the frequency so that there would be no barriers from someone trying it out. For this proof of concept, I chose to have the speaker turn off when the IR beam is broken and the solenoid moves as it overpowers the sound otherwise.<\/p>\n<div style=\"width: 720px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-1716-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/wp-content\/uploads\/2020\/10\/showing-how-solenoid-moves-with-my-leg.mp4?_=1\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/wp-content\/uploads\/2020\/10\/showing-how-solenoid-moves-with-my-leg.mp4\">https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/wp-content\/uploads\/2020\/10\/showing-how-solenoid-moves-with-my-leg.mp4<\/a><\/video><\/div>\n<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-1716-2\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/wp-content\/uploads\/2020\/10\/playing-around-with-frequency-and-solenoid-moving.mp4?_=2\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/wp-content\/uploads\/2020\/10\/playing-around-with-frequency-and-solenoid-moving.mp4\">https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/wp-content\/uploads\/2020\/10\/playing-around-with-frequency-and-solenoid-moving.mp4<\/a><\/video><\/div>\n<div style=\"width: 368px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-1716-3\" width=\"368\" height=\"656\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/wp-content\/uploads\/2020\/10\/showing-solenoid-hitting-different-objects.mp4?_=3\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/wp-content\/uploads\/2020\/10\/showing-solenoid-hitting-different-objects.mp4\">https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/wp-content\/uploads\/2020\/10\/showing-solenoid-hitting-different-objects.mp4<\/a><\/video><\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\">int solenoidPin = 9;\r\nconst int IRpin = 3;\r\nint IRstate;\r\nint potPin = A0;\r\nint potVal;\r\nint speakerPin = 13;\r\nint frequency;\r\n\r\nvoid setup()\r\n{\r\n  pinMode(solenoidPin, OUTPUT);\r\n  pinMode(IRpin, INPUT);\r\n  digitalWrite(IRpin, HIGH);\r\n  pinMode(potPin, INPUT);\r\n  pinMode(speakerPin, OUTPUT);\r\n  Serial.begin(9600);\r\n}\r\n\r\nvoid loop()\r\n{\r\n  potVal = analogRead(potPin);\r\n  frequency = map(potVal, 0, 1023, 1, 1000);\r\n  IRstate = digitalRead(IRpin);\r\n  Serial.println(IRstate);\r\n  static int start = millis();\r\n  digitalWrite(solenoidPin, !IRstate);\r\n  if (IRstate == 1) {\r\n    tone(speakerPin, frequency);\r\n  }\r\n  else { \/\/broken\r\n    noTone(speakerPin);\r\n  }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After watching the videos on changes and developments in music in class, I got to thinking about what would be a cool, funky way to make music with electronics. I decided that a fun experimental music making idea would combine the ability to change the type of sound quickly on a speaker (frequency) as well &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/?p=1716\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Funky Music Maker&#8221;<\/span><\/a><\/p>\n","protected":false},"author":21,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/index.php?rest_route=\/wp\/v2\/posts\/1716"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/index.php?rest_route=\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1716"}],"version-history":[{"count":8,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/index.php?rest_route=\/wp\/v2\/posts\/1716\/revisions"}],"predecessor-version":[{"id":1751,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/index.php?rest_route=\/wp\/v2\/posts\/1716\/revisions\/1751"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1716"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1716"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/f2020\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1716"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}