Arduino / PCM Audio : Modification de la broche utilisée par le haut parleur

En se basant sur la librairie disponible ici : http://www.arduino.cc/playground/Code/PCMAudio
Il est possible de jouer des son avec un bitrate de 16 kbps et un sample rate de 8 Khz.
L’utilisation pas à pas est décrite ici : http://hlt.media.mit.edu/?p=1963

Sur la version initiale la pin haut parleur est la PIN 11. Cette pin n’est pas utilisable si l’on utilise le shield Ethernet Arduino.

L’utilisation de la pin 11 vient du fait que la lib PCM utilise le Timer2 de l’ATMega. Pour combiner le shield ethernet et la librairie PCM, le seul timer disponible est le timer0 dont la sortie se fait sur la pin 6. Ce timer est aussi celui utilisé par la fonction delay() entre autre.

Il faut donc modifier la lib PCM pour utiliser le timer0 tout en prenant quelques précautions dans le code Arduino.
La version modifiée du PCM.c est disponible ici : PCM

Exemple de code dans l’IDE Arduino :

#include

// Coin coin
const unsigned char samples[] PROGMEM = {
130, 135, 129, 130, 133, 135, 134, 127, 127, 134, 139, 134, 125, 122, 120, 128, 131, 132, 134, 129, 129, 129, 128, 126, 127, 129, 125, 127, 122, 125, 133, 128, 130, 128, 128, 135, 132, 133, 131, 130, 127, 124, 129, 128, 132, 129, 124, 131, 134, 137, 132, 126, 125, 126, 131, 127, 132, 133, 129, 133, 123, 129, 135, 130, 135, 129, 128, 129, 124, 126, 128, 133, 134, 132, 132, 128, 129, 128, 126, 126, 125, 125, 129, 134, 129, 132, 130, 126, 129, 121, 128, 136, 130, 133, 128, 128, 131, 125, 125, 125, 126, 125, 123, 127, 132, 132, 128, 120, 120, 128, 128, 131, 133, 123, 125, 118, 114, 127, 121, 125, 127, 115, 127, 124, 125, 131, 120, 128, 127, 123, 126, 117, 129, 130, 126, 132, 125, 134, 137, 130, 140, 131, 115, 115, 113, 132, 146, 131, 128, 119, 119, 133, 128, 134, 129, 124, 129, 116, 123, 127, 132, 138, 115, 113, 118, 124, 140, 132, 126, 118, 109, 113, 121, 129, 127, 127, 127, 131, 135, 132, 133, 136, 137, 130, 128, 124, 127, 134, 127, 131, 119, 106, 113, 114, 127, 120, 118, 127, 124, 133, 124, 131, 138, 123, 134, 132, 136, 140, 133, 149, 151, 140, 124, 120, 131, 138, 134, 114, 117, 123, 124, 122, 111, 123, 120, 114, 111, 110, 131, 121, 124, 128, 122, 136, 131, 144, 145, 125, 120, 119, 133, 132, 127, 120, 117, 130, 134, 144, 136, 130, 134, 132, 135, 122, 130, 125, 123, 138, 125, 136, 124, 128, 151, 124, 115, 94, 101, 132, 131, 146, 130, 128, 144, 140, 146, 118, 110, 133, 134, 136, 127, 123, 126, 119, 116, 131, 137, 136, 141, 131, 131, 135, 136, 132, 99, 104, 134, 145, 130, 93, 106, 124, 115, 127, 142, 151, 131, 96, 114, 140, 135, 130, 121, 114, 111, 106, 125, 120, 100, 107, 120, 135, 119, 112, 123, 109, 115, 139, 177, 191, 152, 122, 102, 97, 101, 108, 118, 113, 130, 145, 148, 149, 152, 180, 166, 116, 93, 106, 133, 132, 113, 107, 119, 126, 144, 153, 147, 152, 140, 139, 112, 99, 142, 141, 142, 121, 127, 175, 123, 96, 99, 125, 164, 114, 114, 133, 129, 125, 100, 131, 136, 107, 97, 108, 139, 121, 94, 98, 122, 137, 126, 134, 132, 129, 130, 154, 212, 215, 203, 223, 253, 246, 148, 32, 0, 11, 28, 79, 159, 255, 255, 171, 103, 56, 61, 93, 114, 189, 164, 97, 62, 33, 93, 110, 138, 205, 182, 167, 138, 133, 174, 155, 142, 122, 80, 93, 143, 199, 214, 138, 77, 55, 24, 43, 66, 126, 191, 155, 120, 47, 8, 51, 61, 89, 82, 94, 142, 124, 109, 97, 106, 105, 97, 146, 199, 211, 173, 179, 206, 219, 225, 216, 226, 120, 16, 2, 35, 157, 200, 254, 240, 85, 26, 10, 130, 225, 203, 219, 109, 28, 0, 34, 209, 237, 199, 120, 50, 139, 216, 253, 188, 47, 16, 66, 144, 222, 227, 169, 94, 28, 75, 119, 67, 45, 28, 119, 195, 148, 130, 42, 35, 105, 126, 178, 99, 34, 48, 58, 125, 112, 85, 95, 122, 178, 173, 141, 135, 188, 236, 255, 255, 248, 221, 100, 9, 45, 117, 236, 192, 60, 27, 51, 214, 255, 158, 111, 71, 151, 206, 125, 91, 16, 48, 195, 238, 250, 120, 33, 136, 173, 198, 109, 14, 97, 136, 192, 172, 88, 101, 75, 97, 112, 94, 118, 95, 104, 107, 92, 93, 90, 125, 118, 87, 60, 45, 68, 64, 88, 120, 107, 98, 98, 134, 179, 147, 157, 227, 244, 255, 226, 219, 242, 82, 45, 78, 156, 232, 20, 32, 169, 242, 255, 4, 27, 192, 226, 255, 55, 19, 86, 79, 244, 150, 86, 120, 125, 255, 163, 35, 88, 124, 187, 110, 29, 115, 146, 132, 118, 60, 103, 150, 136, 163, 80, 63, 118, 58, 63, 39, 92, 188, 86, 31, 27, 82, 168, 111, 84, 109, 134, 164, 144, 137, 196, 229, 200, 203, 216, 239, 160, 0, 54, 219, 255, 198, 0, 70, 222, 213, 134, 30, 159, 251, 146, 83, 21, 97, 175, 126, 148, 109, 124, 207, 176, 162, 86, 80, 185, 159, 122, 71, 105, 193, 102, 25, 22, 118, 195, 105, 68, 88, 139, 122, 28, 55, 94, 125, 107, 58, 88, 105, 136, 124, 64, 70, 126, 192, 172, 106, 114, 210, 236, 204, 229, 238, 211, 34, 0, 154, 255, 255, 115, 54, 205, 151, 99, 40, 142, 255, 185, 70, 15, 50, 141, 51, 95, 152, 156, 211, 180, 155, 109, 102, 191, 206, 105, 56, 110, 158, 156, 76, 88, 119, 68, 116, 95, 77, 75, 33, 100, 56, 51, 124, 132, 173, 112, 103, 111, 65, 110, 129, 144, 112, 105, 147, 140, 205, 232, 243, 240, 215, 228, 75, 10, 143, 255, 255, 42, 68, 255, 195, 38, 0, 162, 255, 105, 36, 49, 91, 148, 90, 138, 113, 65, 192, 185, 132, 107, 151, 255, 130, 44, 122, 156, 179, 111, 96, 132, 62, 48, 92, 136, 155, 100, 61, 53, 51, 91, 88, 51, 104, 140, 110, 75, 87, 168, 167, 108, 100, 153, 207, 192, 192, 190, 213, 241, 236, 186, 30, 100, 255, 255, 167, 7, 156, 255, 116, 30, 0, 191, 222, 0, 31, 46, 147, 161, 43, 144, 138, 152, 156, 93, 176, 163, 156, 137, 67, 110, 154, 153, 118, 128, 149, 132, 80, 32, 98, 128, 126, 99, 45, 89, 71, 84, 131, 93, 104, 71, 47, 96, 122, 147, 128, 118, 156, 159, 156, 193, 206, 222, 255, 255, 249, 106, 7, 158, 255, 250, 70, 48, 210, 169, 51, 34, 154, 242, 73, 0, 51, 128, 141, 87, 139, 156, 110, 128, 120, 157, 179, 161, 157, 91, 87, 117, 122, 130, 106, 149, 145, 58, 60, 113, 155, 118, 75, 72, 50, 56, 48, 93, 128, 87, 79, 69, 138, 153, 111, 156, 121, 161, 155, 86, 179, 180, 210, 247, 241, 255, 72, 32, 215, 255, 236, 34, 47, 226, 145, 20, 49, 204, 236, 50, 17, 140, 147, 106, 97, 140, 192, 110, 90, 156, 136, 157, 167, 170, 138, 58, 116, 119, 96, 146, 135, 121, 62, 65, 118, 94, 68, 51, 103, 98, 31, 53, 93, 122, 94, 74, 83, 85, 138, 139, 127, 141, 147, 160, 159, 172, 166, 202, 255, 248, 193, 72, 90, 187, 179, 110, 44, 171, 206, 63, 86, 149, 219, 156, 15, 103, 138, 126, 112, 77, 203, 190, 136, 152, 71, 159, 201, 131, 134, 86, 151, 131, 44, 143, 135, 138, 118, 42, 138, 90, 29, 59, 24, 101, 90, 72, 105, 36, 124, 129, 34, 94, 94, 142, 151, 91, 171, 143, 139, 196, 157, 217, 214, 216, 233, 50, 74, 231, 205, 86, 0, 168, 255, 75, 8, 113, 251, 205, 24, 58, 163, 135, 82, 102, 152, 175, 161, 128, 123, 131, 177, 173, 105, 118, 115, 121, 144, 107, 123, 102, 62, 109, 119, 81, 54, 72, 99, 61, 38, 85, 106, 100, 138, 113, 73, 75, 50, 120, 148, 106, 155, 144, 171, 206, 170, 235, 222, 209, 186, 20, 101, 229, 157, 94, 32, 155, 228, 60, 78, 172, 225, 174, 0, 87, 164, 75, 103, 110, 158, 175, 91, 119, 132, 156, 192, 131, 113, 94, 86, 137, 131, 117, 128, 103, 77, 106, 98, 53, 63, 85, 109, 67, 25, 100, 132, 143, 107, 48, 131, 111, 62, 120, 121, 159, 134, 117, 213, 195, 203, 229, 240, 253, 77, 51, 217, 216, 113, 20, 127, 250, 121, 39, 111, 243, 224, 40, 61, 153, 115, 66, 85, 176, 162, 96, 114, 147, 176, 136, 122, 170, 133, 82, 84, 133, 143, 93, 94, 91, 103, 113, 72, 84, 82, 68, 71, 77, 116, 92, 99, 126, 88, 111, 92, 83, 137, 129, 142, 113, 124, 196, 166, 205, 233, 232, 247, 99, 95, 227, 210, 129, 38, 141, 236, 86, 52, 130, 227, 224, 39, 56, 167, 135, 96, 66, 121, 159, 120, 127, 96, 126, 201, 164, 122, 100, 114, 139, 109, 113, 133, 117, 62, 51, 144, 145, 60, 56, 95, 103, 56, 58, 113, 114, 111, 85, 78, 104, 65, 100, 163, 134, 120, 93, 130, 201, 178, 187, 182, 225, 255, 88, 56, 206, 243, 184, 23, 67, 246, 159, 58, 74, 195, 255, 46, 33, 170, 132, 98, 49, 113, 204, 98, 64, 100, 173, 215, 95, 91, 139, 145, 164, 81, 83, 149, 129, 101, 67, 123, 148, 94, 108, 78, 79, 111, 97, 124, 83, 61, 102, 104, 105, 47, 82, 166, 113, 107, 96, 101, 174, 164, 185, 176, 141, 183, 155, 179, 179, 110, 182, 169, 114, 139, 109, 148, 158, 114, 139, 114, 130, 136, 80, 129, 123, 90, 139, 117, 114, 133, 117, 146, 140, 123, 128, 120, 157, 144, 93, 107, 107, 124, 142, 103, 111, 130, 110, 93, 91, 122, 121, 93, 101, 93, 87, 85, 76, 112, 124, 95, 96, 108, 104, 93, 114, 139, 134, 137, 130, 117, 126, 142, 160, 158, 146, 134, 137, 160, 135, 122, 159, 148, 134, 137, 127, 128, 116, 127, 140, 125, 127, 112, 118, 145, 114, 117, 144, 129, 116, 104, 123, 139, 114, 105, 100, 117, 140, 119, 122, 125, 112, 128, 129, 122, 118, 116, 129, 124, 116, 106, 93, 112, 124, 121, 110, 83, 87, 101, 99, 95, 111, 142, 113, 83, 117, 136, 140, 127, 115, 142, 135, 111, 108, 116, 136, 124, 123, 147, 121, 101, 113, 124, 149, 151, 120, 103, 122, 155, 152, 118, 115, 142, 148, 128, 103, 109, 137, 127, 109, 119, 132, 141, 124, 116, 126, 126, 132, 112, 93, 112, 119, 125, 98, 77, 119, 126, 123, 117, 93, 119, 103, 77, 102, 107, 122, 96, 66, 110, 117, 106, 103, 94, 123, 121, 101, 95, 89, 111, 127, 132, 119, 101, 123, 139, 143, 126, 117, 153, 143, 121, 129, 131, 151, 137, 119, 135, 125, 136, 135, 113, 124, 116, 114, 128, 124, 124, 121, 131, 130, 111, 116, 121, 130, 129, 104, 101, 99, 101, 102, 93, 112, 104, 78, 91, 85, 81, 100, 101, 101, 90, 82, 98, 92, 85, 106, 114, 102, 81, 75, 107, 113, 86, 92, 109, 106, 96, 92, 106, 112, 100, 111, 124, 104, 94, 107, 119, 119, 102, 92, 102, 106, 104, 97, 97, 107, 101, 92, 103, 113, 110, 104, 100, 99, 109, 106, 94, 108, 109, 90, 94, 98, 99, 84, 75, 102, 97, 76, 75, 68, 85, 91, 76, 83, 77, 68, 73, 75, 81, 71, 62, 74, 82, 81, 75, 76, 84, 95, 98, 88, 86, 88, 84, 81, 75, 80, 73, 63, 73, 70, 68, 74, 75, 77, 77, 85, 84, 69, 70, 67, 68, 68, 51, 54, 56, 49, 48, 49, 70, 62, 41, 59, 65, 63, 59, 46, 59, 66, 62, 62, 54, 63, 70, 65, 72, 63, 53, 63, 71, 72, 59, 54, 68, 72, 69, 66, 62, 73, 75, 61, 58, 69, 76, 73, 70, 74, 78, 83, 87, 76, 71, 89, 92, 75, 70, 73, 88, 98, 87, 87, 93, 91, 94, 90, 91, 84, 68, 81, 88, 69, 68, 79, 95, 97, 79, 87, 103, 94, 90, 92, 95, 95, 85, 82, 89, 95, 95, 92, 95, 94, 89, 95, 99, 89, 83, 89, 89, 84, 91, 88, 79, 99, 105, 87, 90, 95, 98, 107, 101, 97, 101, 101, 103, 98, 103, 108, 91, 96, 106, 89, 99, 110, 97, 105, 111, 107, 114, 108, 109, 118, 112, 110, 105, 99, 108, 110, 111, 112, 103, 115, 126, 108, 114, 132, 128, 122, 113, 118, 142, 134, 118, 138, 160, 158, 152, 165, 182, 187, 199, 208, 198, 200, 217, 217, 214, 216, 214, 224, 235, 218, 224, 255, 254, 245, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 249, 255, 255, 242, 249, 253, 241, 239, 248, 245, 244, 248, 238, 241, 248, 239, 240, 239, 234, 232, 225, 231, 232, 228, 236, 227, 227, 242, 230, 225, 233, 232, 230, 217, 211, 222, 218, 210, 212, 216, 217, 210, 208, 216, 217, 213, 212, 210, 209, 208, 207, 210, 209, 203, 208, 212, 200, 200, 208, 208, 203, 198, 202, 204, 201, 202, 201, 207, 209, 198, 199, 203, 202, 199, 195, 197, 193, 191, 195, 189, 192, 197, 191, 191, 189, 188, 189, 186, 189, 187, 181, 186, 184, 183, 187, 184, 185, 186, 184, 180, 176, 183, 181, 171, 172, 173, 173, 173, 170, 173, 177, 176, 170, 169, 177, 176, 168, 172, 175, 169, 169, 171, 170, 170, 170, 171, 169, 164, 165, 170, 168, 166, 166, 170, 174, 166, 166, 176, 172, 168, 164, 163, 170, 161, 155, 164, 160, 159, 163, 159, 163, 165, 165, 164, 161, 165, 161, 156, 162, 161, 156, 157, 155, 155, 160, 159, 154, 158, 162, 153, 153, 160, 156, 153, 155, 156, 154, 150, 151, 150, 147, 150, 144, 140, 145, 140, 138, 141, 137, 138, 140, 133, 133, 137, 134, 129, 124, 127, 130, 122, 121, 126, 124, 123, 123, 121, 124, 120, 120, 126, 119, 115, 118, 114, 117, 118, 115, 119, 115, 112, 117, 116, 113, 114, 117, 118, 109, 107, 112, 110, 106, 109, 109, 108, 106, 102, 101, 106, 106, 106, 108, 103, 102, 107, 106, 101, 101, 106, 109, 102, 98, 100, 101, 103, 100, 98, 104, 102, 96, 98, 98, 98, 100, 97, 96, 99, 96, 93, 93, 93, 94, 94, 94, 92, 90, 93, 94, 92, 95, 94, 91, 94, 93, 89, 92, 92, 89, 90, 92, 91, 89, 90, 90, 90, 92, 92, 88, 89, 91, 90, 91, 91, 90, 92, 94, 92, 91, 91, 91, 90, 90, 89, 89, 88, 88, 89, 90, 88, 88, 90, 89, 88, 88, 88, 88, 88, 87, 87, 90, 89, 87, 90, 92, 89, 88, 90, 88, 86, 88, 89, 88, 88, 88, 87, 89, 88, 87, 88, 89, 88, 86, 87, 87, 86, 88, 88, 87, 88, 88, 87, 88, 89, 88, 89, 90, 89, 88, 89, 89, 89, 89, 88, 88, 89, 88, 87, 88, 89, 88, 88, 89, 89, 89, 90, 90, 89, 89, 88, 89, 90, 89, 89, 89, 90, 90, 92, 92, 92, 92, 92, 91, 91, 92, 93, 94, 94, 93, 92, 92, 92, 92, 92, 92, 92, 92, 92, 91, 90, 92, 93, 93, 93, 92, 92, 93, 95, 95, 95, 93, 91, 91, 93, 95, 95, 95, 93, 92, 92, 92, 93, 96, 99, 99, 98, 96, 96, 98, 100, 99, 96, 96, 96, 95, 96, 98, 97, 94, 94, 95, 95, 97, 97, 96, 97, 101, 103, 102, 100, 97, 99, 101, 101, 100, 100, 98, 95, 96, 99, 98, 97, 101, 102, 101, 102, 103, 102, 102, 102, 100, 99, 101, 103, 103, 101, 97, 101, 108, 107, 100, 100, 104, 105, 105, 104, 100, 100, 105, 106, 103, 102, 103, 104, 105, 106, 107, 110, 110, 105, 103, 103, 101, 102, 107, 107, 102, 100, 100, 101, 106, 111, 109, 108, 110, 112, 111, 107, 104, 105, 107, 103, 100, 104, 106, 101, 98, 100, 103, 105, 105, 104, 107, 115, 119, 116, 111, 111, 112, 112, 112, 111, 111, 107, 104, 104, 110, 113, 114, 114, 113, 114, 117, 119, 115, 107, 103, 103, 104, 107, 112, 114, 112, 108, 108, 112, 113, 111, 110, 113, 112, 105, 99, 105, 118, 125, 122, 119, 120, 123, 118, 109, 105, 110, 113, 110, 108, 107, 107, 107, 108, 111, 114, 114, 108, 103, 103, 106, 108, 107, 105, 107, 112, 115, 111, 111, 119, 128, 127, 115, 104, 106, 116, 121, 120, 121, 124, 123, 120, 117, 113, 106, 102, 104, 109, 108, 103, 104, 112, 117, 112, 107, 111, 119, 119, 111, 108, 115, 120, 110, 94, 93, 114, 140, 148, 131, 111, 104, 112, 119, 115, 109, 112, 122, 124, 115, 110, 116, 121, 118, 112, 111, 114, 112, 105, 100, 101, 103, 106, 112, 118, 119, 119, 123, 128, 125, 112, 101, 108, 125, 133, 127, 121, 122, 127, 128, 124, 121, 124, 124, 119, 112, 109, 111, 117, 123, 122, 118, 116, 115, 114, 116, 120, 121, 115, 106, 105, 114, 120, 117, 117, 130, 143, 140, 124, 113, 117, 123, 123, 119, 121, 125, 125, 121, 122, 126, 129, 127, 124, 119, 113, 108, 108, 114, 120, 120, 117, 119, 127, 135, 134, 126, 117, 111, 112, 118, 122, 124, 124, 121, 116, 116, 126, 140, 145, 135, 124, 124, 129, 125, 116, 115, 122, 124, 121, 118, 118, 119, 117, 114, 117, 125, 126, 122, 121, 127, 135, 137, 129, 119, 115, 118, 122, 125, 123, 114, 108, 109, 116, 121, 124, 124, 124, 125, 125, 123, 122, 124, 127, 124, 115, 108, 115, 130, 133, 120, 110, 116, 130, 137, 130, 121, 122, 130, 132, 125, 118, 119, 123, 124, 123, 123, 129, 135, 136, 134, 132, 132, 132, 132, 128, 121, 119, 124, 130, 132, 125, 118, 120, 131, 140, 140, 133, 131, 136, 142, 139, 128, 118, 116, 121, 129, 133, 130, 120, 111, 111, 119, 126, 129, 127, 127, 132, 137, 139, 138, 135, 132, 127, 120, 116, 120, 132, 139, 135, 123, 115, 115, 122, 130, 138, 140, 137, 134, 135, 143, 148, 144, 135, 133, 137, 138, 135, 132, 134, 138, 139, 139, 140, 143, 145, 147, 147, 142, 136, 132, 130, 126, 123, 129, 144, 156, 151, 136, 128, 131, 135, 133, 124, 117, 117, 125, 134, 140, 140, 136, 132, 128, 124, 120, 121, 128, 132, 126, 120, 121, 125, 127, 129, 135, 140, 132, 117, 113, 121, 124, 121, 125, 132, 136, 137, 134, 129, 123, 110, 111, 131, 146, 140, 124, 119, 121, 131, 141, 138, 146, 156, 157, 161, 164, 158, 149, 149, 150, 140, 133, 121, 105, 97, 91, 101, 135, 157, 147, 135, 134, 129, 127, 126, 121, 120, 124, 128, 124, 121, 115, 121, 156, 165, 150, 141, 130, 132, 132, 126, 113, 99, 108, 116, 131, 143, 130, 124, 110, 99, 120, 141, 146, 133, 113, 100, 106, 130, 144, 151, 145, 125, 124, 132, 133, 149, 180, 179, 162, 158, 132, 109, 103, 85, 93, 120, 129, 127, 137, 146, 129, 145, 161, 135, 139, 130, 104, 124, 139, 120, 96, 107, 128, 139, 163, 150, 135, 148, 124, 111, 139, 138, 103, 87, 100, 105, 103, 99, 93, 112, 136, 136, 133, 141, 138, 129, 141, 140, 123, 109, 107, 120, 120, 130, 141, 128, 140, 139, 126, 142, 143, 128, 121, 146, 169, 160, 186, 194, 172, 169, 119, 78, 102, 124, 125, 122, 129, 117, 109, 127, 110, 117, 152, 127, 102, 118, 119, 98, 94, 91, 77, 86, 100, 125, 162, 170, 143, 127, 142, 129, 121, 154, 144, 112, 96, 105, 123, 96, 105, 131, 124, 109, 70, 87, 132, 121, 110, 119, 150, 135, 102, 147, 159, 136, 137, 129, 142, 148, 122, 104, 128, 159, 138, 137, 158, 154, 178, 209, 176, 115, 92, 78, 92, 147, 154, 152, 167, 151, 139, 161, 227, 255, 232, 181, 81, 60, 85, 55, 51, 73, 144, 225, 240, 240, 221, 230, 241, 204, 187, 137, 97, 145, 210, 240, 171, 72, 34, 27, 29, 18, 17, 33, 34, 37, 55, 78, 84, 79, 59, 36, 45, 56, 65, 51, 28, 52, 69, 68, 33, 14, 93, 165, 233, 255, 252, 253, 251, 218, 155, 73, 57, 73, 164, 255, 255, 255, 181, 40, 29, 98, 181, 241, 250, 174, 57, 44, 87, 146, 236, 255, 232, 243, 225, 168, 176, 195, 140, 115, 134, 151, 185, 218, 206, 123, 52, 7, 19, 132, 146, 80, 83, 82, 66, 47, 74, 116, 78, 63, 45, 38, 95, 111, 144, 171, 137, 109, 118, 210, 255, 255, 255, 255, 255, 255, 255, 149, 42, 61, 139, 216, 231, 121, 14, 1, 37, 125, 249, 223, 53, 0, 21, 62, 166, 183, 96, 37, 91, 183, 222, 228, 104, 12, 107, 149, 158, 170, 127, 124, 166, 213, 165, 80, 64, 37, 101, 200, 159, 83, 34, 25, 52, 98, 139, 104, 69, 72, 73, 107, 170, 186, 146, 136, 144, 167, 243, 255, 197, 188, 255, 255, 243, 224, 113, 24, 152, 255, 255, 205, 52, 6, 141, 255, 255, 139, 50, 0, 148, 255, 120, 0, 48, 182, 255, 221, 99, 28, 155, 255, 255, 212, 100, 39, 176, 255, 192, 115, 79, 18, 21, 69, 81, 127, 143, 66, 1, 29, 92, 116, 134, 96, 67, 105, 50, 46, 137, 140, 118, 95, 109, 146, 151, 185, 209, 248, 255, 241, 255, 243, 48, 38, 159, 255, 255, 104, 0, 56, 214, 237, 161, 85, 46, 151, 232, 124, 21, 73, 176, 235, 200, 55, 35, 189, 249, 182, 100, 83, 129, 181, 195, 145, 171, 192, 99, 83, 64, 48, 143, 179, 111, 18, 36, 125, 128, 125, 98, 114, 176, 97, 51, 114, 144, 152, 147, 126, 78, 89, 183, 228, 230, 207, 200, 255, 255, 162, 34, 90, 217, 255, 170, 20, 56, 200, 203, 74, 23, 124, 183, 174, 111, 8, 72, 191, 242, 229, 93, 54, 174, 255, 190, 54, 99, 147, 108, 132, 137, 174, 197, 121, 94, 102, 103, 114, 140, 124, 45, 72, 126, 76, 64, 94, 99, 99, 81, 48, 84, 148, 125, 125, 150, 121, 144, 206, 211, 164, 183, 241, 242, 236, 96, 0, 116, 255, 224, 114, 42, 131, 240, 194, 57, 95, 248, 173, 65, 56, 23, 111, 219, 174, 105, 92, 131, 208, 241, 143, 71, 166, 202, 93, 62, 143, 180, 183, 126, 12, 57, 143, 107, 80, 84, 110, 110, 96, 118, 100, 137, 149, 74, 84, 99, 107, 125, 118, 127, 120, 190, 221, 143, 173, 212, 224, 248, 232, 199, 47, 0, 193, 255, 208, 40, 0, 140, 249, 126, 55, 192, 224, 75, 19, 63, 105, 141, 148, 123, 127, 165, 160, 161, 151, 105, 164, 205, 106, 34, 101, 202, 163, 85, 67, 63, 109, 110, 52, 64, 101, 107, 83, 84, 100, 96, 121, 120, 89, 86, 83, 94, 107, 121, 136, 140, 169, 176, 154, 195, 228, 173, 201, 255, 111, 23, 162, 246, 195, 64, 39, 185, 221, 82, 35, 213, 255, 63, 51, 131, 109, 120, 135, 153, 173, 184, 170, 144, 181, 158, 144, 184, 104, 78, 146, 158, 129, 98, 112, 70, 31, 99, 98, 73, 86, 89, 94, 67, 78, 113, 108, 107, 73, 55, 103, 125, 99, 100, 131, 146, 170, 159, 130, 190, 235, 224, 238, 201, 80, 54, 202, 255, 106, 10, 106, 228, 177, 46, 60, 196, 213, 42, 10, 161, 174, 112, 125, 140, 144, 150, 146, 151, 173, 161, 134, 133, 120, 109, 113, 136, 151, 132, 117, 66, 50, 100, 79, 68, 102, 115, 98, 80, 112, 84, 66, 109, 79, 97, 111, 92, 148, 133, 125, 154, 158, 183, 122, 139, 254, 255, 253, 142, 20, 112, 226, 188, 51, 41, 182, 222, 129, 29, 114, 249, 127, 11, 94, 151, 138, 118, 122, 146, 158, 151, 124, 138, 177, 160, 156, 161, 105, 108, 165, 147, 117, 111, 106, 111, 92, 73, 74, 79, 94, 91, 105, 134, 107, 74, 77, 93, 108, 97, 97, 133, 144, 138, 142, 117, 128, 166, 172, 208, 207, 211, 244, 96, 19, 193, 241, 104, 28, 109, 203, 168, 79, 73, 200, 195, 29, 57, 150, 139, 100, 86, 157, 147, 113, 152, 122, 166, 192, 104, 123, 139, 107, 121, 139, 134, 96, 108, 104, 58, 113, 118, 63, 98, 104, 84, 111, 109, 87, 98, 116, 120, 115, 115, 126, 122, 133, 180, 152, 105, 147, 178, 196, 240, 242, 200, 72, 25, 229, 255, 63, 40, 137, 172, 172, 63, 60, 248, 206, 0, 60, 195, 110, 76, 134, 140, 148, 116, 88, 147, 204, 174, 92, 110, 141, 100, 134, 126, 95, 150, 111, 64, 92, 111, 133, 90, 62, 111, 107, 85, 83, 101, 124, 99, 87, 127, 151, 120, 122, 160, 136, 124, 129, 140, 204, 184, 181, 255, 136, 2, 139, 242, 146, 80, 105, 131, 167, 115, 41, 173, 230, 78, 50, 124, 127, 91, 93, 147, 164, 137, 106, 109, 172, 179, 137, 131, 122, 106, 82, 108, 161, 133, 94, 87, 103, 123, 89, 102, 129, 99, 100, 72, 71, 135, 115, 96, 97, 83, 130, 138, 122, 137, 120, 129, 145, 146, 174, 162, 181, 255, 197, 0, 61, 248, 167, 67, 97, 128, 199, 129, 0, 154, 255, 93, 22, 144, 151, 75, 86, 133, 148, 124, 111, 151, 161, 142, 122, 121, 170, 124, 60, 125, 134, 104, 121, 103, 115, 133, 101, 100, 123, 116, 90, 90, 96, 97, 118, 103, 98, 122, 100, 106, 132, 131, 139, 122, 119, 121, 145, 208, 181, 216, 255, 58, 35, 214, 156, 93, 129, 93, 148, 171, 39, 97, 249, 134, 29, 122, 134, 73, 84, 123, 155, 127, 82, 121, 182, 163, 110, 129, 154, 107, 93, 119, 125, 136, 113, 71, 108, 152, 104, 91, 144, 117, 87, 109, 90, 96, 123, 106, 100, 110, 120, 110, 100, 125, 131, 124, 130, 127, 129, 145, 177, 199, 238, 239, 72, 36, 210, 183, 93, 120, 110, 160, 150, 38, 139, 238, 106, 55, 114, 103, 87, 95, 104, 140, 131, 98, 136, 150, 120, 141, 145, 112, 108, 109, 107, 127, 138, 102, 82, 117, 117, 101, 120, 116, 98, 106, 104, 104, 111, 97, 100, 123, 114, 102, 113, 119, 114, 112, 125, 123, 110, 145, 160, 157, 178, 164, 210, 215, 58, 89, 228, 146, 101, 145, 121, 145, 143, 96, 151, 182, 104, 70, 107, 119, 106, 104, 108, 130, 138, 117, 122, 139, 133, 116, 113, 135, 126, 93, 115, 144, 121, 91, 95, 115, 123, 114, 90, 92, 127, 113, 90, 118, 107, 92, 131, 117, 85, 118, 128, 115, 120, 110, 110, 123, 131, 142, 143, 145, 150, 158, 172, 149, 137, 157, 139, 137, 158, 136, 125, 136, 141, 144, 130, 129, 132, 114, 115, 122, 123, 128, 121, 119, 131, 134, 125, 116, 131, 139, 110, 112, 146, 134, 105, 122, 134, 112, 108, 108, 102, 126, 118, 87, 116, 129, 96, 100, 124, 129, 107, 89, 117, 133, 114, 117, 129, 126, 113, 111, 124, 125, 133, 135, 115, 135, 156, 145, 156, 149, 128, 148, 147, 129, 140, 141, 130, 130, 133, 137, 140, 133, 131, 138, 132, 130, 138, 122, 125, 141, 124, 133, 141, 108, 128, 152, 120, 127, 143, 123, 132, 132, 104, 107, 127, 127, 115, 110, 114, 110, 117, 130, 115, 108, 114, 113, 120, 120, 119, 133, 133, 118, 110, 109, 113, 121, 121, 106, 113, 131, 128, 136, 146, 134, 129, 132, 136, 135, 137, 139, 117, 118, 143, 139, 142, 142, 129, 137, 134, 133, 141, 134, 142, 142, 123, 134, 138, 127, 132, 131, 136, 149, 134, 127, 139, 130, 123, 129, 121, 124, 129, 113, 113, 131, 128, 117, 123, 120, 111, 127, 128, 111, 129, 135, 116, 120, 118, 110, 116, 109, 108, 123, 118, 106, 120, 130, 117, 118, 127, 128, 126, 125, 134, 125, 109, 128, 135, 130, 138, 124, 124, 130, 119, 139, 152, 138, 131, 127, 141, 141, 117, 128, 139, 134, 142, 138, 131, 139, 140, 132, 130, 129, 129, 131, 123, 121, 136, 132, 118, 128, 132, 123, 125, 126, 117, 127, 137, 116, 120, 137, 122, 121, 119, 108, 131, 135, 112, 113, 115, 118, 128, 118, 114, 129, 126, 121, 124, 111, 124, 143, 119, 109, 124, 126, 126, 120, 123, 137, 132, 129, 130, 127, 136, 131, 122, 130, 132, 132, 139, 136, 126, 131, 138, 126, 124, 138, 130, 122, 131, 131, 129, 131, 127, 128, 133, 129, 123, 123, 126, 134, 132, 120, 128, 139, 130, 124, 123, 131, 140, 128, 121, 128, 130, 130, 127, 129, 130, 120, 126, 135, 119, 122, 139, 128, 120, 123, 124, 135, 134, 120, 124, 128, 125, 128, 124, 129, 135, 124, 125, 134, 132, 134, 131, 127, 132, 127, 124, 133, 131, 129, 128, 124, 134, 133, 123, 133, 132, 118, 129,
};

byte bOLDTCCR0A;
byte bOLDTCCR0B;

volatile boolean counterReady;

void setup() {
}

void loop()
{
bOLDTCCR0A = TCCR0A;
bOLDTCCR0B = TCCR0B;
counterReady = false;
startPlayback(samples, sizeof(samples));
while (!counterReady) {}
TCCR0A = bOLDTCCR0A;
TCCR0B = bOLDTCCR0B;
delay(5000);
}

Ce contenu a été publié dans Arduino, Electronique, Non classé, avec comme mot(s)-clé(s) , , , , , . Vous pouvez le mettre en favoris avec ce permalien.

2 réponses à Arduino / PCM Audio : Modification de la broche utilisée par le haut parleur

  1. Olaf dit :

    Hi,
    Great to see, that you have changed the library to be able using pin6 instead of pin11. Unfortunately the download link is broken. Would be great to get your advice where to find. Many thanks for your support!

  2. Mostafa Net dit :

    Hello

    The download link has been corrupted

    Please fix the link

    Thanks

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *