7
7
#include "pico/stdlib.h"
8
8
#include "pico/tone.h"
9
9
10
- /** Example code to generate tones with Buzzer using PWM with pico-sdk.
10
+ /** Example code to generate tones with Buzzer using pico-sdk.
11
11
*
12
- * Every sound humans encounter consists of one or more frequencies, and the
13
- * way the ear interprets those sounds is called pitch.
12
+ * The melody is the Christmas song "Noche de Paz" (Silent Night).
14
13
*
15
- * In order to produce a variety of pitches, a digital signal needs to convey
16
- * the frequency of sound it is trying to reproduce. The simplest approach is
17
- * to generate a 50% duty cycle pulse stream and set the frequency to the
18
- * desired pitch.
19
- *
20
- * References:
21
- * - https://www.hackster.io/106958/pwm-sound-synthesis-9596f0#overview
14
+ * .:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
15
+ * . .
16
+ * . * Song: Noche de Paz (Silent Night) .
17
+ * . /.\ Instrument: Buzzer .
18
+ * . /..'\ Interpreter: Raspberry Pi Pico .
19
+ * . /'.'\ _ .
20
+ * . /.''.'\ _[ ]_ .
21
+ * . /.'.'.\ Merry Christmas! (") .
22
+ * . /'.''.'.\ Feliz Navidad! `__( : )--' .
23
+ * . ^^^[_]^^^ ( : ) .
24
+ * . ""`-...-'"" .
25
+ * . .
26
+ * .:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
27
+ *
22
28
*/
23
29
#define BUZZER_PIN 3
24
30
@@ -44,21 +50,6 @@ int main() {
44
50
// Configure tone generation on BUZZER_PIN
45
51
tone_init (BUZZER_PIN );
46
52
while (1 ) {
47
- /**
48
- * .:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
49
- * . .
50
- * . * Song: Noche de Paz (Silent Night) .
51
- * . /.\ Instrument: Buzzer .
52
- * . /..'\ Interpreter: Raspberry Pi Pico .
53
- * . /'.'\ _ .
54
- * . /.''.'\ _[ ]_ .
55
- * . /.'.'.\ Merry Christmas! (") .
56
- * . /'.''.'.\ Feliz Navidad! `__( : )--' .
57
- * . ^^^[_]^^^ ( : ) .
58
- * . ""`-...-'"" .
59
- * . .
60
- * .:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
61
- */
62
53
// 1
63
54
tone (BUZZER_PIN , NOTE_G4 , 1.5f );
64
55
tone (BUZZER_PIN , NOTE_A4 , .5f );
0 commit comments