久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 13226|回復(fù): 12
打印 上一主題 下一主題
收起左側(cè)

STM32單片機(jī)實(shí)現(xiàn)IIS音頻采集,串口助手接收

  [復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:493899 發(fā)表于 2019-3-19 13:57 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
上周搞了個(gè)IIS的麥克風(fēng),用32做個(gè)音頻采集,把數(shù)據(jù)發(fā)往電腦,處理后可保存為wav格式,具體處理方式可查看wav格式的頭文件。

單片機(jī)源程序如下:

  1. #include "stm32f10x.h"
  2. #include "stm32f10x_spi.h"
  3. #include "stm32f10x_rcc.h"
  4. #include "stm32f10x_dac.h"
  5. #include "stm32f10x_gpio.h"
  6. #include "stm32f10x_tim.h"
  7. #include "stm32f10x_crc.h"
  8. #include "stm32f10x_dma.h"
  9. #include "stm32f10x_usart.h"
  10. #include "misc.h"
  11. #include "pbdata.h"
  12. #include "pdm_filter.h"
  13. int Rx_buffer[64];
  14. int Tx_buffer[64];
  15. int DualSine12bit[64];
  16. PDMFilter_InitStruct pdmf;
  17. void I2S_DMA_Config(void)
  18. {        
  19.         DMA_InitTypeDef  DMA_InitStructure;
  20.   NVIC_InitTypeDef NVIC_InitStructure;
  21.   RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);  //??DMA2
  22.         DMA_DeInit(DMA1_Channel4);
  23.         
  24.   DMA_InitStructure.DMA_PeripheralBaseAddr =(uint32_t)&(SPI2->DR);     //               
  25.   DMA_InitStructure.DMA_MemoryBaseAddr =(uint32_t)Tx_buffer ;               //                        
  26.   DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;                         //                                       
  27.   DMA_InitStructure.DMA_BufferSize =64;                                           //                                
  28.   DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;     //        
  29.   DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;               //
  30.   DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;        //
  31.   DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word;                //               
  32.   DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;                                               
  33.   DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;                                                
  34.   DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;                                                
  35.   DMA_Init(DMA1_Channel4, &DMA_InitStructure);                  
  36.   /* Enable DMA1 channel1 IRQ Channel */
  37.         DMA_ITConfig(DMA1_Channel4, DMA_IT_TC, ENABLE);                        //開(kāi)啟 DMA傳輸完成中斷
  38.   /* Enable DMA1 channel1 */
  39.         SPI_I2S_DMACmd(SPI2, SPI_I2S_DMAReq_Tx, ENABLE);
  40.   DMA_Cmd(DMA1_Channel4, ENABLE);               
  41.   
  42.         NVIC_InitStructure.NVIC_IRQChannel                                                                                 = DMA1_Channel4_IRQn;
  43.         NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority         = 0;
  44.   NVIC_InitStructure.NVIC_IRQChannelSubPriority                                 = 0;
  45.         NVIC_InitStructure.NVIC_IRQChannelCmd                                                                 = ENABLE;
  46.         NVIC_Init(&NVIC_InitStructure);        
  47. }

  48. //I2S音頻總線配置
  49. void I2S_Configuration(void)
  50. {   
  51.         NVIC_InitTypeDef NVIC_InitStructure;
  52.               GPIO_InitTypeDef GPIO_InitStructure;
  53.          // Initialise and Configure the Mode for I2S
  54.         I2S_InitTypeDef I2S_InitStructure;
  55.               RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE );
  56.    // Enable I2S peripheral clocks
  57.         RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);
  58.         RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);  
  59.               SPI_I2S_DeInit(SPI2);
  60.               GPIO_InitStructure.GPIO_Pin=GPIO_Pin_12|GPIO_Pin_13;     //端口
  61.               GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
  62.               GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AF_PP;            //IO復(fù)用輸出
  63.               GPIO_Init(GPIOB,&GPIO_InitStructure);
  64.         GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;      
  65.         GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;        //IO口速度
  66.         GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;    //IO口懸空輸入
  67.         GPIO_Init(GPIOB, &GPIO_InitStructure);
  68.               GPIO_SetBits(GPIOB,GPIO_Pin_13|GPIO_Pin_12);
  69.               
  70.         I2S_InitStructure.I2S_Mode       =  I2S_Mode_MasterRx;                          
  71.                I2S_InitStructure.I2S_Standard   =  I2S_Standard_Phillips;           
  72.         I2S_InitStructure.I2S_DataFormat =  I2S_DataFormat_16b;
  73.         I2S_InitStructure.I2S_AudioFreq  =  I2S_AudioFreq_16k;           
  74.         I2S_InitStructure.I2S_CPOL = I2S_CPOL_Low;
  75.         I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Disable;                                
  76.         I2S_Init(SPI2, &I2S_InitStructure);
  77.         SPI_I2S_ITConfig(SPI2, SPI_I2S_IT_RXNE, DISABLE);
  78.               SPI_I2S_DMACmd(SPI2,SPI_I2S_DMAReq_Rx,ENABLE);            //SPI2
  79.         I2S_Cmd(SPI2, ENABLE);
  80.         SPI_I2S_ITConfig(SPI2, SPI_I2S_IT_RXNE, ENABLE);  
  81.               
  82.         NVIC_InitStructure.NVIC_IRQChannel = SPI2_IRQn;
  83.         NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =0;
  84.         NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  85.         NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  86.         NVIC_Init(&NVIC_InitStructure);
  87. }

  88. void PDMFilter_Configuration(void)
  89. {
  90.            RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE);
  91.            pdmf.Fs=8000;
  92.            pdmf.LP_HZ=10;
  93.            pdmf.HP_HZ=14000;
  94.            pdmf.In_MicChannels=1;
  95.            pdmf.Out_MicChannels=1;
  96.            PDM_Filter_Init(&pdmf);
  97. }

  98. //音頻數(shù)據(jù)低通濾波
  99. void T16T12(void)
  100. {            
  101.   int i;
  102.                  PDM_Filter_64_LSB((uint8_t*)Tx_buffer,(uint16_t*)Rx_buffer,(uint16_t) 50,(PDMFilter_InitStruct*)&pdmf);  
  103.         for(i=0;i<64;i++)
  104.         {
  105.                 Rx_buffer[i]=~Rx_buffer[i];
  106.         }
  107.                  
  108. }

  109. void DMA1_Channel4_IRQHandler(void)
  110. {

  111.     //DMA一次通道數(shù)據(jù)獲取搬運(yùn)完成
  112.     if (DMA_GetITStatus(DMA1_IT_TC4))
  113.     {  
  114.                           DMA_Cmd(DMA1_Channel4, DISABLE);
  115.                                 
  116.                                 T16T12();                                                                                                                           //24位轉(zhuǎn)12位函數(shù)
  117.         DMA_ClearITPendingBit(DMA1_IT_TC4);
  118.                 //          DMA1_Channel4->CNDTR = 64;
  119.                            DMA_Cmd(DMA1_Channel4, ENABLE);
  120.                         SPI_I2S_ITConfig( SPI2, SPI_I2S_IT_RXNE, ENABLE );//
  121.     }
  122. }

  123. void SPI2_IRQHandler(void)
  124. {
  125. if (SPI_I2S_GetITStatus(SPI2, SPI_I2S_IT_RXNE) == SET)
  126. {  
  127.   SPI_I2S_ClearITPendingBit( SPI2,SPI_I2S_IT_RXNE );
  128.   SPI_I2S_ITConfig( SPI2, SPI_I2S_IT_RXNE, DISABLE  );//

  129. }
  130. }
  131. void usart2_Configuration(void)
  132. {
  133.   GPIO_InitTypeDef GPIO_USART_TX_InitStructure;
  134.   GPIO_InitTypeDef GPIO_USART_RX_InitStructure;
  135.         NVIC_InitTypeDef NVIC_InitStructure;
  136.         DMA_InitTypeDef  DMA_InitStructure;         //定義DMA初始化結(jié)構(gòu)體DMA_InitStructure
  137.   USART_InitTypeDef USART_InitStructure;
  138.   RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
  139.         RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
  140.         RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
  141.         
  142.         // ??USART_TX
  143.         GPIO_USART_TX_InitStructure.GPIO_Pin =  GPIO_Pin_2;
  144.         GPIO_USART_TX_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
  145.         GPIO_USART_TX_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  146.         
  147.         GPIO_Init(GPIOA, &GPIO_USART_TX_InitStructure);
  148.         
  149.         // ??USART_RX
  150.         GPIO_USART_RX_InitStructure.GPIO_Pin =  GPIO_Pin_3;
  151.         GPIO_USART_RX_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
  152.   GPIO_USART_TX_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  153.         GPIO_Init(GPIOA, &GPIO_USART_RX_InitStructure);

  154.         USART_InitStructure.USART_BaudRate = 115200;
  155.         USART_InitStructure.USART_WordLength = USART_WordLength_8b;
  156.         USART_InitStructure.USART_StopBits = USART_StopBits_1;
  157.         USART_InitStructure.USART_Parity = USART_Parity_No;
  158.         USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
  159.         USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
  160.         
  161.         USART_Init(USART2, &USART_InitStructure);
  162.         USART_Cmd(USART2, ENABLE);
  163.         DMA_DeInit(DMA1_Channel7);         //重置DMA 2通道配置        
  164.         DMA_InitStructure.DMA_PeripheralBaseAddr =  (uint32_t)&USART2->DR;         //外設(shè)地址  
  165.         DMA_InitStructure.DMA_MemoryBaseAddr =(uint32_t)Rx_buffer;         //內(nèi)存地址  
  166.         DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;         
  167.         DMA_InitStructure.DMA_BufferSize =64;         //DMA緩存大小:BufferSize
  168.         DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;         //外設(shè)地址寄存器不遞增  
  169.         DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;                   //內(nèi)存地址寄存器遞增        
  170.         DMA_InitStructure.DMA_PeripheralDataSize =DMA_PeripheralDataSize_Word ;         //外設(shè)數(shù)據(jù)寬度
  171.         DMA_InitStructure.DMA_MemoryDataSize = DMA_PeripheralDataSize_Word ;         //內(nèi)存數(shù)據(jù)寬度
  172.         DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;         //工作在正常緩存模式
  173.         DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;         //設(shè)置DMA通道優(yōu)先級(jí)為高
  174.         DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;         //禁止DMA通道設(shè)置為內(nèi)存至內(nèi)存?zhèn)鬏?
  175.         DMA_Init(DMA1_Channel7, &DMA_InitStructure);         //初始化
  176.         DMA_ITConfig(DMA1_Channel7, DMA_IT_TC, ENABLE);//傳輸完成中斷        
  177.         DMA_ITConfig(DMA1_Channel7, DMA_IT_TE, ENABLE);//傳輸錯(cuò)誤中斷
  178.         USART_DMACmd(USART2, USART_DMAReq_Rx, ENABLE);
  179.         USART_DMACmd(USART2, USART_DMAReq_Tx, ENABLE);
  180.         DMA_Cmd(DMA1_Channel7, ENABLE);
  181.         NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel7_IRQn;
  182.         NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
  183.         NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  184.         NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  185.         NVIC_Init(&NVIC_InitStructure);
  186. }
  187. void DMA1_Channel7_IRQHandler(void)
  188. {
  189.     //DMA一次通道數(shù)據(jù)獲取搬運(yùn)完成
  190.     if (DMA_GetITStatus(DMA1_IT_TC7))
  191.     {   
  192.                           DMA_Cmd(DMA1_Channel7, DISABLE);   
  193.          
  194.         DMA_ClearITPendingBit(DMA1_IT_TC7);  
  195.         DMA_ClearITPendingBit(DMA1_IT_TE7);
  196. //                          DMA1_Channel7->CNDTR = 128;
  197.                            DMA_Cmd(DMA1_Channel7, ENABLE);
  198.     }
  199. }

  200. int main(void)
  201. {
  202.         NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);        
  203.         PDMFilter_Configuration();
  204.         I2S_Configuration();        
  205.   I2S_DMA_Config();
  206.   usart2_Configuration();
  207. // USART_SendData(USART2, 'A');
  208.         while (1)
  209.         {                    
  210.         }
  211. }

復(fù)制代碼

  1. /* Includes ------------------------------------------------------------------*/
  2. #include "main.h"
  3. #include "pdm_filter.h"
  4. #include "waverecorder.h"
  5. #include "ff.h"
  6. /** @addtogroup STM32F4-Discovery_Audio_Player_Recorder
  7. * @{
  8. */

  9. /* Private typedef -----------------------------------------------------------*/
  10. /* Private define ------------------------------------------------------------*/
  11. /* SPI Configuration defines */

  12. #if 1
  13. #define SPI_SCK_PIN                       GPIO_Pin_13
  14. #define SPI_SCK_GPIO_PORT                 GPIOB
  15. #define SPI_SCK_GPIO_CLK                  RCC_APB2Periph_GPIOB
  16. #define SPI_SCK_SOURCE                    GPIO_PinSource13


  17. #define SPI_WS_PIN                       GPIO_Pin_12
  18. #define SPI_WS_GPIO_PORT                 GPIOB
  19. #define SPI_WS_GPIO_CLK                  RCC_APB2Periph_GPIOB
  20. #define SPI_WS_SOURCE                    GPIO_PinSource12


  21. #define SPI_MOSI_PIN                      GPIO_Pin_15
  22. #define SPI_MOSI_GPIO_PORT                GPIOB
  23. #define SPI_MOSI_GPIO_CLK                 RCC_APB2Periph_GPIOB
  24. #define SPI_MOSI_SOURCE                   GPIO_PinSource15

  25. #endif
  26.         

  27. /* Audio recording frequency in Hz */
  28. #define REC_FREQ                          8000  

  29. /* PDM buffer input size */
  30. #define INTERNAL_BUFF_SIZE      64

  31. /* PCM buffer output size */
  32. #define PCM_OUT_SIZE            16

  33. /* Private macro -------------------------------------------------------------*/
  34. /* Private variables ---------------------------------------------------------*/
  35. extern __IO uint16_t Time_Rec_Base;
  36. __IO uint8_t Command_index=1;
  37. extern __IO uint32_t WaveCounter;
  38. extern FIL fil;
  39. extern __IO uint8_t LED_Toggle;
  40. uint16_t RAM_Buf[RAM_BUFFER_SIZE];
  41. uint16_t RAM_Buf1 [RAM_BUFFER_SIZE];
  42. uint16_t buf_idx = 0, buf_idx1 =0;
  43. uint16_t *writebuffer;
  44. uint16_t counter = 0;
  45. uint8_t WaveRecStatus = 0;
  46. /* Current state of the audio recorder interface intialization */
  47. static uint32_t AudioRecInited = 0;
  48. PDMFilter_InitStruct Filter;
  49. /* Audio recording Samples format (from 8 to 16 bits) */
  50. uint32_t AudioRecBitRes = 16;
  51. uint16_t RecBuf[PCM_OUT_SIZE], RecBuf1[PCM_OUT_SIZE];
  52. uint8_t RecBufHeader[512], Switch = 0;
  53. __IO uint32_t Data_Status =0;
  54. /* Audio recording number of channels (1 for Mono or 2 for Stereo) */
  55. uint32_t AudioRecChnlNbr = 1;
  56. /* Main buffer pointer for the recorded data storing */
  57. uint16_t* pAudioRecBuf;
  58. /* Current size of the recorded buffer */
  59. uint32_t AudioRecCurrSize = 0;
  60. uint16_t bytesWritten;
  61. /* Temporary data sample */
  62. static uint16_t InternalBuffer[INTERNAL_BUFF_SIZE];
  63. static uint32_t InternalBufferSize = 0;

  64. /* Private function prototypes -----------------------------------------------*/
  65. static void WaveRecorder_GPIO_Init(void);
  66. static void WaveRecorder_SPI_Init(uint32_t Freq);
  67. static void WaveRecorder_NVIC_Init(void);
  68. extern FATFS fatfs;                        /* File system object */
  69. /* Private functions ---------------------------------------------------------*/

  70. /**
  71.   * @brief  Initialize wave recording
  72.   * @param  AudioFreq: Sampling frequency
  73.   *         BitRes: Audio recording Samples format (from 8 to 16 bits)
  74.   *         ChnlNbr: Number of input microphone channel
  75.   * @retval None
  76.   */
  77. uint32_t WaveRecorderInit(uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
  78. {
  79.   /* Check if the interface is already initialized */

  80.     /* Enable CRC module */
  81.     RCC->AHBENR |= RCC_AHBENR_CRCEN;
  82.    
  83.     /* Filter LP & HP Init */
  84.     Filter.LP_HZ = 8000;
  85.     Filter.HP_HZ = 10;
  86.     Filter.Fs = 16000;
  87.     Filter.Out_MicChannels = 1;
  88.     Filter.In_MicChannels = 1;
  89.    
  90.     PDM_Filter_Init((PDMFilter_InitStruct *)&Filter);
  91.    
  92.     /* Configure the GPIOs */
  93.     WaveRecorder_GPIO_Init();
  94.    
  95.     /* Configure the interrupts (for timer) */
  96.     WaveRecorder_NVIC_Init();
  97.    
  98.     /* Configure the SPI */
  99.     WaveRecorder_SPI_Init(AudioFreq);
  100.    
  101.     /* Set the local parameters */
  102.     AudioRecBitRes = BitRes;
  103.     AudioRecChnlNbr = ChnlNbr;
  104.    
  105.     /* Set state of the audio recorder to initialized */

  106.    
  107.     /* Return 0 if all operations are OK */
  108.     return 0;
  109.    
  110. }

  111. /**
  112.   * @brief  Start audio recording
  113.   * @param  pbuf: pointer to a buffer
  114.   *         size: Buffer size
  115.   * @retval None
  116.   */
  117. uint8_t WaveRecorderStart(uint16_t* pbuf, uint32_t size)
  118. {
  119. /* Check if the interface has already been initialized */
  120.   if (!AudioRecInited)
  121.   {
  122.     /* Store the location and size of the audio buffer */
  123.     pAudioRecBuf = pbuf;
  124.     AudioRecCurrSize = size;
  125.    
  126.     /* Enable the Rx buffer not empty interrupt */
  127.     SPI_I2S_ITConfig(SPI2, SPI_I2S_IT_RXNE, ENABLE);
  128.     /* The Data transfer is performed in the SPI interrupt routine */
  129.     /* Enable the SPI peripheral */
  130.     I2S_Cmd(SPI2, ENABLE);
  131.    
  132.     /* Return 0 if all operations are OK */
  133.     return 0;
  134.   }
  135.   else
  136.   {
  137.     /* Cannot perform operation */
  138.     return 1;
  139.   }
  140. }

  141. /**
  142.   * @brief  Stop audio recording
  143.   * @param  None
  144.   * @retval None
  145.   */
  146. uint32_t WaveRecorderStop(void)
  147. {
  148.   /* Check if the interface has already been initialized */
  149.   if (AudioRecInited)
  150.   {
  151.    
  152.     /* Stop conversion */
  153.     I2S_Cmd(SPI2, DISABLE);
  154.    
  155.     /* Return 0 if all operations are OK */
  156.     return 0;
  157.   }
  158.   else
  159.   {
  160.     /* Cannot perform operation */
  161.     return 1;
  162.   }
  163. }

  164. /**
  165.   * @brief  This function handles AUDIO_REC_SPI global interrupt request.
  166.   * @param  None
  167.   * @retval None
  168. */

  169. void SPI2_IRQHandler(void)
  170. {  
  171.    u16 volume;
  172.    u16 app;
  173.   /* Check if data are available in SPI Data register */
  174.   if (SPI_I2S_GetITStatus(SPI2, SPI_I2S_IT_RXNE) != RESET)
  175.   {
  176.                
  177.     app = SPI_I2S_ReceiveData(SPI2);
  178.     InternalBuffer[InternalBufferSize++] = HTONS(app);
  179.    
  180.     /* Check to prevent overflow condition */
  181.     if (InternalBufferSize >= INTERNAL_BUFF_SIZE)
  182.     {
  183.       InternalBufferSize = 0;
  184.      
  185.       volume = 60;
  186.       
  187.       PDM_Filter_64_LSB((uint8_t *)InternalBuffer, (uint16_t *)pAudioRecBuf, volume , (PDMFilter_InitStruct *)&Filter);
  188.       Data_Status = 1;      
  189.     }
  190.   }
  191.          SPI_I2S_ClearITPendingBit(SPI2,SPI_I2S_IT_RXNE);
  192. }

  193. /**
  194.   * @brief  Initialize the wave header file
  195.   * @param  pHeadBuf:Pointer to a buffer
  196.   * @retval None
  197.   */
  198. uint32_t WavaRecorderHeaderInit(uint8_t* pHeadBuf)
  199. {
  200.   uint16_t count = 0;

  201.   /* write chunkID, must be 'RIFF'  ------------------------------------------*/
  202.   pHeadBuf[0] = 'R';
  203.   pHeadBuf[1] = 'I';
  204.   pHeadBuf[2] = 'F';
  205.   pHeadBuf[3] = 'F';

  206.   /* Write the file length */
  207.   /* The sampling time 8000 Hz
  208.    To recorde 10s we need 8000 x 10 x 2 (16-Bit data) */
  209.   pHeadBuf[4] = 0x00;
  210.   pHeadBuf[5] = 0xE2;
  211.   pHeadBuf[6] = 0x04;
  212.   pHeadBuf[7] = 0x00;

  213.   
  214.   /* Write the file format, must be 'WAVE' */
  215.   pHeadBuf[8]  = 'W';
  216.   pHeadBuf[9]  = 'A';
  217.   pHeadBuf[10] = 'V';
  218.   pHeadBuf[11] = 'E';

  219.   /* Write the format chunk, must be'fmt ' */
  220. ……………………

  221. …………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼

所有資料51hei提供下載:
IISchuankou.7z (218.45 KB, 下載次數(shù): 215)


評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏6 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:1 發(fā)表于 2019-3-19 16:38 | 只看該作者
樓主能分享下原理圖嗎?
回復(fù)

使用道具 舉報(bào)

板凳
ID:490602 發(fā)表于 2019-3-19 16:59 | 只看該作者
好東西,感謝分享!!
回復(fù)

使用道具 舉報(bào)

地板
ID:493899 發(fā)表于 2019-3-19 20:50 | 只看該作者
沒(méi)原理圖,用的開(kāi)發(fā)板,買(mǎi)的mems麥克風(fēng)做音頻采集,音頻處理部分在電腦做的,這里只是采集,如果有誰(shuí)對(duì)PDM軟解在行的也教教我。
回復(fù)

使用道具 舉報(bào)

5#
ID:595704 發(fā)表于 2019-8-6 11:12 來(lái)自手機(jī) | 只看該作者
你好,想問(wèn)一下,STM32F767可以用你的這種方法進(jìn)行音頻采集嗎?能不能簡(jiǎn)單指教一下,
回復(fù)

使用道具 舉報(bào)

6#
ID:703989 發(fā)表于 2020-3-8 15:27 | 只看該作者
樓主,我想請(qǐng)教一下您關(guān)于音頻傳輸?shù)诫娔X的問(wèn)題
回復(fù)

使用道具 舉報(bào)

7#
ID:388929 發(fā)表于 2020-3-9 21:57 | 只看該作者
厲害了樓主,我現(xiàn)在就在頭疼這個(gè)I2S,還有SPDIF,頭發(fā)開(kāi)始掉了。。。
回復(fù)

使用道具 舉報(bào)

8#
ID:757410 發(fā)表于 2020-5-21 15:23 | 只看該作者
感謝分享,謝謝樓主
回復(fù)

使用道具 舉報(bào)

9#
ID:820754 發(fā)表于 2020-9-18 21:01 | 只看該作者
請(qǐng)問(wèn)stmf103c8t6可以么
回復(fù)

使用道具 舉報(bào)

10#
ID:884488 發(fā)表于 2021-2-17 10:55 | 只看該作者
您好,請(qǐng)問(wèn)下,這個(gè)錄音數(shù)據(jù)的格式可以設(shè)置為32位雙聲道嗎?
回復(fù)

使用道具 舉報(bào)

11#
ID:898414 發(fā)表于 2021-3-30 10:32 | 只看該作者
你好樓主 最近在做stm32用iis傳輸音頻數(shù)據(jù),可以
指導(dǎo)一二嗎
回復(fù)

使用道具 舉報(bào)

12#
ID:726617 發(fā)表于 2021-10-19 15:00 | 只看該作者
你好樓主,我最近也在做用STM32做音頻采集,我想請(qǐng)問(wèn)下你用的MEMS麥克風(fēng)型號(hào)和是使用的STM43F4開(kāi)發(fā)板嘛?
回復(fù)

使用道具 舉報(bào)

13#
ID:885182 發(fā)表于 2021-11-11 21:46 | 只看該作者
歇息分享,想問(wèn)下可以如何調(diào)整音量,在錄制時(shí)
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 午夜精品一区二区三区三上悠亚 | 国产精品久久久爽爽爽麻豆色哟哟 | 国产成人精品免费视频大全最热 | 欧美日韩高清一区二区三区 | 精品国产乱码久久久 | 亚洲成人精品在线 | 日韩欧美大片在线观看 | 成人国产精品久久 | 日日夜夜精品 | 久久高清| 中文字幕精品一区久久久久 | 91精品国产色综合久久不卡98口 | 国产精品视频免费 | 久草久 | 日韩网站在线观看 | 天天摸天天干 | 丝袜美腿一区二区三区 | 一区二区三区视频在线观看 | 美女国内精品自产拍在线播放 | 亚洲在线一区二区三区 | 97综合在线 | 午夜精品久久久久久久久久久久久 | 久草网在线视频 | 国产成人精品在线 | 成人精品一区 | 欧美www在线| 天天天久久久 | 成人毛片在线视频 | 久久久久久久久久久久久久久久久久久久 | 成人毛片网站 | 神马福利 | 91精品久久久久久久久中文字幕 | 99一区二区 | 国产精品一区一区 | 亚洲视频免费在线看 | 三级成人在线 | 黄色片在线看 | 日本三级线观看 视频 | 日本一二三区高清 | 人人种亚洲 | 亚洲精品久久久一区二区三区 |