Tutorial.Tone History

Hide minor edits - Show changes to markup

September 28, 2010, at 10:15 AM by Equipo Traduccion -
Changed lines 22-23 from:

El código de abajo usa un archivo extra, pitches.h. Este archivo contiene todos los valores de las frecuencias de las notas típica. Por ejemplo, NOTE_C4 es una C media. NOTE_FS4 es F aguda, y así sucesivamente. Eta tabla de notas fue originalmente escrita por Brett Hagman, en el que está basada la función tone(). La encontrarás util cada vez que tengas que reproducir notas musicales.

to:

El código de abajo usa un archivo extra, pitches.h. Este archivo contiene todos los valores de las frecuencias de las notas típica. Por ejemplo, NOTE_C4 es una C media. NOTE_FS4 es F aguda, y así sucesivamente. Esta tabla de notas fue originalmente escrita por Brett Hagman, en el que está basada la función tone(). La encontrarás util cada vez que tengas que reproducir notas musicales.

June 03, 2010, at 11:55 PM by Equipo Traduccion -
Changed lines 1-8 from:

Examples > Digital I/O

Play Melody using the tone() function

This example shows how to use the tone() command to generate notes. It plays a little melody you may have heard before.

Circuit

to:

Ejemplos > Digital I/O

Reproduce un tono usando la función tone()

Este ejemplo muestra como usar la función tone() para generar notas. Reproduce una pequeña melodia que quizás hayas escuchado antes.

Circuito

Changed lines 11-17 from:

image developed using Fritzing. For more circuit examples, see the Fritzing project page

Schematic:

click the image to enlarge

to:

image developed using Fritzing. For more circuit examples, see the Página del projecto Fritzing

Esquemático:

Haz click en la imagen para agrandarla

Changed lines 21-25 from:

Code

The code below uses an extra file, pitches.h. This file contains all the pitch values for typical notes. For example, NOTE_C4 is middle C. NOTE_FS4 is F sharp, and so forth. This note table was originally written by Brett Hagman, on whose work the tone() command was based. You may find it useful for whenever you want to make musical notes.

To make this file, click on the "new Tab" button in the upper right hand corner of the window. It looks like this:

to:

Código

El código de abajo usa un archivo extra, pitches.h. Este archivo contiene todos los valores de las frecuencias de las notas típica. Por ejemplo, NOTE_C4 es una C media. NOTE_FS4 es F aguda, y así sucesivamente. Eta tabla de notas fue originalmente escrita por Brett Hagman, en el que está basada la función tone(). La encontrarás util cada vez que tengas que reproducir notas musicales.

Para crear este archivo, haz click en el botón "new Tab" (nueva pestaña) en la esquina superior derecha de la ventana. Queda algo así:

Changed line 35 from:

The main sketch is as follows:

to:

El programa principal es el siguiente:

January 22, 2010, at 12:04 AM by Tom Igoe -
Changed lines 31-120 from:
 #define NOTE_B0  31
 #define NOTE_C1  33
 #define NOTE_CS1 35
 #define NOTE_D1  37
 #define NOTE_DS1 39
 #define NOTE_E1  41
 #define NOTE_F1  44
 #define NOTE_FS1 46
 #define NOTE_G1  49
 #define NOTE_GS1 52
 #define NOTE_A1  55
 #define NOTE_AS1 58
 #define NOTE_B1  62
 #define NOTE_C2  65
 #define NOTE_CS2 69
 #define NOTE_D2  73
 #define NOTE_DS2 78
 #define NOTE_E2  82
 #define NOTE_F2  87
 #define NOTE_FS2 93
 #define NOTE_G2  98
 #define NOTE_GS2 104
 #define NOTE_A2  110
 #define NOTE_AS2 117
 #define NOTE_B2  123
 #define NOTE_C3  131
 #define NOTE_CS3 139
 #define NOTE_D3  147
 #define NOTE_DS3 156
 #define NOTE_E3  165
 #define NOTE_F3  175
 #define NOTE_FS3 185
 #define NOTE_G3  196
 #define NOTE_GS3 208
 #define NOTE_A3  220
 #define NOTE_AS3 233
 #define NOTE_B3  247
 #define NOTE_C4  262
 #define NOTE_CS4 277
 #define NOTE_D4  294
 #define NOTE_DS4 311
 #define NOTE_E4  330
 #define NOTE_F4  349
 #define NOTE_FS4 370
 #define NOTE_G4  392
 #define NOTE_GS4 415
 #define NOTE_A4  440
 #define NOTE_AS4 466
 #define NOTE_B4  494
 #define NOTE_C5  523
 #define NOTE_CS5 554
 #define NOTE_D5  587
 #define NOTE_DS5 622
 #define NOTE_E5  659
 #define NOTE_F5  698
 #define NOTE_FS5 740
 #define NOTE_G5  784
 #define NOTE_GS5 831
 #define NOTE_A5  880
 #define NOTE_AS5 932
 #define NOTE_B5  988
 #define NOTE_C6  1047
 #define NOTE_CS6 1109
 #define NOTE_D6  1175
 #define NOTE_DS6 1245
 #define NOTE_E6  1319
 #define NOTE_F6  1397
 #define NOTE_FS6 1480
 #define NOTE_G6  1568
 #define NOTE_GS6 1661
 #define NOTE_A6  1760
 #define NOTE_AS6 1865
 #define NOTE_B6  1976
 #define NOTE_C7  2093
 #define NOTE_CS7 2217
 #define NOTE_D7  2349
 #define NOTE_DS7 2489
 #define NOTE_E7  2637
 #define NOTE_F7  2794
 #define NOTE_FS7 2960
 #define NOTE_G7  3136
 #define NOTE_GS7 3322
 #define NOTE_A7  3520
 #define NOTE_AS7 3729
 #define NOTE_B7  3951
 #define NOTE_C8  4186
 #define NOTE_CS8 4435
 #define NOTE_D8  4699
 #define NOTE_DS8 4978
to:
Changed lines 37-67 from:
 #include "pitches.h"

 // notes in the melody:
 int melody[] = {
   NOTE_C4, NOTE_G3,NOTE_G3, NOTE_A3, NOTE_G3,0, NOTE_B3, NOTE_C4};

 // note durations: 4 = quarter note, 8 = eighth note, etc.:
 int noteDurations[] = {
   4, 8, 8, 4,4,4,4,4 };

 void setup() {
   // iterate over the notes of the melody:
   for (int thisNote = 0; thisNote < 8; thisNote++) {

     // to calculate the note duration, take one second 
     // divided by the note type.
     //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
     int noteDuration = 1000/noteDurations[thisNote];
     tone(8, melody[thisNote],noteDuration);

     // to distinguish the notes, set a minimum time between them.
     // the note's duration + 30% seems to work well:
     int pauseBetweenNotes = noteDuration * 1.30;
     delay(pauseBetweenNotes);
   }
 }

 void loop() {
   // no need to repeat the melody.
 }
to:
January 21, 2010, at 08:00 PM by Tom Igoe -
Changed lines 3-4 from:

Debounce

to:

Play Melody using the tone() function

January 21, 2010, at 05:49 PM by Tom Igoe -
Changed lines 31-120 from:
 &hash;define NOTE_B0  31
 &hash;define NOTE_C1  33

&hash;define NOTE_CS1 35 &hash;define NOTE_D1 37 &hash;define NOTE_DS1 39 &hash;define NOTE_E1 41 &hash;define NOTE_F1 44 &hash;define NOTE_FS1 46 &hash;define NOTE_G1 49 &hash;define NOTE_GS1 52 &hash;define NOTE_A1 55 &hash;define NOTE_AS1 58 &hash;define NOTE_B1 62 &hash;define NOTE_C2 65 &hash;define NOTE_CS2 69 &hash;define NOTE_D2 73 &hash;define NOTE_DS2 78 &hash;define NOTE_E2 82 &hash;define NOTE_F2 87 &hash;define NOTE_FS2 93 &hash;define NOTE_G2 98 &hash;define NOTE_GS2 104 &hash;define NOTE_A2 110 &hash;define NOTE_AS2 117 &hash;define NOTE_B2 123 &hash;define NOTE_C3 131 &hash;define NOTE_CS3 139 &hash;define NOTE_D3 147 &hash;define NOTE_DS3 156 &hash;define NOTE_E3 165 &hash;define NOTE_F3 175 &hash;define NOTE_FS3 185 &hash;define NOTE_G3 196 &hash;define NOTE_GS3 208 &hash;define NOTE_A3 220 &hash;define NOTE_AS3 233 &hash;define NOTE_B3 247 &hash;define NOTE_C4 262 &hash;define NOTE_CS4 277 &hash;define NOTE_D4 294 &hash;define NOTE_DS4 311 &hash;define NOTE_E4 330 &hash;define NOTE_F4 349 &hash;define NOTE_FS4 370 &hash;define NOTE_G4 392 &hash;define NOTE_GS4 415 &hash;define NOTE_A4 440 &hash;define NOTE_AS4 466 &hash;define NOTE_B4 494 &hash;define NOTE_C5 523 &hash;define NOTE_CS5 554 &hash;define NOTE_D5 587 &hash;define NOTE_DS5 622 &hash;define NOTE_E5 659 &hash;define NOTE_F5 698 &hash;define NOTE_FS5 740 &hash;define NOTE_G5 784 &hash;define NOTE_GS5 831 &hash;define NOTE_A5 880 &hash;define NOTE_AS5 932 &hash;define NOTE_B5 988 &hash;define NOTE_C6 1047 &hash;define NOTE_CS6 1109 &hash;define NOTE_D6 1175 &hash;define NOTE_DS6 1245 &hash;define NOTE_E6 1319 &hash;define NOTE_F6 1397 &hash;define NOTE_FS6 1480 &hash;define NOTE_G6 1568 &hash;define NOTE_GS6 1661 &hash;define NOTE_A6 1760 &hash;define NOTE_AS6 1865 &hash;define NOTE_B6 1976 &hash;define NOTE_C7 2093 &hash;define NOTE_CS7 2217 &hash;define NOTE_D7 2349 &hash;define NOTE_DS7 2489 &hash;define NOTE_E7 2637 &hash;define NOTE_F7 2794 &hash;define NOTE_FS7 2960 &hash;define NOTE_G7 3136 &hash;define NOTE_GS7 3322 &hash;define NOTE_A7 3520 &hash;define NOTE_AS7 3729 &hash;define NOTE_B7 3951 &hash;define NOTE_C8 4186 &hash;define NOTE_CS8 4435 &hash;define NOTE_D8 4699 &hash;define NOTE_DS8 4978

to:
 #define NOTE_B0  31
 #define NOTE_C1  33
 #define NOTE_CS1 35
 #define NOTE_D1  37
 #define NOTE_DS1 39
 #define NOTE_E1  41
 #define NOTE_F1  44
 #define NOTE_FS1 46
 #define NOTE_G1  49
 #define NOTE_GS1 52
 #define NOTE_A1  55
 #define NOTE_AS1 58
 #define NOTE_B1  62
 #define NOTE_C2  65
 #define NOTE_CS2 69
 #define NOTE_D2  73
 #define NOTE_DS2 78
 #define NOTE_E2  82
 #define NOTE_F2  87
 #define NOTE_FS2 93
 #define NOTE_G2  98
 #define NOTE_GS2 104
 #define NOTE_A2  110
 #define NOTE_AS2 117
 #define NOTE_B2  123
 #define NOTE_C3  131
 #define NOTE_CS3 139
 #define NOTE_D3  147
 #define NOTE_DS3 156
 #define NOTE_E3  165
 #define NOTE_F3  175
 #define NOTE_FS3 185
 #define NOTE_G3  196
 #define NOTE_GS3 208
 #define NOTE_A3  220
 #define NOTE_AS3 233
 #define NOTE_B3  247
 #define NOTE_C4  262
 #define NOTE_CS4 277
 #define NOTE_D4  294
 #define NOTE_DS4 311
 #define NOTE_E4  330
 #define NOTE_F4  349
 #define NOTE_FS4 370
 #define NOTE_G4  392
 #define NOTE_GS4 415
 #define NOTE_A4  440
 #define NOTE_AS4 466
 #define NOTE_B4  494
 #define NOTE_C5  523
 #define NOTE_CS5 554
 #define NOTE_D5  587
 #define NOTE_DS5 622
 #define NOTE_E5  659
 #define NOTE_F5  698
 #define NOTE_FS5 740
 #define NOTE_G5  784
 #define NOTE_GS5 831
 #define NOTE_A5  880
 #define NOTE_AS5 932
 #define NOTE_B5  988
 #define NOTE_C6  1047
 #define NOTE_CS6 1109
 #define NOTE_D6  1175
 #define NOTE_DS6 1245
 #define NOTE_E6  1319
 #define NOTE_F6  1397
 #define NOTE_FS6 1480
 #define NOTE_G6  1568
 #define NOTE_GS6 1661
 #define NOTE_A6  1760
 #define NOTE_AS6 1865
 #define NOTE_B6  1976
 #define NOTE_C7  2093
 #define NOTE_CS7 2217
 #define NOTE_D7  2349
 #define NOTE_DS7 2489
 #define NOTE_E7  2637
 #define NOTE_F7  2794
 #define NOTE_FS7 2960
 #define NOTE_G7  3136
 #define NOTE_GS7 3322
 #define NOTE_A7  3520
 #define NOTE_AS7 3729
 #define NOTE_B7  3951
 #define NOTE_C8  4186
 #define NOTE_CS8 4435
 #define NOTE_D8  4699
 #define NOTE_DS8 4978
January 21, 2010, at 05:48 PM by Tom Igoe -
Changed lines 31-32 from:

&hash;define NOTE_B0 31 &hash;define NOTE_C1 33

to:
 &hash;define NOTE_B0  31
 &hash;define NOTE_C1  33
January 21, 2010, at 05:48 PM by Tom Igoe -
Changed lines 31-121 from:

<pre>

  1. define NOTE_B0 31
  2. define NOTE_C1 33
  3. define NOTE_CS1 35
  4. define NOTE_D1 37
  5. define NOTE_DS1 39
  6. define NOTE_E1 41
  7. define NOTE_F1 44
  8. define NOTE_FS1 46
  9. define NOTE_G1 49
  10. define NOTE_GS1 52
  11. define NOTE_A1 55
  12. define NOTE_AS1 58
  13. define NOTE_B1 62
  14. define NOTE_C2 65
  15. define NOTE_CS2 69
  16. define NOTE_D2 73
  17. define NOTE_DS2 78
  18. define NOTE_E2 82
  19. define NOTE_F2 87
  20. define NOTE_FS2 93
  21. define NOTE_G2 98
  22. define NOTE_GS2 104
  23. define NOTE_A2 110
  24. define NOTE_AS2 117
  25. define NOTE_B2 123
  26. define NOTE_C3 131
  27. define NOTE_CS3 139
  28. define NOTE_D3 147
  29. define NOTE_DS3 156
  30. define NOTE_E3 165
  31. define NOTE_F3 175
  32. define NOTE_FS3 185
  33. define NOTE_G3 196
  34. define NOTE_GS3 208
  35. define NOTE_A3 220
  36. define NOTE_AS3 233
  37. define NOTE_B3 247
  38. define NOTE_C4 262
  39. define NOTE_CS4 277
  40. define NOTE_D4 294
  41. define NOTE_DS4 311
  42. define NOTE_E4 330
  43. define NOTE_F4 349
  44. define NOTE_FS4 370
  45. define NOTE_G4 392
  46. define NOTE_GS4 415
  47. define NOTE_A4 440
  48. define NOTE_AS4 466
  49. define NOTE_B4 494
  50. define NOTE_C5 523
  51. define NOTE_CS5 554
  52. define NOTE_D5 587
  53. define NOTE_DS5 622
  54. define NOTE_E5 659
  55. define NOTE_F5 698
  56. define NOTE_FS5 740
  57. define NOTE_G5 784
  58. define NOTE_GS5 831
  59. define NOTE_A5 880
  60. define NOTE_AS5 932
  61. define NOTE_B5 988
  62. define NOTE_C6 1047
  63. define NOTE_CS6 1109
  64. define NOTE_D6 1175
  65. define NOTE_DS6 1245
  66. define NOTE_E6 1319
  67. define NOTE_F6 1397
  68. define NOTE_FS6 1480
  69. define NOTE_G6 1568
  70. define NOTE_GS6 1661
  71. define NOTE_A6 1760
  72. define NOTE_AS6 1865
  73. define NOTE_B6 1976
  74. define NOTE_C7 2093
  75. define NOTE_CS7 2217
  76. define NOTE_D7 2349
  77. define NOTE_DS7 2489
  78. define NOTE_E7 2637
  79. define NOTE_F7 2794
  80. define NOTE_FS7 2960
  81. define NOTE_G7 3136
  82. define NOTE_GS7 3322
  83. define NOTE_A7 3520
  84. define NOTE_AS7 3729
  85. define NOTE_B7 3951
  86. define NOTE_C8 4186
  87. define NOTE_CS8 4435
  88. define NOTE_D8 4699
  89. define NOTE_DS8 4978

</pre>

to:

&hash;define NOTE_B0 31 &hash;define NOTE_C1 33 &hash;define NOTE_CS1 35 &hash;define NOTE_D1 37 &hash;define NOTE_DS1 39 &hash;define NOTE_E1 41 &hash;define NOTE_F1 44 &hash;define NOTE_FS1 46 &hash;define NOTE_G1 49 &hash;define NOTE_GS1 52 &hash;define NOTE_A1 55 &hash;define NOTE_AS1 58 &hash;define NOTE_B1 62 &hash;define NOTE_C2 65 &hash;define NOTE_CS2 69 &hash;define NOTE_D2 73 &hash;define NOTE_DS2 78 &hash;define NOTE_E2 82 &hash;define NOTE_F2 87 &hash;define NOTE_FS2 93 &hash;define NOTE_G2 98 &hash;define NOTE_GS2 104 &hash;define NOTE_A2 110 &hash;define NOTE_AS2 117 &hash;define NOTE_B2 123 &hash;define NOTE_C3 131 &hash;define NOTE_CS3 139 &hash;define NOTE_D3 147 &hash;define NOTE_DS3 156 &hash;define NOTE_E3 165 &hash;define NOTE_F3 175 &hash;define NOTE_FS3 185 &hash;define NOTE_G3 196 &hash;define NOTE_GS3 208 &hash;define NOTE_A3 220 &hash;define NOTE_AS3 233 &hash;define NOTE_B3 247 &hash;define NOTE_C4 262 &hash;define NOTE_CS4 277 &hash;define NOTE_D4 294 &hash;define NOTE_DS4 311 &hash;define NOTE_E4 330 &hash;define NOTE_F4 349 &hash;define NOTE_FS4 370 &hash;define NOTE_G4 392 &hash;define NOTE_GS4 415 &hash;define NOTE_A4 440 &hash;define NOTE_AS4 466 &hash;define NOTE_B4 494 &hash;define NOTE_C5 523 &hash;define NOTE_CS5 554 &hash;define NOTE_D5 587 &hash;define NOTE_DS5 622 &hash;define NOTE_E5 659 &hash;define NOTE_F5 698 &hash;define NOTE_FS5 740 &hash;define NOTE_G5 784 &hash;define NOTE_GS5 831 &hash;define NOTE_A5 880 &hash;define NOTE_AS5 932 &hash;define NOTE_B5 988 &hash;define NOTE_C6 1047 &hash;define NOTE_CS6 1109 &hash;define NOTE_D6 1175 &hash;define NOTE_DS6 1245 &hash;define NOTE_E6 1319 &hash;define NOTE_F6 1397 &hash;define NOTE_FS6 1480 &hash;define NOTE_G6 1568 &hash;define NOTE_GS6 1661 &hash;define NOTE_A6 1760 &hash;define NOTE_AS6 1865 &hash;define NOTE_B6 1976 &hash;define NOTE_C7 2093 &hash;define NOTE_CS7 2217 &hash;define NOTE_D7 2349 &hash;define NOTE_DS7 2489 &hash;define NOTE_E7 2637 &hash;define NOTE_F7 2794 &hash;define NOTE_FS7 2960 &hash;define NOTE_G7 3136 &hash;define NOTE_GS7 3322 &hash;define NOTE_A7 3520 &hash;define NOTE_AS7 3729 &hash;define NOTE_B7 3951 &hash;define NOTE_C8 4186 &hash;define NOTE_CS8 4435 &hash;define NOTE_D8 4699 &hash;define NOTE_DS8 4978

January 21, 2010, at 05:47 PM by Tom Igoe -
Changed line 31 from:
to:

<pre>

Added line 121:

</pre>

January 21, 2010, at 05:44 PM by Tom Igoe -
Changed lines 9-10 from:
to:
Changed lines 18-20 from:

to:

January 21, 2010, at 05:42 PM by Tom Igoe -
Changed lines 9-10 from:
to:
Changed lines 18-20 from:

to:

January 21, 2010, at 05:40 PM by Tom Igoe -
Added lines 1-156:

Share