Skip to content

OpenNuvoton/NuMaker-mbed-Audio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NuMaker-mbed-Audio

This library contains Mbed implementation of NuMaker Audio I2S and Codec.

Example: Play PCM data from SD card

  1. Declare NuSDBlockDevice and FATFileSystem.

    NuSDBlockDevice bd   // device SD driver
    FATFileSystem fs     // Mbed FAT file system
    
  2. Declare audio.

    NAU8822L audio  // NAU8822L object, I2C pinout/address and I2S pinout
    or
    NAU88L25 audio  // NAU88L25 object, I2C pinout/address and I2S pinout
    
  3. Attach callback function for playing.

    audio.attach(&play);
    
  4. Start audio.

    audio.start();
    
  5. Stop playing.

    audio.stop();
    
  6. Write PCM data to audio.

    audio.write
    

Example: Record PCM data to SD card

  1. Attach callback function for recording.

    audio.attach(&record);
    
  2. Record audio.

    audio.record();
    
  3. Stop recording.

    audio.stop();
    
  4. Read PCM data from audio.

    audio.read();
    

Notes:

  1. Smoothly playing or recording depends on the performance of SD card.

  2. Use FFmpeg to convert a PCM file.

    ffmpeg.exe -hide_banner -i audio_file -map_metadata -1 -flags +bitexact -vn -sn -c:a pcm_s16le -ac 1 -ar 8000 -f s16le test.pcm
    

About

mbed implementation of NuMaker Audio included I2S and Codec

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages