Download
sound synthesizer n.
Skip this Video
Loading SlideShow in 5 Seconds..
Sound Synthesizer PowerPoint Presentation
Download Presentation
Sound Synthesizer

Sound Synthesizer

86 Vues Download Presentation
Télécharger la présentation

Sound Synthesizer

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Sound Synthesizer

  2. Abstract This project consists on a sound synthesizer that plays four different notes using the four push buttons of the board. This buttons were set to play each note of the score of “Mary had a little lamb”. The LEDs of the board were configured to turn on when the push buttons are pressed.

  3. Board Interface In order to make this project work, the push buttons of the boards were enabled as input, and the interrupt was registered in the interrupt vector table. This process takes place in InitializeMary.c file. This project uses LEDs 4-7, when the push buttons are pressed specific LEDs will light, and a specific sound will be produced. In order to produce the specific sounds the cMath library was used with an algorithm that will be explained in the next slide. Four output channels were used to output the four sounds created.

  4. Interrupt Service Routine • EX_INTERRUPT_HANDLER(Sport0_RX_ISR) • { • // confirm interrupt handling • *pDMA1_IRQ_STATUS = 0x0001; • // call function that contains user code • if(counter == 1||counter == 2||counter == 3||counter == 4) • { • Sound_Generation(); • } • // copy processed data from variables into dma output buffer • iTxBuffer1[INTERNAL_DAC_L0] = iChannel0LeftOut; • iTxBuffer1[INTERNAL_DAC_R0] = iChannel0RightOut; • iTxBuffer1[INTERNAL_DAC_L1] = iChannel1LeftOut; • iTxBuffer1[INTERNAL_DAC_R1] = iChannel1RightOut; • }

  5. EX_INTERRUPT_HANDLER(Timer0_ISR) • { • *pTIMER_STATUS = 0x0001; • counter = 8; • } • EX_INTERRUPT_HANDLER(FlagA_ISR) • { • if(*pFIO_FLAG_C == 0x0100) • { • counter = 1; • FIO_ANOM_0311_FLAG_W(0x0100,pFIO_FLAG_C); • } • if(*pFIO_FLAG_C == 0x0200) • { • counter = 2; • FIO_ANOM_0311_FLAG_W(0x0200,pFIO_FLAG_C); • }

  6. if(*pFIO_FLAG_C == 0x0400) • { • counter = 3; • FIO_ANOM_0311_FLAG_W(0x0400,pFIO_FLAG_C); • } • if(*pFIO_FLAG_C == 0x0800) • { • counter = 4; • FIO_ANOM_0311_FLAG_W(0x0800,pFIO_FLAG_C); • }

  7. Sound Generation A4 = 440Hz(Central Frequency)

  8. Sound Generation File • int n=0; • const float x = (1<<20); • float y; //initialize output • void Sound_Generation() • { • ///////E_NOTE///////////// • if(counter == 3) • { • *pFlashA_PortB_Data = 0x04; • n %= 146; • y=7*x*sinf(0.0215 * n); • iChannel0LeftOut = (int)y; • //counter = 0; • }