Paso 3: código
Copia el siguiente código y pegar el siguiente código en el IDE de Arduino y luego seleccione un puerto COM adecuado y subir el código al Linkit.
? * / 0 X 13, 0X43, 0X5B, 0 X 0 0 X 0 0 X 0, 0 X 0, / * 03, * / 0 X 13, 0X43, 0X5B, 0 X 0 0 X 0 0 X 0, 0 X 0, / * 04-* / 0XA, 0X54, 0X6E, 0XD, 0XA, 0X8, 0 X 0, / * IY * 05 / 0XE, 0X49, 0X5D, 0XD, 0X8, 0X7, 0 X 0, / * 06 IH * / 0 X 13, 0X43, 0X5B, 0XE, 0XD, 0X8, 0 X 0, / * 07 EH * / 0X18, 0X3F, 0X58, 0XF, 0XE, 0X8, 0 X 0, / * AE * 08 / 0X1B, 0X28, 0X59, 0XF, 0XD, 0 X 1, 0 X 0, / * 09 AA * / 0X17 , 0X2C, 0X57, 0XF, 0XC, 0 X 1, 0 X 0, / * 10 AH * / 0X15, 0X1F, 0X58, 0XF, 0XC, 0 X 0 0 X 0, / * 11 AO * / 0 X 10, 0X25, 0X52, 0XF, 0XB, 0 X 1, 0 X 0, / * 12 UH * / 0X14, 0X2C, 0X57, 0XE 0XB 0 X 0, 0 X 0, / * AX * 13 / 0XE, 0X49, 0X5D, 0XD, 0XB, 0X7, 0 X 0, / * 14 IX * / 0X12, 0X31, 0X3E, 0XC, 0XB, 0X5, 0 X 0, / * 15 ER * / 0XE, 0X24, 0X52, 0XF, 0XC, 0 X 1, 0 X 0, / * 16 UX * / 0X12 , 0X1E, 0X58, 0XF, 0XC, 0 X 0, 0, X 0 / * 17 OH * / 0X12, 0X33, 0X3E, 0XD, 0XC, 0X6, 0 X 0, / * 18 RX * / 0 X 10, 0X25, 0X6E, 0XD, 0X8, 0 X 1, 0 X 0, / * 19 LX * / 0XD, 0X1D, 0 X 50, 0XD, 0X8, 0 X 0, 0, X 0 / * 20 WX * / 0XF, 0X45, 0X5D, 0XE, 0XC, 0X7, 0 X 0, / * 21 YX * / 0XB, 0X18, 0X5A, 0XD, 0X8, 0 X 0 0 X 0, / * 22 WH * / 0X12, 0X32, 0X3C, 0XC, 0XA, 0X5, 0 X 0, / * 23 R * / 0XE , 0X1E, 0X6E, 0XD, 0X8, 0 X 1, 0 X 0, / * 24 L * / 0XB, 0X18, 0X5A, 0XD, 0X8, 0 X 0 0 X 0, / * 25 W * / 0X9, 0X53, 0X6E, 0XD, 0XA, 0X8, 0 X 0, / * 26 Y * / 0X6, 0X2E, 0X51, 0XC, 0X3, 0 X 0 0 X 0, / * M * 27 / 0X6, 0X36, 0X79, 0X9, 0X9, 0 X 0 0 X 0, / * 28 N * / 0X6, 0X56, 0X65, 0X9, 0X6, 0X3, 0 X 0, / * NX 29 * / 0X6, 0X36, 0X79, 0 X 0 0 X 0 0 X 0, 0 X 0, / * 30 DX * / 0X11 , 0X43, 0X5B, 0 X 0 0 X 0 0 X 0, 0 X 0, / * 31 Q * / 0X6, 0X49, 0X63, 0X7, 0XA, 0XD, 0XF, / * 32 S * / 0X6, 0X4F, 0X6A, 0 X 0 0 X 0 0 X 0, 0 X 0, / * 33 SH * / 0X6, 0X1A, 0X51, 0X3, 0X3, 0X3, 0XF, / * 34 F * / 0X6, 0X42, 0X79, 0 X 0 0 X 0 0 X 0, 0 X 0, / * 35 TH * / 0XE, 0X49, 0X5D, 0 X 0 0 X 0 0 X 0, 0 X 0, / * 36 /H* / 0 X 10, 0X25, 0X52, 0 X 0 0 X 0 0 X 0, 0 X 0, / * 37 /X* / 0X9 , 0x33, 0x5d, 0xf, 0x3, 0x3, 0 x 0 / * 38 Z * / 0xa, 0x42, 0x67, 0xb, 0x5, 0 x 1, 0 x 0, / * ZH * 39 / 0x8, 0x28, 0x4c, 0xb, 0x3, 0 x 0 0 x 0, / * 40 V * / 0xa, 0x2f, 0x5d, 0xb, 0x4, 0 x 0 0 x 0, / * 41 DH * / 0x6, 0x4f, 0x65, 0 x 0 0 x 0 0 x 0, 0 x 0, / * CHa * 42 / 0x6, 0x4f, 0x65, 0 x 0 0 x 0 0 x 0, 0 x 0, / * 43 CHb * / 0x6, 0x42, 0x79, 0 x 1 0 x 0 0 x 0, 0 x 0, / * 44 Ja * / 0x5 , 0x42, 0x79, 0 x 1 0 x 0 0 x 0, 0 x 0, / * Jb * 45 / 0x6, 0x6e, 0x79, 0xa, 0xe, 0 x 0, 0 x 0, / * 46 Jc * / 0 x 0 0 x 0 0 x 0, 0 x 2, 0 x 2, 0 x 1, 0 x 0, / * 47 Jd * / 0 x 13, 0x48, 0x5a, 0xe, 0xe, 0x9, 0 x 0, / * EY 48 * / 0x1b, 0x27, 0x58, 0xf, 0xd, 0 x 1, 0 x 0, / * 49 AY * / 0x15, 0x1f, 0x58, 0xf, 0xc, 0 x 0 0 x 0, / * 50 OY * / 0x1b, 0x2b, 0x58, 0xf, 0xd, 0 x 1, 0 x 0, / * 51 AW * / 0x12 , 0x1e, 0x58, 0xf, 0xc, 0 x 0 0 x 0, / * 52 OW * / 0xd, 0x22, 0x52, 0xd, 0x8, 0 x 0 0 x 0, / * 53 UW * / 0x6, 0x1a, 0x51, 0 x 2 0 x 0 0 x 0, 0 x 0, / * 54 Ba * / 0x6, 0x1a, 0x51, 0x4, 0 x 1, 0 x 0, 0xf, / * 55 Bb * / 0x6, 0x1a, 0x51, 0 x 0 0 x 0 0 x 0, 0 x 0, / * 56 A.c. * / 0x6, 0x42, 0x79, 0 x 2 0 x 0 0 x 0, 0 x 0, / * Da * 57 / 0x6, 0x42, 0x79, 0x4, 0 x 1, 0 x 0, 0xf, / * 58 Db * / 0x6 , 0x42, 0x79, 0 x 0 0 x 0 0 x 0, 0 x 0, / * 59 dc * / 0x6, 0x6e, 0x70, 0 x 1 0 x 0 0 x 0, 0 x 0, / * 60 Ga * / 0x6, 0x6e, 0x6e, 0x4, 0 x 1, 0 x 0, 0xf, / * 61 Gb * / 0x6, 0x6e, 0x6e, 0 x 0 0 x 0 0 x 0, 0 x 0, / * 62 Gc * / 0x6, 0x54, 0x5e, 0 x 1 0 x 0 0 x 0, 0 x 0, / * 63 GXa * / 0x6, 0x54, 0x5e, 0x4, 0 x 1, 0 x 0, 0xf, / * 64 GXb * / 0x6, 0x54, 0x5e, 0 x 0 0 x 0 0 x 0, 0 x 0, / * 65 GXc * / 0x6 , 0x1a, 0x51, 0 x 0 0 x 0 0 x 0, 0 x 0, / * 66 Pa * / 0x6, 0x1a, 0x51, 0 x 0 0 x 0 0 x 0, 0 x 0, / * 67 Pb * / 0x6, 0x1a, 0x51, 0 x 0 0 x 0 0 x 0, 0 x 0, / * 68 Pc * / 0x6, 0x42, 0x79, 0 x 0 0 x 0 0 x 0, 0 x 0, / * 69 Ta * / 0x6, 0x42, 0x79, 0 x 0 0 x 0 0 x 0, 0 x 0, / * 70 Tb * / 0x6, 0x42, 0x79, 0 x 0 0 x 0 0 x 0, 0 x 0, / * 71 Tc * / 0x6, 0x6d, 0x65, 0 x 0 0 x 0 0 x 0, 0 x 0, / * 72 Ka * / 0xa 0x56, 0x65, 0xc, 0xa, 0x7, 0 x 0, / * 73 kb * / 0xa, 0x6d, 0x70, 0 x 0 0 x 0 0 x 0, 0 x 0, / * 74 Kc * / 0x6, 0x54, 0x5e, 0 x 0 0 x 0 0 x 0, 0 x 0, / * 75 KXa * / 0x6, 0x54, 0x5e, 0xa, 0x5, 0 x 0, 0 x 0, / * 76 KXb * / 0x6, 0x54, 0x5e, 0 x 0 0 x 0 0 x 0, 0 x 0 / * 77 KXc * /}; uint16_t pitchTable [64] = {/ / cubiertas de A1 a C7 58,61,65,69,73,77,82,86,92,97, 103,109,115,122,129,137,145,154,163,173, 183,194,206,218,231,244,259,274,291,308, 326,346,366,388,411,435,461,489,518,549, 581,616,652,691,732,776,822,871,923,978, 1036,1097,1163,1232,1305,1383,1465,1552,1644,1742, 1845,1955,2071,2195}; uint8_t frameList [] PROGMEM = {_Da #if 1 , 3,0,39, _Db, 1, 0, 39, _Dc, 1, 3, 39, _EY, 8, 6, 39, _YX, 20, 3, 39, / / Dai... _Z, 10, 0, 36, _IY, 35, 3, 36, / /... SY _Da, 3, 0, 32, _Db, 1, 0, 32, _Dc, 1, 3, 32, _EY, 8, 6, 32, _YX, 20, 3, 32, / / Dai... _Z, 10, 0, 27, _IY, 35, 3, 27, / /... SY _Ga, 2, 0, 29, _Gb, 2, 0, 29, _Gc, 2, 0, 29, _IH, 10, 3, 29, _V, 5, 0, 29, / / dar _M, 2, 0, 31, _IY, 10, 3, 31, / / me _YX, 5, 0, 32, _AO, 10, 0, 32, _RX, 5, 0, 32, / / su _AH, 25, 0, 29, _NX, 5, 0, 29, / / un... _S, 2, 0, 32, _ER, 10, 0, 32, _RX, 3, 0, 32, / /... _Da tabicicletas, 3, 0, 27, _Db, 1, 0, 27, _Dc, 1, 3, 27, _UX, 80, 3, 27, _WX, 5, 0, 27, / do _AY, 5, 20, 34, _YX, 10, 0, 34, _M, 8, 0, 34, / / soy __H, 5, 0, 39, _AX, 0, 30, 39, _F, 10, 0, 39, / / media _Ka, 3, 0, 36, _Kb, 3, 0, 36, _Kc, 4, 0, 36, _R, 5, 0, 36, _EY, 30, 0, 36, / / cra... _Z, 5, 0, 32, _IY, 40, 0, 32, / /... zy _AO,10,0,29,_LX,5,0,29, // all _F,5,0,31,_AO,10,0,31, // for _DH,5,0,32,_AH,10,0,32, // the _L,5,0,34,_AH,20,0,34,_V,5,0,34,// love _AA,10,0,36,_V,5,0,36,// of _Y,10,0,34,_UX,80,0,34, // you _IH,10,0,36,_Ta,2,0,36,_Tb,1,0,36,_Tc,2,0,36,// It _W,2,0,37,_OH,10,0,37,_N,1,0,37,_Ta,1,0,37,_Tb,1,0,37,_Tc,1,0,37,// won't _Ba,2,0,36,_Bb,1,0,36,_Bc,2,0,36 , _IY, 10, 0, 36, / / _AH, 15, 0, 34, / / _S, 2, 0, 39, _Ta, 2, 0, 39, _Tb, 2, 0, 39, _Tc, 2, 0, 39, _AY, 1, 10, 39, _YX, 10, 0, 39, / / sty... _L, 3, 0, 36, _IH, 10, 0, 36, _SH, 2, 0, 36, / /... Lish _M, 5, 0, 34, _AE, 10, 0, 34, / / ma... _R, 5, 0, 32, _IH, 60, 0, 32, _Ja, 2, 0, 32, _Jb, 2, 0, 32, _Jc, 2, 0, 32, / /... _AY rriage, 5, 10, 34, _YX, 5, 0, 34, / / me _Ka, 2, 0, 36, _Kb, 2, 0, 36, _Kc, 2, 0, 36, _AH, 20, 0, 36, _N, 2, 0, 36, _Ta, 2, 0, 36, _Tb, 2, 0, 26, _Tc, 2, 0, 36, / / no _AX, 15, 0, 32, / / a... _F, 5, 0, 29, _AO, 20, 0, 29, _R, 2, 0, 29, _Da, 1, 0, 29, _Db, 1, 0, 29, _Dc, 1, 0, 29, / /... fford _AX, 15, 0, 32, / / a _Ka, 1, 0, 29, _Kb, 1, 0, 29, _Kc, 1, 0, 29, _AE, 12, 0, 29, / / ca.. _R, 5, 0, 27, _IH, 45, 0, 27, _Ja, 2, 0, 27, _Jb, 2, 0, 27, _Jc, 2, 0, 27, / /... rriage _Ba, 1, 0, 27, _hb, 1, 0, 27, _Bc, 1, 0, 27, _AH, 10, 0, 27, _Ta, 1, 0, 27, _Tb, 1, 0, 27, _Tc, 1, 0, 27, / / pero _Y, 5, 0, 32, _UH, 10, 10, 32, _L, 5, 0, 32, / / usted _L, 3, 0, 36, _UH, 10, 0, 36, _Ka, 1, 0, 36, _Kb, 1, 0, 36, _Kc, 1, 0, 36, / / mira _S, 2, 0, 34, di_metro, 2, 0, 34, _IY, 0, 20, 34, _Ta, 2, 0, 34, _Tb, 2, 0, 34, _Tc, 2, 0, 34, / / dulce _AX, 15, 0, 27, / / a... _Ka, 2, 0, 32, _Kb, 2, 0, 32, _Kc, 2, 0, 32, _R, 2, 0, 32, _AA, 20, 0, 32, _S, 5, 0, 32, / /... Cruz _DH, 5, 0, 36, _AH, 10, 0, 36, / / _S, 2, 0, 34, _IY, 10, 0, 34, _Ta, 2, 0, 34, _Tb, 2, 0, 34, _Tc, 2, 0, 34, / / asiento _AA, 10, 0, 36, _V, 5, 0, 36, / / de _AE, 15, 0, 37, / / a _Ba, 2, 0, 39, _hb, 2, 0, 39, _Bc, 2, 0, 39, _AY, 5, 5, 39, _YX, 5, 0, 39, / / bi... _S, 5, 0, 36, _IH, 10, 0, 36, / /... CY... _Ka, 2, 0, 32, _Kb, 2, 0, 32, _Kc, 2, 0, 32, _L, 9, 0, 32, / /... CLE _M, 2, 0, 34, _EY, 5, 10, 34, _YX, 10, 0, 34, _Da, 2, 0, 34, _Db, 2, 0, 34, _Dc, 2, 0, 34, / / hecho _F, 5, 0, 27, _OY, 1, 5, 27, _RX, 5, 0, 27, / / para _Ta, 2, 0, 32, _Tb, 2, 0, 32, _Tc, 2, 0, 32, _UX, 50, 0, 32, / / dos #endif _Ta, 0, 0, 61}; int frameTime = 15; MS uint16_t basePitch; int formantScale; void loop() {formantScale = //random (20,80), 54; uint8_t; //54 * framePos = frameList; while(1) {int n; uint8_t startFormant, staticFrames, tweenFrames; uint16_t startPitch, nextPitch; uint8_t nextFormant; int16_t startForm1PhaseInc, startForm2PhaseInc, startForm3PhaseInc; uint8_t startForm1Amp, startForm2Amp, startForm3Amp; startMod de uint8_t; uint8_t * formantPos; / leer siguiente framelist artículo startFormant = pgm_read_byte(framePos++); staticFrames = pgm_read_byte(framePos++); if (! staticFrames) break; / / fin de la frase tweenFrames = pgm_read_byte(framePos++); startPitch = pitchTable[pgm_read_byte(framePos++)]; nextFormant = pgm_read_byte ( framePos); nextPitch = pitchTable[pgm_read_byte(framePos+3)]; pitchPhaseInc = startPitch; formantPos = formantTable + startFormant * FORMANT_SZ; form1PhaseInc = startForm1PhaseInc = pgm_read_byte(formantPos++) * formantScale; form2PhaseInc = startForm2PhaseInc = pgm_read_byte(formantPos++) * formantScale; form3PhaseInc = startForm3PhaseInc = pgm_read_byte(formantPos++) * formantScale; form1Amp = startForm1Amp = pgm_read_byte(formantPos++); form2Amp = startForm2Amp = pgm_read_byte(formantPos++); form3Amp = startForm3Amp = pgm_read_byte(formantPos++); noiseMod = startMod = pgm_read_byte(formantPos++); para (; staticFrames--;) delay(frameTime); si (tweenFrames) {uint8_t * formantPos, int16_t deltaForm1PhaseInc, deltaForm2PhaseInc, deltaForm3PhaseInc int8_t deltaForm1Amp, deltaForm2Amp, deltaForm3Amp; deltaMod int8_t; uint8_t nextMod; int16_t deltaPitch; tweenFrames-; formantPos = formantTable + nextFormant * FORMANT_SZ; deltaForm1PhaseInc = pgm_read_byte(formantPos++) * formantScale - startForm1PhaseInc; deltaForm2PhaseInc = pgm_read_byte(formantPos++) * formantScale - startForm2PhaseInc; deltaForm3PhaseInc = pgm_read_byte(formantPos++) * formantScale - startForm3PhaseInc; deltaForm1Amp = pgm_read_byte(formantPos++) - startForm1Amp; deltaForm2Amp = pgm_read_byte(formantPos++) - startForm2Amp; deltaForm3Amp = pgm_read_byte(formantPos++) - startForm3Amp; deltaMod = pgm_read_byte(formantPos++) - startMod; deltaPitch = nextPitch - startPitch; deltaMod = nextMod - startMod; para (int me = 1; me < = tweenFrames; i ++) {form1PhaseInc = startForm1PhaseInc + (me * deltaForm1PhaseInc) / tweenFrames; form2PhaseInc = startForm2PhaseInc + (me * deltaForm2PhaseInc) / tweenFrames; form3PhaseInc = startForm3PhaseInc + (me * deltaForm3PhaseInc) / tweenFrames; form1Amp = startForm1Amp + (me * deltaForm1Amp) / tweenFrames; form2Amp = startForm2Amp + (me * deltaForm2Amp) / tweenFrames; form3Amp = startForm3Amp + (me * deltaForm3Amp) / tweenFrames; pitchPhaseInc = startPitch + (me * deltaPitch) / tweenFrames; noiseMod = startMod + (me * deltaMod) / tweenFrames; delay(frameTime);}} } delay(300); } SIGNAL(PWM_INTERRUPT) {int8_t valor; ruido de estática int8_t; int16_t phaseNoise = ruido * noiseMod; ruido ruido += << 2; ruido ++; / / ruido ' = 5 * ruido + 1 form1Phase += form1PhaseInc; valor = pgm_read_byte (sinCalc + (((form1Phase >> 8) & 0xf0) | form1Amp)); form2Phase += form2PhaseInc; valor += pgm_read_byte (sinCalc + (((form2Phase >> 8) & 0xf0) | form2Amp)); form3Phase += form3PhaseInc; valor += pgm_read_byte (sqrCalc + (((form3Phase >> 8) & 0xf0) | form3Amp)); valor = (valor * (0xff ^ (pitchPhase >> 8))) >> 8; pitchPhase += pitchPhaseInc; si (() pitchPhase + phaseNoise) < pitchPhaseInc) {form1Phase = 0; form2Phase = 0; form3Phase = 0;} PWM_VALUE = valor + 0 x 80; }