The content of the invention
The technical problem to be solved in the present invention is, in view of the shortcomings of the prior art, there is provided one kind is based on DSP to TDM sides
The method and terminal of voice document are played, to solve to need additional fpga chip in existing method, adds terminal device
Production cost the problem of.
In order to solve the above-mentioned technical problem, the technical solution adopted in the present invention is as follows:
A kind of method for playing voice document to TDM sides based on DSP, it includes:
The first packet that DSP passages carry is obtained at interval of preset time, and replaces described the using default speech data
One packet is to generate the second packet;
The source address of the DSP passages and destination address are exchanged, and second packet is configured at the DSP passages,
So that second packet is sent to media sheet processor;
Second packet is sent to the time slot of TDM buses by the media sheet processor, by the voice number
According to broadcasting to TDM sides.
The method for playing voice document to TDM sides based on DSP, wherein, it is described to lead at interval of preset time acquisition DSP
The first packet that road carries, and use default speech data replacement first packet with before generating the second packet
Including:
Voice document to be sent in flash memory is obtained, and institute's voice file is stored in internal memory.
The method for playing voice document to TDM sides based on DSP, wherein, it is described to lead at interval of preset time acquisition DSP
The first packet that road carries, and it is specific to generate the second packet to use default speech data to replace first packet
Including:
The first packet of DSP passages carrying is obtained at interval of preset time, wherein, first packet is RTP forms;
The first byte of first packet is obtained, and the voice number of corresponding first byte is chosen from institute's voice file
According to;
The speech data is used to replace the data in first packet to generate the second packet.
The method for playing voice document to TDM sides based on DSP, wherein, it is described to obtain the of first packet
One byte, and the speech data for choosing from institute's voice file corresponding first byte specifically includes:
The first byte of first packet is obtained, and obtains the pointer position of institute's voice file;
The speech data of first byte is chosen since the pointer position, and the pointer position is offset into institute to last position
State the first byte position.
The method for playing voice document to TDM sides based on DSP, wherein, it is described to be chosen since the pointer position
The speech data of first byte, and the pointer position is offset into the first byte position to last position and specifically included:
The last position of institute's voice file is obtained, and calculates the second byte of the pointer position and the last bit interval;
By second byte compared with the first byte;
If second byte is more than or equal to first byte, first byte is chosen since the pointer position
Speech data, and the pointer position is offset into the first byte position to last position;
If second byte is less than first byte, the first speech data between pointer position and last position is chosen, and
The first speech data described in quiet data polishing is used to be offset to the end to last position to obtain speech data, and by pointer position
Position.
The method for playing voice document to TDM sides based on DSP, wherein, it is described to be chosen since the pointer position
The speech data of first byte, and also include after the pointer position is offset into the first byte position to last position:
Judge whether the pointer position is in the last position of institute's voice file, and at which when last position, close the DSP and lead to
Road.
The method for playing voice document to TDM sides based on DSP, wherein, it is described to lead at interval of preset time acquisition DSP
The first packet that road carries, and it is specific to generate the second packet to use default speech data to replace first packet
Including:
The first packet of DSP passages carrying is obtained at interval of preset time, and when receiving the first packet described in detection
The voice document mark that DSP passages carry;
When institute's voice file is identified as default mark, default speech data is used to replace first packet to generate
Second data.
It is described based on DSP to TDM sides play voice document method, wherein, the source address by the DSP passages with
Destination address is exchanged, and second packet is configured at into the DSP passages, is also included afterwards with playing voice to TDM sides:
The source address and destination address of the DSP passages are reduced, and data are obtained from TDM buses at interval of preset time;
The data are compiled to generate the first packet, and first packet is sent by the DSP passages.
A kind of storage medium, it is stored with a plurality of instruction, and the instruction is suitable to be loaded by processor and performed as described above
The method for playing voice document to TDM sides based on DSP.
A kind of terminal, it includes:
Processor, it is adapted for carrying out each instruction;And
Storage device, suitable for storing a plurality of instruction, the instruction be suitable to load by processor and performed it is as above any described in be based on
The method that DSP plays voice document to TDM sides.
Beneficial effect:Compared with prior art, voice document is played to TDM sides based on DSP the invention provides a kind of
Method and terminal, methods described between media sheet processor and mainboard processor by establishing a DSP passages, mainboard processor
The first packet of DSP passages transmission is received at interval of preset time, and using default speech data displacement described ground data
Data in bag obtain the second packet, the source address and destination address of DSP passages are being exchanged afterwards, to lead to by the DSP
Road sends second packet to media plate processing, is sent second packet to TDM by media sheet processor
On the time slot of bus, so as to which the speech data for carrying second packet is played to TDM.The present embodiment is only by mainboard
Established between processor and media plate processing with DSP passages, be achieved that and think that TDM sides play voice, without installing fpga chip,
Cost is saved.Meanwhile also do not limited by the internal memory for being used for storaged voice file inside DSP, improve speech play into
Power.
Embodiment
The present invention provides a kind of method and terminal for playing voice document to TDM sides based on DSP, to make the mesh of the present invention
, technical scheme and effect it is clearer, clear and definite, the present invention is described in more detail for the embodiment that develops simultaneously referring to the drawings.
It should be appreciated that specific embodiment described herein is not intended to limit the present invention only to explain the present invention.
Those skilled in the art of the present technique are appreciated that unless expressly stated, singulative " one " used herein, " one
It is individual ", " described " and "the" may also comprise plural form.It is to be further understood that what is used in the specification of the present invention arranges
Diction " comprising " refer to the feature, integer, step, operation, element and/or component be present, but it is not excluded that in the presence of or addition
One or more other features, integer, step, operation, element, component and/or their groups.It should be understood that when we claim member
Part is " connected " or during " coupled " to another element, and it can be directly connected or coupled to other elements, or there may also be
Intermediary element.In addition, " connection " used herein or " coupling " can include wireless connection or wireless coupling.It is used herein to arrange
Taking leave "and/or" includes whole or any cell and all combinations of one or more associated list items.
Those skilled in the art of the present technique are appreciated that unless otherwise defined, all terms used herein (including technology art
Language and scientific terminology), there is the general understanding identical meaning with the those of ordinary skill in art of the present invention.Should also
Understand, those terms defined in such as general dictionary, it should be understood that have with the context of prior art
The consistent meaning of meaning, and unless by specific definitions as here, idealization or the implication of overly formal otherwise will not be used
To explain.
Below in conjunction with the accompanying drawings, by the description to embodiment, the content of the invention is described further.
Fig. 1 is refer to, Fig. 1 is the preferable implementation of the method provided by the invention for playing voice document to TDM sides based on DSP
The flow chart of example.Methods described includes:
S100, the first packet that DSP passages carry is obtained at interval of preset time, and institute is replaced using default speech data
The first packet is stated to generate the second packet;
S200, the source address of the DSP passages and destination address exchanged, and second packet is configured at the DSP
Passage, second packet is sent to media sheet processor;
S300, by the media sheet processor second packet is sent to the time slot of TDM buses, by institute's predicate
Sound data playback is to TDM sides.
A kind of method for playing voice document to TDM sides based on DSP is present embodiments provided, it in media plate by handling
A DSP passages are established between device and mainboard processor, mainboard processor receives the first of DSP passages transmission at interval of preset time
Packet, and the second packet is obtained using the data in default speech data displacement described ground packet, exchanging afterwards
The source address and destination address of DSP passages, so that second packet is sent to media plate processing by the DSP passages,
Second packet is sent to the time slot of TDM buses by media sheet processor, so as to which second packet be taken
The speech data of band is played to TDM.The present embodiment is only led to by being established between mainboard processor and media plate processing with DSP
Road, it is achieved that and thinks that TDM sides play voice, without installing fpga chip, saved cost.Meanwhile also it is not used for by DSP inside
The limitation of the internal memory of storaged voice file, improve the success rate of speech play.
Specifically, in the step S100, the DSP passages are between media sheet processor and mainboard processor
Passage, the source addresses of the DSP passages is the MAC Address of media plate, and destination address is the MAC Address of main sheet processor, and
And the source address and destination address just configure completion in the DSP Path Setups.Accordingly, it is described at interval of it is default when
Between obtain the first packet that DSP passages carry obtains that DSP passages carry for main sheet processor at interval of preset time first
Packet.
First packet is that media plate processing is sent by DSP passages to mainboard processor, and it is the matchmaker
The data that body sheet processor obtains from the time slot of TDM buses, and obtained after compiling.Accordingly, the step S100
It can include before:
S10, when receive to TDM sides play voice document instruction when, establish between mainboard processor and media sheet processor
DSP passages;
S20, read data from the time slot of TDM buses by media sheet processor, and the data to reading be compiled with
Obtain the first packet of RPT forms;
S30, first packet is sent to mainboard processor by DSP.
Specifically, the compiling RTP formatted files are encoded using PCMA, and its code check is the RTP packings of 64Kbps and configuration
Shi Changwei 20ms.That is, carrying out PCMA codings to the data that media sheet processor is read needs 20ms, i.e., it is most fast per 20ms
Generate the first packet of a RTP form.Accordingly, mainboard processor can receive a DSP passage at interval of 20ms and take
First packet of band, also, the media sheet processor is also at interval of 20ms to sending one second on the time slot of TDM buses
Packet, and carry out data interaction with TDM buses when sending the second packet and be used to be compiled as the first data to read one
The data of bag, it is achieved thereby that DSP passages send first packet to mainboard processor at interval of 20ms.
Further, the speech data is the voice to be played to TDM sides being pre-stored within mainboard processor memory
The content of file.And in actual applications, voice document is stored with mainboard processor can take the content of mainboard processor, and
Mainboard processor memory is influenceed in order to avoid voice document plays, voice document flash memory can be stored in, work as needs
When voice document is played to TDM sides, voice document is being read from flash memory.Accordingly, it is described at interval of preset time
The first packet that DSP passages carry is obtained, and uses default speech data to replace first packet to generate second
Include before packet:
S01, voice document to be sent in flash memory is obtained, and institute's voice file is stored in internal memory.
Specifically, mainboard processor accesses flash memory by system bus, and reads in the flash storages and treat
Send to the voice document of TDM sides, and institute's voice file is cached in the internal memory of mainboard processor, treat that institute's voice file is broadcast
After putting, it is deleted from the internal memory of mainboard processor, in order to avoid take mainboard processor memory.
Further, because second packet is that the content in the second packet is replaced using speech data, so as to institute
It is identical with the byte needs of the second packet to state the byte of the second packet, so as to be needed during the second packet is generated
The byte of the first packet is obtained, and the speech data of respective byte is chosen according to the byte, to generate second number
According to bag.
Exemplary, first packet that the carrying of DSP passages is obtained at interval of preset time, and use default language
Sound data are replaced first packet and specifically included with generating the second packet:
S101, the first packet that DSP passages carry is obtained at interval of preset time, wherein, first packet is RTP lattice
Formula;
S102, the first byte for obtaining first packet, and choose from institute's voice file the language of corresponding first byte
Sound data;
S103, the speech data is used to replace the data in first packet to generate the second packet.
Specifically, first packet is by the packet of the RTP forms of PCMA coding generations, first data
The payload of bag is 160 bytes, wherein, a byte number is 64*1000/8=8000byte/s, and 20 byte number is 8000*20/
1000=160 bytes.Accordingly, second packet is also 160 bytes.
Further, due in mainboard processor from flash memory obtain voice document byte possibly more than 160 words
Section, so as to need to choose the speech data of 160 bytes in voice document every time, to generate the second packet.In this embodiment,
The selection of the speech data chooses 160 words successively backward using the pointer position of voice document as starting point, from the starting point
Section, and pointer position is offset into 160 bytes.
Exemplary, first byte for obtaining first packet, and chosen accordingly from institute's voice file
The speech data of first byte number specifically includes:
S1021, the first byte for obtaining first packet, and obtain the pointer position of institute's voice file;
S1022, the speech data for choosing since the pointer position first byte, and by the pointer position to last position
Offset the first byte position.
Specifically, need to judge the finger before the speech data of first byte is chosen since the pointer position
Whether the byte of the data between pin position and voice document end position is more than the first byte, because only that in pointer position and voice
When the byte of data between last of file position is more than the first byte, the speech data to the first byte could be chosen.Accordingly, institute
The speech data that first byte is chosen since the pointer position is stated, and by described in the pointer position to last position skew
First byte position specifically includes:
H10, the last position for obtaining institute's voice file, and calculate the second byte of the pointer position and the last bit interval;
H20, by second byte compared with the first byte;
If H30, second byte are more than or equal to first byte, first word is chosen since the pointer position
The speech data of section, and the pointer position is offset into the first byte position to last position;
If H40, second byte are less than first byte, the first voice number between pointer position and last position is chosen
According to, and use the first speech data described in quiet data polishing to be offset to obtain speech data, and by pointer position to last position
The last position.
Specifically, it is described to refer to the second byte subtracting the first word using the first speech data described in quiet data polishing
, so both can be with so as to obtain the first speech data of the first byte after the quiet data of section replenishes the speech data of selection
The data that will be replaced using the first speech data of quiet data polishing in the first packet, can cause TDM sides not connect again
To other speech plays outside voice document.
In one embodiment of this law invention, the voice that first byte is chosen since the pointer position
Data, and also include after the pointer position is offset into the first byte position to last position:
Judge whether the pointer position is in the last position of institute's voice file, and at which when last position, close the DSP and lead to
Road.
Specifically, it is described to judge whether the last position in institute's voice file is to judge the voice text to the pointer position
Whether part finishes.In actual applications, can be sentenced according to the length of voice document and the position skew of voice document pointer
Whether disconnected file finishes, and is turned off the DSP passages to upper-layer service with regard to reporting message if finishing, does not finish
Wait for next RTP bags.
Further, because the DSP passages on media plate have two kinds of mode of operations, respectively speech pattern and voice document
Play mode, and can be that the DSP passages incidentally play voice text when needing broadcasting voice document and opening DSP passages
The voice document mark of part.Institute's voice file is identified as software parameter, for example, the software parameter is 0 expression speech pattern,
Voice document play mode is represented for 1.Accordingly, first packet that the carrying of DSP passages is obtained at interval of preset time,
And use default speech data to replace first packet and specifically included with generating the second packet:
S101a, the first packet that DSP passages carry is obtained at interval of preset time, and examined when receiving the first packet
Survey the voice document mark that the DSP passages carry;
S102a, when institute's voice file is identified as default mark, use default speech data to replace the packet with life
Into the second data.
Specifically, when mainboard processor receives RTP bags, check that the voice document of DSP passages is identified whether as voice
The mark of file play mode, if playing voice document play mode, taken since voice document pointer in 160 bytes
Hold to replace the payload of 160 bytes in RTP bags, generate the second packet, second packet is also RTP forms.
Further, in the step S200, the source address by DSP passages refers to obtaining with destination address exchange
The source address and destination address that DSP passages carry, and source address is changed to destination address, by destination address with being changed to source
Location, to cause the direction of the DSP channel transfers file is transmitted from source address to destination address to be changed into from destination address to source
Address is transmitted, and is sent the second packet to media plate with realizing.In the present embodiment, by source address with destination address to being changed to
Source address is changed to mainboard processor address, destination address is changed to media plate processor address, so passes through DSP passage mesh
The exchange of address and source address is marked, realizes the transmitted in both directions of DSP passages.
Further, it is described to send the second packet to the time slot of TDM buses in the step S300, to pass through
The TDM buses play second packet to TDM sides.And in actual applications, when media sheet processor counts second
When sending according to bag to the time slot of TDM buses, acquisition and the second data packet byte identical data from the time slot of TDM buses,
And the data of acquisition are compiled to obtain the first packet, it is achieved thereby that between mainboard processor and media sheet processor
Data are back and forth sent, so as to transmit the voice document of different length by the DSP passages, and by institute's voice file
Play to TDM sides.
Further, since when the second packet is sent to media sheet processor, source address and destination address are exchanged, that
Obtain and generate after the first packet, it is necessary to the destination address of DSP passages and source address are reduced in media version processor, with
The first packet is sent to mainboard processor by the DSP passages.Accordingly, the source address by the DSP passages
Exchanged with destination address, and second packet is configured at the DSP passages, also wrapped afterwards with playing voice to TDM sides
Include:
S400, the reduction DSP passages source address and destination address, and obtain number from TDM buses at interval of preset time
According to;
S500, the compiling data send first packet to generate the first packet by the DSP passages.
Specifically, the preset time is identical with the interval time of mainboard processor the first packet of reception, for example, being
20ms。
Present invention also offers a kind of storage medium, and it is stored with a plurality of instruction, and the instruction is suitable to be loaded by processor
And perform as above any method for playing voice document to TDM sides based on DSP.
Present invention also offers a kind of terminal, as shown in Fig. 2 it includes at least one processor(processor)20 with
And memory(memory)22, display screen 21, communication interface can also be included(Communications Interface)23 Hes
Bus 24.Wherein, processor 20, display screen 21, memory 22 and communication interface 23 can be completed mutual by bus 24
Communication.Display screen 21 is arranged to show that default user guides interface in initial setting mode.Communication interface 23 can transmit letter
Breath.Processor 20 can call the logical order in memory 22, to perform the method in above-described embodiment.
In addition, the logical order in above-mentioned memory 22 can be realized by the form of SFU software functional unit and is used as solely
Vertical production marketing in use, can be stored in a computer read/write memory medium.
Memory 22 is used as a kind of computer-readable recording medium, may be configured as storage software program, computer can perform
Program, programmed instruction or module as corresponding to the method in the embodiment of the present disclosure.Processor 30 is stored in memory by operation
Software program, instruction or module in 22, so as to perform function application and data processing, that is, realize the side in above-described embodiment
Method.
Memory 22 may include storing program area and storage data field, wherein, storing program area can storage program area, extremely
Application program needed for few One function;Storage data field can store uses created data etc. according to terminal device.This
Outside, memory 22 can include high-speed random access memory, can also include nonvolatile memory.For example, USB flash disk, movement
Hard disk, read-only storage (Read-Only Memory, ROM), random access memory (Random Access Memory,
RAM), magnetic disc or CD etc. are a variety of can be with the medium or transitory memory medium of store program codes.
In addition, the detailed process that a plurality of instruction processing unit in above-mentioned storage medium and terminal is loaded and performed is above-mentioned
It has been described in detail in method, has just no longer stated one by one herein.
Finally it should be noted that:The above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although
The present invention is described in detail with reference to the foregoing embodiments, it will be understood by those within the art that:It still may be used
To be modified to the technical scheme described in foregoing embodiments, or equivalent substitution is carried out to which part technical characteristic;
And these modification or replace, do not make appropriate technical solution essence depart from various embodiments of the present invention technical scheme spirit and
Scope.