Skip to content

RT-Thread-packages/wavplayer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wavplayer

中文页 | English

1. Introduction

wavplayer is a simple wav format music player that provides functions for playing and recording wav files, supporting functions such as play, stop, pause, resume, and volume adjustment.

1.1. File structure

Folder Description
src Core source code, which mainly implements wav playback and recording, and export Finsh command line
inc Header file directory

1.2 License

The wavplayer package complies with the Apache 2.0 license, see the LICENSE file for details.

1.3 Dependency

  • RT-Thread 4.0+
  • RT-Thread Audio driver framework
  • optparse command line parameter parsing package

1.4 Configuration Macro Description

 --- WavPlayer: Minimal music player for wav file play and record.
 [*] Enable support for play
 (sound0) The play device name
 [*] Enable support for record
 (sound0) The record device name
       Version (v1.0.0) --->

Enable support for play: enable wav play function The play device name: Specify the sound card device used for playback, default sound0 Enable support for record: enable wav recording function The record device name: Specify the sound card device used for recording, the default is the same as the playback, use sound0.

2. Use

Common functions of wavplayer have been exported to Finsh command line for developers to test and use. Commands are mainly divided into two categories: playback and recording, which provide different functions.

The functions provided by the play command are as follows

msh />wavplay -help
usage: wavplay [option] [target] ...

usage options:
  -h, --help Print defined help message.
  -s URI, --start=URI Play wav music with URI(local files).
  -t, --stop Stop playing music.
  -p, --pause Pause the music.
  -r, --resume Resume the music.
  -v lvl, --volume=lvl Change the volume(0~99).
  -d, --dump Dump play relevant information.

The functions provided by the recording command are as follows

msh />wavrecord -h
usage: wavrecord [option] [target] ...

usage options:
  -h, --help Print defined help message.
  -s file --start=file <samplerate> <channels> <samplebits>
                                        record wav music to filesystem.
  -t, --stop Stop record.

2.1 Play function

  • Start playing
msh />
msh />wavplay -s song_44.wav
Information:
sampletate 44100
channels 2
sample bits width 16
[I/WAV_PLAYER] play start, uri=song_44.wav
  • Stop play
msh />wavplay -t
[I/WAV_PLAYER] play end
  • Pause playback
msh />
msh />wavplay -p
msh />
  • Resume playback
msh />
msh />wavplay -r
msh />
  • Set volume
msh />
msh />wavplay -v 88
msh />

2.2 Recording function

  • start recording
msh />wavrecord -s test.wav
Information:
sampletate 8000
channels 2
  • Stop recording
msh />
msh />wavrecord -t
msh />

3. Matters needing attention

  • Only supports audio with 16bit sampling bits

4. Contact