Difference between revisions of "Music Painting"

From Microduino Wiki
Jump to: navigation, search
(Created page with "{| style="width: 1000px;" |- | ==Outline== 600px|center Play your favorite songs with buzzer. <br> Suitable kits: mCookie102, mCookie202,...")
 
 
Line 46: Line 46:
 
==Programming==
 
==Programming==
 
===Required Program Block===
 
===Required Program Block===
*[[“Buzzer on-melody” program block]]
+
*[["Buzzer on-melody" program block]]
*[[“Delay”program block]]
+
*[["Delay" program block]]
  
 
===Programming Thought===
 
===Programming Thought===
Line 60: Line 60:
 
'''1. The first piece of music'''
 
'''1. The first piece of music'''
 
<br>
 
<br>
Use “Buzzer on” melody program block to set the melody, delaying 500ms representing this note lasting for one beat, delaying 500ms representing this note lasting for two beat.  
+
Use "Buzzer on" melody program block to set the melody, delaying 500ms representing this note lasting for one beat, delaying 500ms representing this note lasting for two beat.  
 
[[File:mixly-ctrl-musicpaint-code1.jpg|600px|center]]
 
[[File:mixly-ctrl-musicpaint-code1.jpg|600px|center]]
 
'''2. The second piece of music.'''
 
'''2. The second piece of music.'''
 
<br>
 
<br>
Use “Buzzer on” melody program block to set melody, and use delay to select beat.  
+
Use "Buzzer on" melody program block to set melody, and use delay to select beat.  
 
[[File:mixly-ctrl-musicpaint-code2.jpg|600px|center]]
 
[[File:mixly-ctrl-musicpaint-code2.jpg|600px|center]]
 
'''Test the result'''
 
'''Test the result'''
Line 70: Line 70:
 
After upload, try it to check whether you can hear the song Twinkle Twinkle Little Star as supposed?  
 
After upload, try it to check whether you can hear the song Twinkle Twinkle Little Star as supposed?  
 
<br>
 
<br>
*Q: Why dose the music sound vague, while the program is right, there is no pause between two notes?
+
*Q: Why dose the music sound vague, while the program is right, there is no pause between two notes?
*A: We can add a “buzzer off” program block to the end of each note.  
+
*A: We can add a "buzzer off" program block to the end of each note.  
 
<br>
 
<br>
 
<br>
 
<br>
Delay 500ms, so that this mote can last for one beat; add “Buzzer off” and “delay” program block to make the note pause for 50ms, separating from the next not.  
+
Delay 500ms, so that this mote can last for one beat; add "Buzzer off" and "delay" program block to make the note pause for 50ms, separating from the next not.  
 
[[File:mixly-ctrl-musicpaint-code3.jpg|600px|center]]
 
[[File:mixly-ctrl-musicpaint-code3.jpg|600px|center]]
  
Line 96: Line 96:
 
**A: Because the buzzer belongs to passive buzzer, only changed voltage signal can make it ring. It is the active buzzer that can ring after added voltage.  
 
**A: Because the buzzer belongs to passive buzzer, only changed voltage signal can make it ring. It is the active buzzer that can ring after added voltage.  
 
*Q: Can the buzzer sing?
 
*Q: Can the buzzer sing?
**A: It can emit do, re, mi, fa, sol, la, si of different frequencies, and can make up music, please refer to [[Music Painting]]. If you want to play music, audio decoder chip and horn are required.  
+
**A: It can emit do, re, mi, fa, sol, la, si of different frequencies, and can make up music. If you want to play music, audio decoder chip and horn are required.  
  
 
|}
 
|}

Latest revision as of 04:09, 14 October 2016


Outline

Anywhere musicpaint.jpg

Play your favorite songs with buzzer.


Suitable kits: mCookie102, mCookie202, mCookie302, IBC


Module Bill

Module

Module Number Function
mCookie-Core 1 Core board
mCookie-USBTTL 1 Program download
mCookie-Hub 1 Sensor adapter plate
Buzzer 1 Sound production

Other Equipment

  • USB cable*1
  • Sensor cable*1
  • Lego shell*1
  • Lego or other fixation structure
Anywhere musicpaint-module.jpg


Module Setup

Anywhere musicpaint-module—step.jpg
  • Assemble the modules and sensors:
    • Stick the red core module, USB upload module and extension module;
    • Connect the buzzer to pin 6/7 of Hub;
    • Insert one end of USB cable into the USB upload module, and connect the other end to computer;


Programming

Required Program Block

Programming Thought

At first, popularize the related knowledge to numbered musical notation-note.

Mixly yinfu 1.jpg
Mixly yinfu 2.jpg

Simulate different notes with buzzer, and control the beats with delay program block, to play the song Twinkle Twinkle Little Star.

Mixly-ctrl-musicpaint.jpg
Mixly-ctrl-musicpaint1.jpg

Start to Program

1. The first piece of music
Use "Buzzer on" melody program block to set the melody, delaying 500ms representing this note lasting for one beat, delaying 500ms representing this note lasting for two beat.

Mixly-ctrl-musicpaint-code1.jpg

2. The second piece of music.
Use "Buzzer on" melody program block to set melody, and use delay to select beat.

Mixly-ctrl-musicpaint-code2.jpg

Test the result
After upload, try it to check whether you can hear the song Twinkle Twinkle Little Star as supposed?

  • Q: Why dose the music sound vague, while the program is right, there is no pause between two notes?
  • A: We can add a "buzzer off" program block to the end of each note.



Delay 500ms, so that this mote can last for one beat; add "Buzzer off" and "delay" program block to make the note pause for 50ms, separating from the next not.

Mixly-ctrl-musicpaint-code3.jpg

Test the result
After upload, it is clear between each two notes.
Set up a little music box with Lego, and install buzzer on it, and play your own music with it, then share with your friends.

Anywhere musicpaint.jpg

Technical Specification

  • The product number of buzzer:
  • The buzzer is passive.
  • For details about buzzer, please refer to Sensor-Buzzer.


Related Cases


FAQ

  • Q: Why can't the buzzer ring, directly connected to the power supply?
    • A: Because the buzzer belongs to passive buzzer, only changed voltage signal can make it ring. It is the active buzzer that can ring after added voltage.
  • Q: Can the buzzer sing?
    • A: It can emit do, re, mi, fa, sol, la, si of different frequencies, and can make up music. If you want to play music, audio decoder chip and horn are required.