8000 Adding descriptions and removing broken links · slavicd/arduino-docs-content@eceaad2 · GitHub
[go: up one dir, main page]

Skip to content

Commit eceaad2

Browse files
committed
Adding descriptions and removing broken links
1 parent 1b36eae commit eceaad2

File tree

3 files changed

+63
-82
lines changed

3 files changed

+63
-82
lines changed

content/learn/03.programming/10.audio/audio.md

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
---
2-
title: "Audio"
3-
description: "An article from the Arduino Playground."
4-
source: ["https://playground.arduino.cc/Main/Freqout/", "https://playground.arduino.cc/Code/MusicalAlgoFun/", "https://playground.arduino.cc/Code/PCMAudio/", "https://playground.arduino.cc/Main/RickRoll/", "https://playground.arduino.cc/Main/Smoothstep/"]
2+
title: "Audio basics with Arduino"
3+
description: "Learn how to create tones and even entire songs using an Arduino."
4+
source:
5+
[
6+
"https://playground.arduino.cc/Main/Freqout/",
7+
"https://playground.arduino.cc/Code/MusicalAlgoFun/",
8+
"https://playground.arduino.cc/Code/PCMAudio/",
9+
"https://playground.arduino.cc/Main/RickRoll/",
10+
"https://playground.arduino.cc/Main/Smoothstep/",
11+
]
512
author: "Arduino Community"
613
---
714

815
> This article was revised on 2022/09/28 by Hannes Siebeneicher.
916
10-
This article highlights different approaches to making sounds and even entire songs with an Arduino. In 2013 Brett Hagman created the [tone()](https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/) library which is a good starting point for creating different types of sounds using an Arduino. As the examples in this article are gathered from the Arduino playground and were mostly created before 2013 the differences in the code should be noted. The examples are nevertheless still relevant as they explain some basic concepts of generating tone frequencies, interpolation and even provide you with some songs to try out. If you want to see an example for a simple melody using the [tone()](https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/) library and familiarize yourself with the concept of external sound data files, you can check out [this example](https://docs.arduino.cc/built-in-examples/digital/toneMelody).
17+
This article highlights different approaches to making sounds and even entire songs with an Arduino. In 2013 Brett Hagman created the [tone()](https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/) library which is a good starting point for creating different types of sounds using an Arduino. As the examples in this article are gathered from the Arduino playground and were mostly created before 2013 a lot of steps are still done manually, which can be skipped when using the [tone()](https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/) library.
18+
19+
The examples are nevertheless still relevant as they explain some basic concepts of generating tone frequencies, interpolation and even provide you with some songs to try out. If you want to see an example for a simple melody using the [tone()](https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/) library and familiarize yourself with the concept of external sound data files, you can check out [this example](https://docs.arduino.cc/built-in-examples/digital/toneMelody).
1120

1221
Most sketches in this article use pin 8 as output for the piezo buzzer or speaker which means you only need to connect your components a shown below and try out the different examples by uploading them to your Arduino. Only the **PCMAudio** example uses pin 11 as it is making us of [PWM](https://www.arduino.cc/en/Tutorial/Foundations/PWM).
1322

@@ -154,7 +163,7 @@ pinMode(outpin, INPUT); // shut off pin to avoid noise from other
154163

155164
### Duration extension
156165

157-
Here's some minor tweaks to the above to extend it just a bit. The above untouched is left out because its simplicity is great. Basically, the array has been changed to have durations and a sentinel was added to mark the end.
166+
In the example below some minor tweaks have been made, mostly changing the array to have durations and a sentinel was added to mark the end. The example shown above remains as it shows a great simplistic structure.
158167

159168
```
160169
float EIGHTH = 1;
@@ -275,7 +284,6 @@ Takes over Timer 1 (16-bit) for the 8000 Hz timer. This breaks PWM (analogWrite(
275284

276285
- http://tet.pub.ro/Documente/Proiect%20final/Documentatie/Difuzor/Arduino%20Sound%20%E2%80%93%20Part%201%20%E2%80%93%20uCHobby.pdf
277286
- https://www.evilmadscientist.com/article.php/avrdac
278-
- https://gonium.net/md/2006/12/27/i-will-think-before-i-code/
279287
- https://www.gamedev.net/reference/articles/article442.asp
280288

281289
### Code
@@ -440,7 +448,7 @@ void loop()
440448
```
441449

442450
The above sketch also requires the `sounddata.h` file which you can find below:
443-
451+
444452
```
445453
// sounddata sound made by wav2c
446454
// (wav2c modified to use unsigned samples)
@@ -950,14 +958,14 @@ const unsigned char sounddata_data[] PROGMEM = {
950958
16, 26, 33, 42, 55, 61, 67, 77, 91, 107, 118, 120, 125, 128, 130, 134, 140, 145, 146, 143,
951959
142, 136, 124, 111, 96, 80, 69, 62, 59, 57, 52, 50, 56, 65, 74, 86, 96, 109, 116,
952960
};
953-
954961
```
955962

956-
957963
## Rick Roll
964+
958965
The following example was created by Samantha Lagestee in 2017. Inspired by the popular meme, this code rickrolls people by playing the song "Never Gonna Give You Up" by Rick Astley on a piezo buzzer. Open the serial port to see the lyrics and sing along.
959966

960967
### Code
968+
961969
```
962970
963971
/\* Rick Roll Code
@@ -980,14 +988,14 @@ Copyright 2017 samilagestee at gmail dot com
980988
#define b3 247 // 247 Hz
981989
#define c4 261 // 261 Hz MIDDLE C
982990
#define c4s 277 // 277 Hz
983-
#define e4f 311 // 311 Hz
991+
#define e4f 311 // 311 Hz
984992
#define f4 349 // 349 Hz
985-
#define a4f 415 // 415 Hz
993+
#define a4f 415 // 415 Hz
986994
#define b4f 466 // 466 Hz
987995
#define b4 493 // 493 Hz
988996
#define c5 523 // 523 Hz
989997
#define c5s 554 // 554 Hz
990-
#define e5f 622 // 622 Hz
998+
#define e5f 622 // 622 Hz
991999
#define f5 698 // 698 Hz
9921000
#define f5s 740 // 740 Hz
9931001
#define a5f 831 // 831 Hz
@@ -1164,13 +1172,14 @@ if (a == 7) { // loop back around to beginning of song
11641172
a = 1;
11651173
}
11661174
}
1167-
11681175
```
11691176

11701177
## MusicalAlgoFun
1178+
11711179
This is a simple song with the Arduino created by Alexandre Quessy in 2006.
11721180

11731181
### Code
1182+
11741183
```
11751184
11761185
/\*
@@ -1213,7 +1222,7 @@ pinMode(speakerOut, OUTPUT);
12131222
}
12141223
12151224
void loop() {
1216-
digitalWrite(speakerOut, LOW);
1225+
digitalWrite(speakerOut, LOW);
12171226
for (beat = 0; beat < MAXCOUNT; beat++) {
12181227
statePin = !statePin;
12191228
digitalWrite(ledPin, statePin);
@@ -1238,6 +1247,7 @@ delay(1000);
12381247
```
12391248

12401249
### Improved version
1250+
12411251
```
12421252
12431253
/\*
@@ -1289,7 +1299,7 @@ timeUpDown[i] = 1000000 / (pow(2, (i - 69) / 12.0) \* 880);
12891299
}
12901300
12911301
void loop() {
1292-
digitalWrite(speakerOut, LOW);
1302+
digitalWrite(speakerOut, LOW);
12931303
for (beat = 0; beat < MAXCOUNT; beat++) {
12941304
statePin = !statePin;
12951305
digitalWrite(ledPin, statePin);
@@ -1313,5 +1323,4 @@ digitalWrite(ledPin, statePin);
13131323
digitalWrite(speakerOut, LOW);
13141324
delay(1000);
13151325
}
1316-
13171326
```

content/learn/03.programming/11.bitMath/bitMath.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: "BitMath"
3-
description: "An article from the Arduino Playground."
2+
title: "BitMath with Arduino"
3+
description: "Learn about bit math and how to manipulate individual bits in your Arduino sketches."
44
source: "https://playground.arduino.cc/Code/BitMath/"
55
author: "Arduino Community"
66
---

0 commit comments

Comments
 (0)
0