CN113257288B - PCM audio sampling rate conversion method - Google Patents
PCM audio sampling rate conversion method Download PDFInfo
- Publication number
- CN113257288B CN113257288B CN202110473622.6A CN202110473622A CN113257288B CN 113257288 B CN113257288 B CN 113257288B CN 202110473622 A CN202110473622 A CN 202110473622A CN 113257288 B CN113257288 B CN 113257288B
- Authority
- CN
- China
- Prior art keywords
- point
- sampling
- points
- original
- pcm
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G11—INFORMATION STORAGE
- G11B—INFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
- G11B20/00—Signal processing not specific to the method of recording or reproducing; Circuits therefor
- G11B20/10—Digital recording or reproducing
- G11B20/10009—Improvement or modification of read or write signals
Landscapes
- Engineering & Computer Science (AREA)
- Signal Processing (AREA)
- Analogue/Digital Conversion (AREA)
Abstract
The invention relates to a conversion method of PCM audio sampling rate, which divides the PCM waveform into a plurality of segments by carrying out inflection point statistics on the original PCM waveform, regenerates sampling points in the segments according to the target sampling rate under the condition of keeping end points of the PCM waveform, and compensates the PCM waveform by the average value of the quantization levels of two target sampling points and a sampling point before the original sampling point during generation, so that the quantization levels of the generated target sampling points are more fit with the original waveform and can be converted randomly according to the target sampling rate; meanwhile, the end points are reserved, new end points are generated through specific functions or are directly connected, the original waveform is reserved when the sampling rate is converted as much as possible, the calculation formula is simple, and the overhead during conversion of the sampling rate can be effectively reduced.
Description
Technical Field
The invention relates to the technical field of audio processing, in particular to a conversion method of PCM audio sampling rate.
Background
Pulse Code Modulation (PCM) is to convert a continuous analog signal into a discrete digital signal, and transmit the discrete digital signal in a channel. Pulse code modulation is the process of sampling the analog signal, quantizing the amplitude of the sample and coding.
In most audio systems, conversion of the sampling rate is an extremely important loop. Sample rate conversion is the conversion of an input signal from one sample rate to another. In audio systems, the usual conversion is done at several specific sampling rates, i.e. some common audio sampling rates (8k, 11.025k,12k, 12.8k,16k,22.05k,24k,32k,44.1k, 48k) are converted to each other.
The common method is an interpolation algorithm, but the existing interpolation method has high cost when the sampling rate between non-integral multiples is converted.
Disclosure of Invention
It is therefore an object of the present invention to provide a method for converting a sampling rate of a PCM audio, which can solve the problems in the prior art.
The invention relates to a conversion method of PCM audio sampling rate, comprising the following steps:
(1) Restoring the audio digital signal into a PCM waveform on a two-dimensional coordinate formed by a time axis and a quantization level axis, and extracting the characteristics of the PCM waveform:
(1-1) counting sampling points of the PCM waveform from a zero point of a time axis, and extracting an inflection point;
(1-2) extracting segments between adjacent inflection points;
(2) Sample rate conversion was performed in each fragment:
(2-1) marking the coordinate Ti of each converted target sampling point on a time axis according to the converted sampling rate, and matching the coordinate Ti with the clip S n Carrying out quantitative series assignment on the target sampling points by the time axis coordinates of all the original sampling points in the tree structure, wherein the quantitative series assignment is carried out on the target sampling pointsWherein T is n And T n+1 Two adjacent original sampling points A which are nearest to the target sampling point n And A n+1 Time axis coordinate of (D), L n And L n+1 Is an original sampling point A n And A n+1 Quantized series axis coordinate of (2), L n-1 Is A n Adjacent A n-1 N is a natural number, and gamma is an offset;
(2-2) adjacent segments S n And S n+1 And (3) docking, if the original sampling rate is greater than the converted sampling rate, inserting one or more target sampling points between the end points of the fragments Sn and Sn +1, wherein the time axis coordinate pair of the target sampling points corresponds to Ti in the step (2-1), and when the original sampling rate is greater than the converted sampling rate, inserting the target sampling points between the end points of the fragments Sn and Sn +1, the time axis coordinate pair of the target sampling points corresponds to Ti in the step (2-1)The quantization level of the corresponding target sampling pointWhen the temperature is higher than the set temperatureThe quantization level of the corresponding target sampling pointWherein T is j And T k For adjacent segments S n And S n+1 Coordinates of the end points of the docking on the time axis, L j And L k For adjacent segments S n And S n+1 Coordinates of the end points of the butt joint on the axis of the quantization series, αIs an offset;
if the original sampling rate is less than the converted sampling rate, the butt joint is directly carried out;
(3) And removing original sampling points, and converting the converted PCM waveform into a digital signal.
Further, the step of corner statistics in the step (1-1) includes:
(1-1-1) taking 4 adjacent sampling points on the PCM waveform from the zero point, wherein the sampling points are respectively as follows: s1 (T1, L1), S2 (T2, L2), S3 (T3, L3) and S4 (T4, L4), the connecting line of S1 and S2 is: s12 (T, L) = (T2-T1) (L-L1) + (L1-L2) (T-T1),
(1-1-2) bringing S3 into S12, if S12 (T3, L3) <0, determining that S3 is inside the connecting line S12 (T, L), if S12 (T3, L3) > 0, determining that S3 is outside the connecting line S12 (T, L);
(1-1-3) then get the point S2 (T2, L2), S3 (T3, L3) get another connection equation S23 (T, L) = (T3-T2) (L-L2) + (L2-L3) (T-T2),
(1-1-4) calculating a function value S23 (T4, L4), and determining which side of the connecting line S23 the point S4 (T4, L4) is located on, if S12 (T3, L3) × S23 (T4, L4) <0, it can be found that the point S3 (T3, L3) is an inflection point, otherwise, the point S3 (T3, L3) is not an inflection point;
(1-1-5) repeating the calculation steps, and then judging whether the S3, the S4, the S5 and the Sn-1 are inflection points or not.
Further, when the original sampling point is removed in the step (3), the original audio digital is backed up.
Further, when the original sampling point is removed in the step (3), the original audio digital is backed up.
Further, the following steps: and (4) in the step (3), the PCM waveform is converted by binary system and then stored as a digital audio file.
Further, the starting point and the end point of the target sampling point both fall on the time axis.
The invention has the beneficial effects that: the invention relates to a conversion method of PCM audio sampling rate, which divides the PCM waveform into a plurality of segments by carrying out inflection point statistics on the original PCM waveform, regenerates sampling points in the segments according to a target sampling rate under the condition of keeping end points of the PCM waveform, and compensates the PCM waveform by the average value of the quantization levels of two target sampling points and a sampling point before the original sampling point during generation, so that the quantization levels of the generated target sampling points are more fit with the original waveform and can be converted randomly according to the target sampling rate; meanwhile, an end point is reserved, a new end point is generated through a specific function or is directly connected, the original waveform is reserved when the sampling rate is converted as much as possible, the calculation formula is simple, and the overhead of the conversion of the sampling rate can be effectively reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
FIG. 1 is a flow chart of the method of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
As shown in fig. 1: a method for converting a PCM audio sampling rate according to this embodiment includes the steps of:
(1) Restoring the audio digital signal into a PCM waveform on a two-dimensional coordinate formed by a time axis and a quantization level axis, and extracting the characteristics of the PCM waveform, wherein the time axis is a horizontal axis, and the quantization level axis is a vertical axis, so as to form two-dimensional coordinates:
(1-1) counting sampling points of the PCM waveform from a zero point of a time axis, and extracting an inflection point; the detailed steps of the inflection point statistics comprise;
(1-1-1) taking 4 adjacent sampling points on the PCM waveform from the zero point, wherein the sampling points are respectively as follows: s1 (T1, L1), S2 (T2, L2), S3 (T3, L3) and S4 (T4, L4), the connecting line of S1 and S2 is: s12 (T, L) = (T2-T1) (L-L1) + (L1-L2) (T-T1),
(1-1-2) bringing S3 into S12, if S12 (T3, L3) <0, determining that S3 is inside the connecting line S12 (T, L), if S12 (T3, L3) > 0, determining that S3 is outside the connecting line S12 (T, L);
(1-1-3) then get the point S2 (T2, L2), S3 (T3, L3) get another connection equation S23 (T, L) = (T3-T2) (L-L2) + (L2-L3) (T-T2),
(1-1-4) calculating a function value S23 (T4, L4), and determining which side of the connecting line S23 the point S4 (T4, L4) is located on, if S12 (T3, L3) × S23 (T4, L4) <0, it can be found that the point S3 (T3, L3) is an inflection point, otherwise, the point S3 (T3, L3) is not an inflection point;
(1-1-5) repeating the calculation steps, and judging whether the S3, the S4, the S5, the Sn-1 is an inflection point.
(1-2) after obtaining all the inflection points of the original PCM waveform, extracting the segments between adjacent inflection points to form a plurality of independent ascending or descending segments, and conveniently generating target sampling points in the segments, wherein the target sampling points are not sampling points generated when steps such as sampling, quantifying and the like are carried out on analog signals, but virtual sampling points are generated or formed in a conversion mode according to the sampling points of the existing digital audio files.
(2) And (3) carrying out sampling rate conversion in each individual segment, wherein multiple paths of synchronous conversion or asynchronous conversion can be selected according to the specific calculation force distribution condition of a computing device during conversion, and the specific conversion steps are as follows:
(2-1) marking the coordinate Ti of each converted target sampling point on a time axis according to the converted sampling rate, and matching the coordinate Ti with the clip S n Carrying out quantitative series assignment on the target sampling points by the time axis coordinates of all the original sampling points in the tree structure, wherein the quantitative series assignment is carried out on the target sampling pointsWherein T is n And T n+1 Two adjacent original sampling points A nearest to the target sampling point n And A n+1 Time axis coordinate of (D), L n And L n+1 Is an original sampling point A n And A n+1 Quantized series-axis coordinates of (1), L n-1 Is A n Adjacent A n-1 N is a natural number, and gamma is an offset; formula (II)Due to the projection of the target sampling point on the time axis in T n And T n+1 Thus passing throughThe closer a target sampling point is to T on the time axis n The closer its quantization level value is to the corresponding L n Similarly, the closer the target sampling point is to T on the time axis n+1 The closer its quantization level value is to the corresponding L n+1 At the same time, set up (L) n+1 +L n-1 -2L n ) X gamma part to original S n And S n+1 And S n And S n-1 The change rates of the former sub-segments are compared, the unevenness of the sub-segments is judged, the gamma is used for compensating the unevenness, and after debugging, the calculation amount can be reduced, and meanwhile, the PCM waveform formed by the target sampling points is closer to the original PCM waveform.
(2-2) adjacent fragments S n And S n+1 And (3) docking, if the original sampling rate is greater than the converted sampling rate, inserting one or more target sampling points between the end points of the fragments Sn and Sn +1, wherein the time axis coordinate pair of the target sampling points corresponds to Ti in the step (2-1), and when the original sampling rate is greater than the converted sampling rate, inserting one or more target sampling points between the end points of the fragments Sn and Sn +1, the time axis coordinate pair of the target sampling points corresponds to Ti in the step (2-1), and when the target sampling points are not in the conversion stateThe quantization series of the corresponding target sampling pointWhen in useThe quantization level of the corresponding target sampling pointWherein T is j And T k For adjacent segments S n And S n+1 Coordinates of the end points of the docking on the time axis, L j And L k For adjacent segments S n And S n+1 The coordinate of the butt joint end point on the quantization level axis, alpha is an offset, and the shape of the knee part of the PCM waveform is simulated by using a natural logarithm, whereinOrThe method is used for obtaining the slope of the curve and outputting the slope to be related to a result, and alpha further adjusts the quantization level value of the generated target sampling point so that the waveform of the inflection point part is closer to the original waveform;
if the original sampling rate is less than the converted sampling rate, the butt joint part does not need to be additionally provided with sampling points, and the butt joint is directly carried out;
(3) And removing original sampling points, and converting the converted PCM waveform into a digital signal.
The invention relates to a conversion method of PCM audio sampling rate, which divides the PCM waveform into a plurality of segments by carrying out inflection point statistics on the original PCM waveform, regenerates sampling points in the segments according to a target sampling rate under the condition of keeping end points of the PCM waveform, and compensates the PCM waveform by the average value of the quantization levels of two target sampling points and a sampling point before the original sampling point during generation, so that the quantization levels of the generated target sampling points are more fit with the original waveform and can be converted randomly according to the target sampling rate; meanwhile, an end point is reserved, a new end point is generated through a specific function or is directly connected, the original waveform is reserved when the sampling rate is converted as much as possible, the calculation formula is simple, and the overhead of the conversion of the sampling rate can be effectively reduced.
In this embodiment, when the original sampling point is removed in step (3), the original audio digital is backed up.
In this embodiment, when the original sampling point is removed in step (3), the original audio digital is copied and backed up, so as to prevent the original file from being lost.
In this embodiment, the PCM waveform in step (3) is converted into a binary signal and then stored as a digital audio file.
In the embodiment, the starting point and the end point of the target sampling point are both located on the time axis, so that the phenomena of sonic boom and the like are prevented.
Finally, the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all of them should be covered in the claims of the present invention.
Claims (4)
1. A method for PCM audio sample rate conversion, comprising: the method comprises the following steps:
(1) Restoring the audio digital signal into a PCM waveform on a two-dimensional coordinate formed by a time axis and a quantization level axis, and extracting the characteristics of the PCM waveform:
(1-1) counting sampling points of the PCM waveform from a zero point of a time axis, and extracting an inflection point;
(1-2) extracting segments between adjacent inflection points;
(2) Sample rate conversion was performed in each fragment:
(2-1) on the time axis according toMarking the coordinate Ti of each converted target sampling point by the converted sampling rate, and matching the coordinate Ti with the segment S n Performing quantitative series assignment on target sampling points by time axis coordinates of all original sampling points, wherein the quantitative series L i = Wherein T is n And T n+1 Two adjacent original sampling points A nearest to the target sampling point n And A n+1 Time axis coordinate of (D), L n And L n+1 Is an original sampling point A n And A n+1 Quantized series axis coordinate of (2), L n-1 Is A n Adjacent A n-1 The quantized series axis coordinates of (1), n is a natural number,is an offset;
(2-2) adjacent segments S n And S n+1 And (3) docking, if the original sampling rate is greater than the converted sampling rate, inserting one or more target sampling points between the end points of the fragments Sn and Sn +1, wherein the time axis coordinate pair of the target sampling points corresponds to Ti in the step (2-1), and when the original sampling rate is greater than the converted sampling rate, inserting the target sampling points between the end points of the fragments Sn and Sn +1, the time axis coordinate pair of the target sampling points corresponds to Ti in the step (2-1)The quantization level L of the corresponding target sampling point i =When is coming into contact withThe quantization level L of the corresponding target sampling point i =Wherein T is j And T k For adjacent segments S n And S n+1 Coordinates of the end points of the docking on the time axis, L j And L k For adjacent segments S n And S n+1 Coordinates of the butt joint end points on a quantization level number axis, wherein alpha is an offset;
if the original sampling rate is less than the converted sampling rate, the butt joint is directly carried out;
(3) Removing original sampling points, and converting the converted PCM waveform into a digital signal;
the step of corner statistics in the step (1-1) includes:
(1-1-1) taking 4 adjacent sampling points on the PCM waveform from the zero point, wherein the sampling points are respectively as follows: s1 (T1, L1), S2 (T2, L2), S3 (T3, L3) and S4 (T4, L4), the connecting line of S1 and S2 is: s12 (T, L) = (T2-T1) (L-L1) + (L1-L2) (T-T1),
(1-1-2) bringing S3 into S12, if S12 (T3, L3) <0, determining that S3 is inside the connecting line S12 (T, L), if S12 (T3, L3) > 0, determining that S3 is outside the connecting line S12 (T, L);
(1-1-3) then get the point S2 (T2, L2), S3 (T3, L3) get another connection equation S23 (T, L) = (T3-T2) (L-L2) + (L2-L3) (T-T2),
(1-1-4) calculating a function value S23 (T4, L4), and determining which side of the connecting line S23 the point S4 (T4, L4) is located on, if S12 (T3, L3) × S23 (T4, L4) <0, it can be determined that the point S3 (T3, L3) is an inflection point, otherwise, the point S3 (T3, L3) is not an inflection point;
(1-1-5) repeating the calculation steps, and judging whether the S3, the S4, the S5, the Sn-1 is an inflection point.
2. The method of claim 1, wherein the method of converting the PCM audio sample rate comprises: and (4) when the original sampling point is removed in the step (3), carrying out backup processing on the original audio digital signal.
3. The method of claim 1, wherein the method of converting the PCM audio sample rate comprises: and (4) in the step (3), the PCM waveform is converted by binary system and then stored as a digital audio file.
4. The method of claim 1, wherein the method of converting the PCM audio sample rate comprises: and the starting point and the end point of the target sampling point are both positioned on the time axis.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110473622.6A CN113257288B (en) | 2021-04-29 | 2021-04-29 | PCM audio sampling rate conversion method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110473622.6A CN113257288B (en) | 2021-04-29 | 2021-04-29 | PCM audio sampling rate conversion method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113257288A CN113257288A (en) | 2021-08-13 |
CN113257288B true CN113257288B (en) | 2022-12-16 |
Family
ID=77223486
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110473622.6A Active CN113257288B (en) | 2021-04-29 | 2021-04-29 | PCM audio sampling rate conversion method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113257288B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115811682B (en) * | 2023-02-09 | 2023-05-12 | 杭州兆华电子股份有限公司 | Loudspeaker distortion analysis method and device based on time domain signals |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1963744A (en) * | 2006-12-13 | 2007-05-16 | 北京中星微电子有限公司 | Self adapting method of sampling frequency of audio frequency interface |
CN103077723A (en) * | 2013-01-04 | 2013-05-01 | 鸿富锦精密工业(深圳)有限公司 | Audio transmission system |
CN104952452A (en) * | 2015-04-27 | 2015-09-30 | 无锡天脉聚源传媒科技有限公司 | PCM audio sampling rate conversion method and device |
CN109886877A (en) * | 2019-02-27 | 2019-06-14 | 同济汽车设计研究院有限公司 | A kind of method of destination fitting and the splicing of segmentation course line |
CN111724824A (en) * | 2020-06-11 | 2020-09-29 | 北京凯视达信息技术有限公司 | Audio storage and retrieval method |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR100668299B1 (en) * | 2004-05-12 | 2007-01-12 | 삼성전자주식회사 | Digital signal encoding/decoding method and apparatus through linear quantizing in each section |
CN101409094B (en) * | 2008-10-30 | 2010-10-13 | 炬力集成电路设计有限公司 | Method for eliminating sound effect switching noise and audio play equipment |
-
2021
- 2021-04-29 CN CN202110473622.6A patent/CN113257288B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1963744A (en) * | 2006-12-13 | 2007-05-16 | 北京中星微电子有限公司 | Self adapting method of sampling frequency of audio frequency interface |
CN103077723A (en) * | 2013-01-04 | 2013-05-01 | 鸿富锦精密工业(深圳)有限公司 | Audio transmission system |
CN104952452A (en) * | 2015-04-27 | 2015-09-30 | 无锡天脉聚源传媒科技有限公司 | PCM audio sampling rate conversion method and device |
CN109886877A (en) * | 2019-02-27 | 2019-06-14 | 同济汽车设计研究院有限公司 | A kind of method of destination fitting and the splicing of segmentation course line |
CN111724824A (en) * | 2020-06-11 | 2020-09-29 | 北京凯视达信息技术有限公司 | Audio storage and retrieval method |
Also Published As
Publication number | Publication date |
---|---|
CN113257288A (en) | 2021-08-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Temme | Uniform asymptotic expansions of the incomplete gamma functions and the incomplete beta function | |
US5463701A (en) | System and method for pattern-matching with error control for image and video compression | |
CN86100787A (en) | Utilize the error detection occurs of prediction signal value and hidden | |
CN113257288B (en) | PCM audio sampling rate conversion method | |
CN109525500A (en) | A kind of information processing method and information processing unit of self-adjusting threshold value | |
CN107623728B (en) | FC-AE-ASM data universal analysis method based on product interface control file | |
CN112506880B (en) | Data processing method and related equipment | |
CN111325096B (en) | Live stream sampling method and device and electronic equipment | |
CN110198171B (en) | Data compression method and device, computer readable medium and electronic equipment | |
KR920700496A (en) | Vector Quantizer Codebook Processing Circuit | |
KR980003999A (en) | Histogram equalization circuit based on CDF computation domain and its method | |
KR930015376A (en) | Waveform encoding / decoding apparatus and method | |
KR970702663A (en) | A multiplexer system using constant bit rate encoders | |
CN1768480B (en) | Encoding device and method, decoding device and method | |
CN109873346B (en) | DC power transmission common grounding electrode system maintenance method and device | |
JP3179588B2 (en) | Data encoding apparatus and method | |
CN110909085A (en) | Data processing method, device, equipment and storage medium | |
RU2720382C1 (en) | Apparatus for determining values of characteristics of availability of article for use | |
CN110175185B (en) | Self-adaptive lossless compression method based on time sequence data distribution characteristics | |
US20070041453A1 (en) | Signal Processing Apparatus, Program Product and Method Therefor | |
CN107562562B (en) | Method and system for setting extra information describing fault event | |
CN104484376A (en) | Method and device for displaying data in realtime | |
CN111767984A (en) | 8-bit integer full-quantization inference method and device based on fixed displacement | |
CN110875744B (en) | Coding method and device | |
JPH07320056A (en) | Vector image encoding device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |