0% found this document useful (0 votes)
238 views31 pages

GSM Audio Player: Application Note

Quectel_GSM_Audio_Player_Application_Note

Uploaded by

somx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
238 views31 pages

GSM Audio Player: Application Note

Quectel_GSM_Audio_Player_Application_Note

Uploaded by

somx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

GSM Audio Player

Application Note

GSM/GPRS Module Series

Rev. GSM_Audio_Player_Application_Note_V3.2

Date: 2015-05-20

www.quectel.com
GSM Module Series
GSM Audio Player Application Note

Our aim is to provide customers with timely and comprehensive service. For any
assistance, please contact our company headquarters:

Quectel Wireless Solutions Co., Ltd.


Office 501, Building 13, No.99, Tianzhou Road, Shanghai, China, 200233
Tel: +86 21 5108 6236
Mail: [email protected]

Or our local office, for more information, please visit:


http://www.quectel.com/support/salesupport.aspx

t el
For technical support, to report documentation errors, please visit:

l
http://www.quectel.com/support/techsupport.aspx

c
Or Email: [email protected]

GENERAL NOTES

u e t ia
n
QUECTEL OFFERS THIS INFORMATION AS A SERVICE TO ITS CUSTOMERS. THE INFORMATION

Q ide
PROVIDED IS BASED UPON CUSTOMERS’ REQUIREMENTS. QUECTEL MAKES EVERY EFFORT
TO ENSURE THE QUALITY OF THE INFORMATION IT MAKES AVAILABLE. QUECTEL DOES NOT
MAKE ANY WARRANTY AS TO THE INFORMATION CONTAINED HEREIN, AND DOES NOT ACCEPT
ANY LIABILITY FOR ANY INJURY, LOSS OR DAMAGE OF ANY KIND INCURRED BY USE OF OR

f
RELIANCE UPON THE INFORMATION. THE INFORMATION SUPPLIED HEREIN IS SUBJECT TO

n
CHANGE WITHOUT PRIOR NOTICE.

o
COPYRIGHT

C
THIS INFORMATION CONTAINED HERE IS PROPRIETARY TECHNICAL INFORMATION OF
QUECTEL CO., LTD. TRANSMITTABLE, REPRODUCTION, DISSEMINATION AND EDITING OF THIS
DOCUMENT AS WELL AS UTILIZATION OF THIS CONTENTS ARE FORBIDDEN WITHOUT
PERMISSION. OFFENDERS WILL BE HELD LIABLE FOR PAYMENT OF DAMAGES. ALL RIGHTS
ARE RESERVED IN THE EVENT OF A PATENT GRANT OR REGISTRATION OF A UTILITY MODEL
OR DESIGN.

Copyright © Quectel Wireless Solutions Co., Ltd. 2015. All rights reserved.

GSM_Audio_Player_Application_Note Confidential / Released 1 / 30


GSM Module Series
GSM Audio Player Application Note

About the Document

History

el
Revision Date Author Description

t l
3.0 2013-02-19 Thomas ZHANG Initial

c a
1. Modified the sampling rate of audio recording

e i
format in Table 2.

t
2. Modified Figure 1: Audio Playback Overview

u
3. Renamed “Receiver” as “Normal Audio

n
3.1 2013-04-18 Thomas ZHANG
Channel”.

Q ide
4. Renamed “Earphone” as “Headset”.
5. Modified AT Commands: AT+QPLAYRES/
AT+QPSND.

f
3.2 2015-05-20 Thomas ZHANG Added applicable modules

o n
C
GSM_Audio_Player_Application_Note Confidential / Released 2 / 30
GSM Module Series
GSM Audio Player Application Note

Contents

About the Document ................................................................................................................................... 2


Contents ....................................................................................................................................................... 3
Table Index ................................................................................................................................................... 4

1 Introduction .......................................................................................................................................... 5

2 Overview ............................................................................................................................................... 6

3 Audio Recording .................................................................................................................................. 7

l
3.1. Record from Microphone ............................................................................................................ 7
3.2. Record from Voice Call ............................................................................................................... 7

e
3.3. Supported Recording Format ..................................................................................................... 7

t l
4 Audio Playback .................................................................................................................................... 8

c
4.1. Source of Playback ..................................................................................................................... 9

a
4.1.1. Playback from File System .............................................................................................. 9

e i
4.1.2. Playback from Stream (.bin)............................................................................................. 9

u t
4.1.3. Playback from Stream (UART Input)................................................................................ 9

n
4.2. Type of Playback ......................................................................................................................... 9
4.2.1. Playback in Idle State ..................................................................................................... 10

Q ide
4.2.2. Playback in Voice Call State .......................................................................................... 10
4.3. Supported Audio Formats ......................................................................................................... 10

f
5 Related AT Command Description................................................................................................... 11
5.1. AT Command Syntax ................................................................................................................ 11

n
5.2. Description of AT Command ..................................................................................................... 11
5.2.1. AT+QAUDRD Record Media File ................................................................................ 11

o
5.2.2. AT+QAUDPLAY Play Media File ............................................................................... 13
5.2.3. AT+QAUDSTOP Stop Playing Media File ................................................................. 14

C
5.2.4. AT+QPLAYRES Play Audio Stream from Resource Bin ........................................... 15
5.2.5. AT+QSTOPRES Manually Stop the Audio Resource Playing ................................... 16
5.2.6. AT+QPRESBG Playback Audio from Resource Bin to the Remote in Call ................ 16
5.2.7. AT+QPSND Play Audio File and Send it to the Remote in Call ................................ 18
5.2.8. AT+QPCMD Play PCM Stream from UART to the Remote in Call ........................... 19
5.2.9. AT+QMEDVL Set/Get Media Volume Gain ............................................................... 21
6 Appendix A Reference....................................................................................................................... 22
7 Appendix B Error Codes ................................................................................................................... 23
8 Appendix C Audio Resource Generator .......................................................................................... 24
8.1. Overview ................................................................................................................................... 24
8.1.1. Advantages .................................................................................................................... 24
8.1.2. Procedure ....................................................................................................................... 24
8.2. Make and Download Bin File .................................................................................................... 25
8.2.1. Make Bin File.................................................................................................................. 25
8.2.2. Download Audio Bin File to Module ............................................................................... 28

GSM_Audio_Player_Application_Note Confidential / Released 3 / 30


GSM Module Series
GSM Audio Player Application Note

Table Index

TABLE 1: SUPPORTED MODULES ................................................................................................................... 6


TABLE 2: RECORDING FORMAT....................................................................................................................... 7
TABLE 3: AT COMMANDS MATRIX .................................................................................................................... 9
TABLE 4: SUPPORTED AUDIO FORMATS ..................................................................................................... 10
TABLE 5: +QAUDRIND CODE .......................................................................................................................... 13
TABLE 6: +QAUDPIND CODE .......................................................................................................................... 14
TABLE 7: RELATED DOCUMENTS .................................................................................................................. 22
TABLE 8: TERMS AND ABBREVIATIONS ........................................................................................................ 22

l
TABLE 9: DESCRIPTION OF DIFFERENT CODING SCHEMES .................................................................... 23

c t e l
u e t ia
Q ide n
n f
Co

GSM_Audio_Player_Application_Note Confidential / Released 4 / 30


GSM Module Series
GSM Audio Player Application Note

1 Introduction
This document describes the functions of audio playback and audio recording of Quectel modules. The
revolved AT commands are listed in this document.

This document is applicable to Quectel M10, M66, M95 and M85 modules.

t el
e c ia l
u n t
Q ide
n f
Co

GSM_Audio_Player_Application_Note Confidential / Released 5 / 30


GSM Module Series
GSM Audio Player Application Note

2 Overview
For Quectel modules with audio function, most of them have two analog audio channels at least.

Audio could be recorded from microphone or uplink / downlink speech, and stored, in the form of files, into
memory, such as flash and SD card. These recorded audio files can also be played back with modules’

l
DAC and DSP. Besides, playback of audio stream stored in binary or input from UART is supported as
well.

t e l
The functions related to file operation, such as recording, audio file playback, are only available on

c
Quectel modules with UFS (user file storage) function. The UFS function is mostly provided in the module

e a
with enough flash memory, 32Mbit at least.

u t i
AT+QPLAYRES and AT+QPRESBG are supported in module with 64Mbit and above flash. AT+QAUDRD,

n
AT+QAUDPLAY, AT+QAUDSTOP and AT+QPSND are supported in module with 32Mbit and above flash.

Q ide
AT+QPCMD is supported in module with flash smaller than 32Mbit.

The following table lists the detailed supported modules.

f
Table 1: Supported Modules

n
AT Commands M10 M66 M95 M85

o
AT+QAUDRD YES YES YES YES

C
AT+QAUDPLAY NO YES YES YES

AT+QAUDSTOP NO YES YES YES

AT+QPLAYRES NO YES NO YES

AT+QSTOPRES NO YES NO YES

AT+QPRESBG NO YES NO YES

AT+QPSND NO YES NO YES

AT+QPCMD YES YES YES YES

AT+QMEDVL NO YES YES YES

These functions will be described in the next few chapters.

GSM_Audio_Player_Application_Note Confidential / Released 6 / 30


GSM Module Series
GSM Audio Player Application Note

3 Audio Recording
3.1. Record from Microphone

l
Use the AT+QAUDRD (details in section 5.2.1) can record the sound from microphone. AT+QAUDCH can
select which microphone channel to be used. Several media formats are supported, such as

e
WAV_PCM16, WAV_ALAW, WAV_ULAW, WAV_ADPCM and AMR. Refer to Table 2: Recording Format.

t
See the AT commands description for more information.

e c
3.2. Record from Voice Call

ia l
u n t
Downlink and uplink speech could be recorded during voice call. Use the same AT+QAUDRD command,
just after call is established.

Q ide
3.3. Supported Recording Format

n f
Table 2: Recording Format

o
Sampling Sampling Encoding Encode
Format Encoding File Size

C
Rate Resolution Digit Speed

3 AMR 8 KHz 13 bit 40 KB/min

13 WAV_PCM16 8 KHz 16 bit 16 bit 128 kbps 960 KB/min

14 WAV_ALAW 8 KHz 16 bit 8 bit 64 kbps 480 KB/min

15 WAV_ULAW 8 KHz 16 bit 8 bit 64 kbps 480 KB/min

16 WAV_ADPCM 8 KHz 16 bit 4 bit 32 kbps 240 KB/min

GSM_Audio_Player_Application_Note Confidential / Released 7 / 30


GSM Module Series
GSM Audio Player Application Note

4 Audio Playback
Two aspects will be described here. One is the source of the playback. Audio can be played back from the
file system or from binary stream or even from UART. The other is the type of the playback. Audio can be
playback in the voice call state and idle state. Different commands should be used for different
combination of these two aspects. See the table below. The formats supported for each command is

l
different either. See Chapter 4.3.

t e
See the following figure and table to get an overview of the audio playback.

e c ia l
u t
Module Voice Call

Q ide n
UART PCM(Linear/A-Law/U-Law)
AT+QPCMD

n f Flash

Co DAC
WAV/AMR
AT+QPLAYRES

WAV/AMR/MP3
AT+QAUDPLAY
Audio Bin Data

File System

Audio Files
WAV/AMR

AT+QPRESBG

WAV/AMR
AT+QPSND

Figure 1: Audio Playback Overview

GSM_Audio_Player_Application_Note Confidential / Released 8 / 30


GSM Module Series
GSM Audio Player Application Note

Table 3: AT Commands Matrix

File system Bin UART

Idle AT+QAUDPLAY AT+QPLAYRES AT+QPCMD

Voice Call AT+QPSND AT+QPRESBG AT+QPCMD

4.1. Source of Playback

l
Audio data (digital form) to be played back can come from several sources, files stored in file system, data
binary (.bin) stored in the flash, and PCM stream input from UART.

t e l
4.1.1. Playback from File System

c a
Audio files stored in module’s file system could be played back, either in flash or in memory card. In idle

e i
state (no call), AT+QAUDPLAY (section 5.2.2 ) is used to play the audio files. During voice call,

u t
AT+QPSND (section 5.2.7) is used to play the audio files to the other side of the call.

Q ide n
4.1.2. Playback from Stream (.bin)

Audio data could be packed into a binary file (.bin) and downloaded into module’s flash memory, just like
module’s firmware. The data is structured into the binary. The PC side tool is provided to generate such

f
bin for production line. See appendix C (Chapter 8 ) for the detailed usage of audio resource bin

n
generator.

o
In idle state, AT+QPLAYRES (section 5.2.4) is used to play such audio resource. During voice call,
AT+QPRESBG (section 5.2.6) is used to play such audio resource to the other side of the call.

C
4.1.3. Playback from Stream (UART Input)

PCM stream input from UART can also be played back. AT+QPCMD (section 5.2.8 ) is used in this
scenario. It should be noticed that only 8 KHz sampling rate is supported.

4.2. Type of Playback

The type mentioned here is to play in idle or voice call state. Different type supports the different audio
playback format. In general, playback in idle state can support more formats than in voice call state.

GSM_Audio_Player_Application_Note Confidential / Released 9 / 30


GSM Module Series
GSM Audio Player Application Note

4.2.1. Playback in Idle State

Idle state means no call exists. Sound will output to local speakers. AT+QAUDPLAY (section 5.2.2) and
AT+QPLAYRES (section 5.2.4) belong to such category.

4.2.2. Playback in Voice Call State

The played sound will be mixed into the downlink and uplink speech stream and send to the far end of
voice call. AT+QPSND (section 5.2.7 ), AT+QPRESBG (section 5.2.6 ) and AT+QPCMD (section 5.2.8 )
belong to such category.

l
4.3. Supported Audio Formats

t e l
The table below shows the formats supported in each command.

e c ia
Table 4: Supported Audio Formats

u t
Commands Supported Formats

Q ide n
AT+QAUDPLAY WAV (Linear PCM, A-Law, U-Law, ADPCM), AMR, MP3

AT+QPSND 8 KHz sampling rate WAV, AMR

f
AT+QPLAYRES WAV (Linear PCM, A-Law, U-Law, ADPCM), AMR

n
AT+QPRESBG 8 KHz sampling rate WAV (Linear PCM, A-Law, U-Law, ADPCM), AMR

o
AT+QPCMD 8 KHz sampling rate: raw data of linear PCM, A-Law and U-Law

C
GSM_Audio_Player_Application_Note Confidential / Released 10 / 30
GSM Module Series
GSM Audio Player Application Note

5 Related AT Command Description

5.1. AT Command Syntax


This command returns the list of parameters and value ranges

l
Test Command AT+<x>=?
set by the corresponding Write Command or internal processes.

e
This command returns the currently set value of the parameter
Read Command AT+<x>?

t
or parameters.

c l
Write Command AT+<x>=<…> This command sets the user-definable parameter values.

e a
Execution This command reads non-variable parameters affected by

i
AT+<x>

t
Command internal processes in the GSM engine

u
Q ide n
5.2. Description of AT Command

5.2.1. AT+QAUDRD Record Media File

f
Record the uplink and downlink speech during voice call or record sound from local microphone in idle

n
state and save it to files.

o
AT+QAUDRD Record Media File

C
Test Command Response
AT+QAUDRD=? +QAUDRD: (list of supported
<control>s),"filename"[,(list of supported <format>s)]

OK
Read Command Response
AT+QAUDRD? +QAUDRD: <state>

OK
Write Command Response
AT+QAUDRD=<control>[,"filename"[, OK
<format>]]
Reference

GSM_Audio_Player_Application_Note Confidential / Released 11 / 30


GSM Module Series
GSM Audio Player Application Note

Parameter

<state> Recording state


0 Module is not in recording
1 Module is in recording
"filename" Name of the file to record, refer to Note 1
<format> Format of the file, refer to Note 2
3 AMR
13 WAV_PCM16
14 WAV_ALAW
15 WAV_ULAW

l
16 WAV_ADPCM
<control> Start to record or stop the recording

e
0 Stop the recording

t
1 Start to record

NOTES

e c ia l
u t
1. "filename" includes file path, file name and file suffix. File path can be UFS, RAM, SD root directory

n
and SD subdirectory. Corresponding examples, "Example.wav", "RAM:Example.wav", "SD:

Q ide
Example.wav" and "SD:Directory\\Example.wav". File suffix can be “wav” or “amr” when the <format>
is omitted. For “amr” suffix, file is stored in AMR coding format. For “wav” suffix, file is stored in
WAV_ADPCM coding format in voice call state, and stored in WAV_PCM16 coding format in idle
state.

f
2. When the file suffix is “amr”, the format can only be “3” (AMR). When the file suffix is “wav”, the format
can be “13” (WAV_PCM16), “14” (WAV_ALAW), “15” (WAV_ULAW), and “16” (WAV_ADPCM). For

n
other suffixes, parameter <format> must be provided. Please refer to Table 2: Recording Format.

o
3. If the recording file’s name and format is same with an existed file. Recording data will be appended to
the end of the file.

C
4. Record media file to SD subdirectory, you need to create the subdirectory manually first.
5. Audio channel is decided by AT command: AT+QAUDCH
6. The recording would be forced to quit in the following cases.
a) Start to record when module is on idle. Make a call or answer a call, the recording would be
forced to quit.
b) Start to record when module is on a call. The recording would be forced to quit when the call is
hanged up.
When the recording is forced to quit, URC +QAUDRIND: 0,<code> would be output through UART.
Refer to Table 5: +QAUDRIND Code.
7. Gain of the recording cannot be adjusted by AT command.

GSM_Audio_Player_Application_Note Confidential / Released 12 / 30


GSM Module Series
GSM Audio Player Application Note

Table 5: +QAUDRIND Code

<code> Meaning

0 Reserved

1 Unknown error

3 Disk is full

6 Interrupted by other audio task

l
10 Disk not found

t e
5.2.2. AT+QAUDPLAY Play Media File

c l
Play back the audio files in idle mode and output to speakers.

e t ia
AT+QAUDPLAY Play Media File

u
Test Command Response

n
AT+QAUDPLAY=? +QAUDPLAY: "filename",(list of supported <repeat>s),( list of

Q ide
supported <volume>s)[,( list of supported <channel>s )]

OK

f
Write Command Response
AT+QAUDPLAY= OK

n
"filename",<repeat>,<volume
>[,<channel>]

o
Reference

Parameter

"filename"

<repeat>
C Name of the file to play, includes file path, file name and file suffix. File suffix can be
AMR,WAV or MP3
Whether to play media file repeatedly
0 Play only one time
1 Play repeatedly
<volume> Volume level to play media file
Range: 0-100
<channel> Channel to play media file
0 Normal audio channel
1 Headset

GSM_Audio_Player_Application_Note Confidential / Released 13 / 30


GSM Module Series
GSM Audio Player Application Note

2 Loud Speaker

NOTES

1. If the <channel> parameter is omitted, channel is decided by AT command: AT+QAUDCH.


2. When the playing is finished or interrupted by other audio tasks, URC +QAUDPIND: 0,<code> would
be output through UART. Refer to Table 6: +QAUDPIND code.

Table 6: +QAUDPIND code

l
<code> Meaning

t e
5 Playing is finished

c l
6 Interrupted by other audio tasks

e ia
9 Unknown error

5.2.3. AT+QAUDSTOP

u n tStop Playing Media File

Q ide
Stop the audio file playback triggered by AT+QAUDPLAY.

AT+QAUDSTOP Stop Playing Media File

f
Test Command Response

n
AT+QAUDSTOP=? OK
Execution Command Response

o
AT+QAUDSTOP OK
Reference

Example

OK
AT+QAUDRD=0
OK
C
AT+QAUDRD=1,"A.amr",3

AT+QAUDRD=1,"SD:B.wav"
// Record a media file in AMR format, store it in UFS.
// Name it as “A”

// Stop the recording.


// Record a media file in WAV_PCM16 format, store it in
OK SD root directory and Name it as “B”.
AT+QAUDRD=0 // Stop the recording
OK
// Create a subdirectory named “picture” before recording
AT+QAUDRD=1,"SD:picture\\C.wav" // Record a media file, and store it in SD subdirectory,
OK // Name it as “C”.

GSM_Audio_Player_Application_Note Confidential / Released 14 / 30


GSM Module Series
GSM Audio Player Application Note

AT+QAUDRD=0 //Stop the recording


OK
AT+QAUDPLAY="A.amr",0,100,1 // Play the “A” media file, not repeat, volume 100, through
OK headset.
+QAUDPIND: 0,5 // After playing is finished, URC report is output
AT+QAUDPLAY="SD:picture\\B.wav",0,100,1 // Play the “B” media file, not repeat, volume 100,
OK through Headset.
+QAUDPIND: 0,5 //After playing is finished, URC report is output.
AT+QAUDPLAY="SD:C.wav",1,80,1 // Play the “C” media file, repeat, volume 80, through
OK headset.
AT+QAUDSTOP // Stop the playing

l
OK

t e
5.2.4. AT+QPLAYRES Play Audio Stream from Resource Bin

c l
Play back the audio binary (.bin) that is already downloaded into flash in idle mode and output it to

e ia
speakers.

u t
AT+QPLAYRES Play Audio Stream from Resource Bin

n
Test Command Response

Q ide
AT+QPLAYRES=? +QPLAYRES: "resname",(list of supported
<repeat>s),(list of supported <volume>s)
OK
Write Command Response

f
AT+QPLAYRES="resname",<repeat>, OK

n
<volume>
If error is related to ME functionality:

o
+CME ERROR: <err>
Reference

C
Parameter

"resname" A string prefixed with "RES:", followed by the audio ID, like "RES:0001". The ID of the
Nth audio resource is N. For example, the first is 0001; the second is 0002 and so on.
<repeat> Whether to play media file repeatedly
0 Play only once
1 Play repeatedly
<volume> Volume level.
Range: 0-100

GSM_Audio_Player_Application_Note Confidential / Released 15 / 30


GSM Module Series
GSM Audio Player Application Note

NOTES

1. If the audio is not found in Bin file, error is returned.


2. Use the audio resource generator to make a bin. See appendix, chapter 8.

5.2.5. AT+QSTOPRES Manually Stop the Audio Resource Playing

Stop the audio bin playback triggered by AT+QPLAYRES.

AT+QSTOPRES Manually Stop the Audio Resource Playing

l
Test Command Response

e
AT+ QSTOPRES=? OK

t
Execute Command Response

c l
AT+ QSTOPRES OK
Reference

Example

u e t ia
Q ide n
AT+QAUDCH=1 // Set output channel to earphone
OK
AT+QPLAYERS="RES:0023",0,1 // Play the 23th audio for once
OK

f
+QAUDPIND: 0,0 // Playing completes
AT+QPLAYERS="RES:0023",1,1 // Play the 23th audio endlessly

n
OK

o
AT+QSTOPRES // Stop playing
OK

C
5.2.6. AT+QPRESBG Playback Audio from Resource Bin to the Remote in Call

Play back audio bin that is already downloaded into flash during voice call. The audio will be mixed to the
uplink and downlink speech.

AT+QPRESBG Playback Audio from Resource Bin to the Remote in Call


Test Command Response
AT+QPRESBG=? +QPRESBG: (list of supported <control>s),[(list of
supported <ID>s),(list of supported <ul_vol>s),(list of
supported <dl_vol>s)[,(0-2)]]

OK

GSM_Audio_Player_Application_Note Confidential / Released 16 / 30


GSM Module Series
GSM Audio Player Application Note

Write Command Response


AT+QPRESBG=<control>[,<ID>,<ul_v OK
ol>,<dl_vol>[,<channel>]]
Reference

Parameter

<control> Start playback or stop the playback


0 Stop playing. The parameters behind <mode> can be omitted
1 Play audio bin resource

l
<ID> Sequence number of audio resource in bin file

e
Range: 1-N (N: integer, total numbers of audio files)

t
<ul_vol> Uplink volume

l
Range: 0 - 7

c
<dl_vol> Downlink volume

e a
Range: 0 - 7

t i
<channel> Audio output channel. It is optional.

u
0 Normal audio channel

n
1 Headset

Q ide
2 Loud Speaker

NOTES

f
1. URC Report:+QPRESBG: 0,<result>

n
<result>=5: playing finished
<result>=6: playing interrupted

o
2. Audio resource can only be AMR file or 8KHz WAV file.
3. If <channel> is not be set in this command, the channel will be controlled by AT+QAUDCH.

C
Example
AT+QPRESBG=?
+QPRESBG: (0,1),(1-n),(0-7),(0-7)[,(0-2)]

OK
AT+QPRESBG=1,1,6,7,1 // Play the audio which’s sequence number is 1 in bin resource.
OK // Uplink volume is 6; downlink volume is 7, use earphone to play
AT+QPRESBG=0 // Stop playback
OK
AT+QAUDCH=0 // Set main channel to play audio
OK
AT+QPRESBG=1,2,6,5 // Play the audio which’s sequence number is 2 in bin resource.
OK // Use main channel to play

GSM_Audio_Player_Application_Note Confidential / Released 17 / 30


GSM Module Series
GSM Audio Player Application Note

5.2.7. AT+QPSND Play Audio File and Send it to the Remote in Call

Play back the audio files during voice call. The audio will be mixed to the uplink and downlink speech.

AT+QPSND Play Audio File and Send it to the Remote in Call


Test Command Response
AT+QPSND=? +QPSND: (list of supported <control>s),"filename",( list
of supported <repeat_cnts>s),( list of supported
<ul_vol>s)[,( list of supported <dl_vol>s)][,( list of
supported <channel>s)]

l
OK
Write Command Response

t e
AT+QPSND OK

l
=<control>[,"filename",<repeat_cnts>

c
,<ul_vol>[,<dl_vol>[,<channel>]]] If error is related to ME functionality

a
+CME ERROR: <err>

e t i
Reference

u
Q ide n
Parameter

<control> Start playback or stop the playback


0 Stop the playback

f
1 Start playback
"filename" File name of the audio file. If file is located in UFS, embrace the file name into the

n
quotes, e.g. "example.wav"; If file is located in SD card, add label "SD:" ahead of the

o
file name, e.g. "SD:example.wav". The audio file must be 8KHz wav file or AMR file.
<repeat_cnts> Repeat counts

C
0 Repeat endless
N Repeat N times, Range of N:1-32767
<ul_vol> Uplink volume
Range: 0 - 7
<dl_vol> Downlink volume
Range: 0 - 7
<channel> Audio output channel of playback
0 Normal audio channel
1 Headset
2 Loudspeaker

GSM_Audio_Player_Application_Note Confidential / Released 18 / 30


GSM Module Series
GSM Audio Player Application Note

NOTES

1. If playback during voice call, the <channel> will not take effect, instead, the downlink sound will output
from the same speaker with speech. If playback without voice call established, the <channel> will take
effect.
2. If this parameter is omitted, the output path will be decided by AT+QAUDCH.
3. The audio file must be 8KHz WAV file or AMR file, otherwise, the playback will fail

Example
AT+QPSND=? // Query parameter

l
+QPSND: (0,1),"filename",(0-32767),(0-7)[,(0-7)][,(0-2)]

e
OK

t
AT+QPSND=1,"rec01.wav",1,7,7 // Start playback

c l
OK

a
AT+QPSND=0 // Stop the playback

e i
OK

u n t
5.2.8. AT+QPCMD Play PCM Stream from UART to the Remote in Call

Q ide
Play back PCM stream that is input from UART during voice call. The audio will be mixed to the uplink and
downlink speech.

f
AT+QPCMD Play PCM Stream from UART to the Remote in Call

n
Test Command Response
AT+QPCMD=? +QPCMD: (list of supported <control>s)[,( list of

o
supported <ul_vol>s),( list of supported <dl_vol>s),( list
of supported <format>s)[,( list of supported <uart>s)]]

C
OK
Write Command Response
AT+QPCMD=<control> if <uart> is AT command port, response
[,<ul_vol>,<dl_vol>,<format>[,<uart>] OK
]
CONNECT
else response
OK
If error is related to ME functionality
+CME ERROR: <err>
Reference

GSM_Audio_Player_Application_Note Confidential / Released 19 / 30


GSM Module Series
GSM Audio Player Application Note

Parameter

<control> Start playback or stop the playback


1 Start play PCM stream
0 Stop play PCM stream
<ul_vol> Uplink volume
Range: 0-7
<dl_vol> Downlink volume
Range: 0-7
<control> Format of PCM stream
0 16-bit linear PCM

l
1 8-bit linear PCM
2 8-bit a-law

e
3 8-bit u-law

t
<uart> UART port number of PCM stream to input. The default port is AT command port.

c l
Range: 1-3

e t ia
NOTES

u n
1. If <control> is 0, other parameters are ignored.
2. The format of PCM stream must be PCM raw data and the sample rate must be 8k HZ.

Q ide
3. Recommend to set <dl_vol> to 0
4. Recommend to open hardware flow control
5. On <uart> port,

f
If buffer of UART is full, the following URC will be reported,
FULL

n
If buffer of UART resumes empty, the following URC will be reported,

o
READY

C
Example
AT+QPCMD=1,7,0,2 // Start to play PCM input from the AT command port
OK

CONNECT // Enter data mode

READY // UART is ready to receive PCM data.


<Then send PCM stream to UART>
FULL // UART buffer is full, recommended to stop send PCM data.

READY // UART is ready to receive PCM data.


+++ // Input “+++”to exit data mode and stop play PCM.
OK
AT+QPCMD=1,7,0,2,2 // Start to play PCM data which is input from a different serial port from AT

GSM_Audio_Player_Application_Note Confidential / Released 20 / 30


GSM Module Series
GSM Audio Player Application Note

command port
OK
<Send PCM stream to UART2>
AT+QPCMD=0 // Stop playing PCM.
OK

5.2.9. AT+QMEDVL Set/Get Media Volume Gain

Get or set the volume level of media playback in idle mode. This command controls the volume level of
AT+QAUDPLAY and AT+QTTS. Volume gain of uplink/downlink of AT+QPSND, AT+QPRESBG and
AT+QPCMD cannot be controlled by this command.

l
AT+QMEDVL Set/Get Media Volume Gain

t e
Test Command Response

l
AT+QMEDVL=? +QMEDVL: (list of supported <volume>s)

e c ia
OK

t
Read Command Response

u
AT+ QMEDVL? +QMEDVL: <volume>

Q ide n
OK
Write Command Response
AT+QMEDVL=<volume> OK

f
If format is error, response
+CME ERROR: <err>

n
Reference

o
Parameter

C
<volume> Volume level of media playback
Range : 0-100

Example
AT+QMEDVL=? // Test command
+QMEDVL: (0-100)

OK
AT+QMEDVL? // Read command
+QMEDVL: 50

OK
AT+QMEDVL=90 // Write command
OK

GSM_Audio_Player_Application_Note Confidential / Released 21 / 30


GSM Module Series
GSM Audio Player Application Note

6 Appendix A Reference

Table 7: Related Documents

SN Document name Remark

l
[1] Mxx_AT_Commands_Manual AT Commands Manual

c t e l
a
Table 8: Terms and Abbreviations

e t i
Abbreviation Description

u n
ME Mobile Equipment

Q ide
TA Terminal Adapter

MS Mobile Station

f
UFS User File Storage

n
NV Non-volatile

Co

GSM_Audio_Player_Application_Note Confidential / Released 22 / 30


GSM Module Series
GSM Audio Player Application Note

7 Appendix B Error Codes

Table 9: Description of Different Coding Schemes

l
Code of <err> Meaning

t e
4300 Wrong format

c l
4302 Audio task busy

e ia
4303 Create file failed

u t
4304 Additional recording in a different format

Q ide n
4305 Disc full

4306 File write protect

4401 Play PCM fail

n f
4402 Audio device busy

o
4403 No memory

4404 UART buffer full

C
GSM_Audio_Player_Application_Note Confidential / Released 23 / 30
GSM Module Series
GSM Audio Player Application Note

8 Appendix C Audio Resource


Generator

l
This chapter introduces how to generate the audio resource bin. The PC side tool is provided.

e
8.1. Overview

c t l
Audio stream data in wav and AMR files could be packed into a binary file (.bin) with Quectel tool

e ia
GenBinFile. Such .bin file could be downloaded into module just like the firmware upgrade, and can be

t
played back with the AT+QPLAYRES and AT+QPBGRES.

u
Q ide n
8.1.1. Advantages

There are three advantages of using audio bin to play audio:

f
 Do not occupy the space of file system.
 Audio Data can be saved to module conveniently

n
 It is able to play AMR file or wave file to the other side during the voice call

o
8.1.2. Procedure

C
The whole procedure of Audio Bin includes four steps:

Step1: Prepare audio resource. It supports the format of AMR and wav only now.
Step2: Use the tool of GenBinFile to pack the audio resource to a bin file
Step3: Use the tool of Firmware_Upgrade_Tool_Lite_GS2_V1.2 to download the bin file to the module
Step4: Use AT commands to play audio.

GSM_Audio_Player_Application_Note Confidential / Released 24 / 30


GSM Module Series
GSM Audio Player Application Note

t el
c l
Figure 2: Procedure

e ia
The figure above shows that it is needed to make audio bin file and download it to module before playing

u t
audio. Next chapters will describe the method for making and downloading bin file.

Q ide n
8.2. Make and Download Bin File

8.2.1. Make Bin File

n f
8.2.1.1. Prepare Audio Resource

o
Audio bin file is made from audio resource file. The format of audio file which is used to make bin file must
be AMR or WAV. And the tool of GenBinFile only supports the two formats. When audio resource is ready,

C
it must be put into the folder of “audio” at the same directory of GenBinFile tool. Refer to figure below.

Put audio resource in this folder.

Figure 3: Prepare Audio Resource File

8.2.1.2. Run GenBinFile

Double-click the icon of GenBinFile and open the interface of this tool. Refer to the figure below.

GSM_Audio_Player_Application_Note Confidential / Released 25 / 30


GSM Module Series
GSM Audio Player Application Note

Click this button to select audio resource.

t el Figure 4: Interface of GenBinFile

e c
8.2.1.3. Select Audio Resource

ia l
u n t
Click the “…” button and the dialog box window for choosing audio resource will be displayed. The default
directory showed in this window is the location of GenBinFile tool. Open “audio” folder and select one or

Q ide
more audio resource in the interface of dialog window. Refer to the figures below.

n f
Co
Open this folder to get audio resource.

Figure 5: Open the “Audio” Folder

GSM_Audio_Player_Application_Note Confidential / Released 26 / 30


GSM Module Series
GSM Audio Player Application Note

Open this folder to get audio resource.

t el
Figure 6: Select One or More Audio Resource

e c ia l
8.2.1.4. Change the Order of Audio Resource

u n t
Click “OK” button on the figure above. The tool will be back to the main interface. The audio resources are

Q ide
listed in the box. The audio resource has ranged automatically in an order in this list. The order of audio
resource can be changed by clicking “↑” or “↓” button on the right side of tool. Refer to the figure below.

n f
o
Change the order of resource with these

C
buttons if needed.

Figure 7: Change the Order of Resource

8.2.1.5. Generate the Bin and Scatter file

When the order of audio resource is fixed, it begins to generate the audio bin and scatter file. Just click
the “Generate” button on the figure above and the result of generating will be showed in a prompting
frame. Refer to the figure below.

GSM_Audio_Player_Application_Note Confidential / Released 27 / 30


GSM Module Series
GSM Audio Player Application Note

Figure 8: Prompt of Generating

The prompting frame shows the path of file which has generated successfully. It is going to have two files
to be generated: audio_res.bin which is the bin file used to be played and audioSequence.txt which just

l
shows the order of audio resource packed into bin file.

e
After the step of generating, audio bin file has been generated. The bin file is saved in the default folder at

t
the same directory of GenBinFile tool. Refer to the figure below.

e c ia l
u t
Audio bin and scat file are generated in “audio bin” folder.

n
1.
2. The text file of audioSequence is generated in the same directory of

Q ide
GenBinFile tool.

f
Figure 9: Generate the Audio Bin and Sequence File

n
Next, it is just needed to download it to the module and play.

o
8.2.2. Download Audio Bin File to Module

C
1. Connect the module and PC.
2. Open the tool of Firmware_Upgrade_Tool_Lite_GS2_V1.2.Configure the tool. Refer to the figure
below.

GSM_Audio_Player_Application_Note Confidential / Released 28 / 30


GSM Module Series
GSM Audio Player Application Note

t el
e c ia l Figure 10: Configure the Firmware

u n t
3. Select the port which is used to connect with module and select 460800 for the Baud Rate.
4. Click “Set Scat” button on the figure above to select the scat file to load the bin file. Scat file is in the

Q ide
same path of bin file. Refer to the figure below.

n f
Co
Figure 11: Select the Scat File

GSM_Audio_Player_Application_Note Confidential / Released 29 / 30


GSM Module Series
GSM Audio Player Application Note

5. After confirming the scat and audio bin file correctly, click “start” button and power on the module. The
firmware will show the progress bar as the figure below.

t el
e c ia l
u n t
Figure 12: Start to Download

Q ide
6. If it is successful to accomplish the downloading, the firmware will prompt as the figure below.

n f
Co
Figure 13: Finish Downloading

The figure above shows that it is successful to accomplish the downloading of audio bin file. And then,
close the Firmware tool and reboot module. It is able to play audio with AT commands now.

GSM_Audio_Player_Application_Note Confidential / Released 30 / 30

You might also like