CN110956970B - Audio resampling method, device, equipment and storage medium - Google Patents

Audio resampling method, device, equipment and storage medium Download PDF

Info

Publication number
CN110956970B
CN110956970B CN201911182538.8A CN201911182538A CN110956970B CN 110956970 B CN110956970 B CN 110956970B CN 201911182538 A CN201911182538 A CN 201911182538A CN 110956970 B CN110956970 B CN 110956970B
Authority
CN
China
Prior art keywords
value
target
length
filter coefficient
current
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
Application number
CN201911182538.8A
Other languages
Chinese (zh)
Other versions
CN110956970A (en
Inventor
张康
张帆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Baiguoyuan Information Technology Co Ltd
Original Assignee
Guangzhou Baiguoyuan Information Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangzhou Baiguoyuan Information Technology Co Ltd filed Critical Guangzhou Baiguoyuan Information Technology Co Ltd
Priority to CN201911182538.8A priority Critical patent/CN110956970B/en
Publication of CN110956970A publication Critical patent/CN110956970A/en
Application granted granted Critical
Publication of CN110956970B publication Critical patent/CN110956970B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING
    • G10L21/00Speech or voice signal processing techniques to produce another audible or non-audible signal, e.g. visual or tactile, in order to modify its quality or its intelligibility
    • G10L21/003Changing voice quality, e.g. pitch or formants
    • G10L21/007Changing voice quality, e.g. pitch or formants characterised by the process used

Landscapes

  • Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Computational Linguistics (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • Acoustics & Sound (AREA)
  • Multimedia (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention discloses an audio resampling method, an audio resampling device, audio resampling equipment and a storage medium, wherein the audio resampling method comprises the following steps: intercepting audio data at a current sampling rate to obtain audio data to be resampled, wherein the audio data comprises a first number of sampling points; filtering each sampling point according to the target sampling rate to be resampled and a pre-stored target filtering coefficient table to obtain resampled audio data containing a second number of resampling points; the target filter coefficient contained in the target filter coefficient table is obtained through interpolation processing of the reference filter coefficient in a preset reference filter coefficient table, the target table length of the target filter coefficient is larger than the reference table length, and the reference table length of the reference filter coefficient table is associated with a preset over-sampling value and a preset filter length value. Compared with the prior art, the method better saves the determination time of the target filtering coefficient table for resampling processing, reduces the overall time consumption of audio resampling processing, and shortens the response waiting time of the audio application with audio resampling after triggering.

Description

Audio resampling method, device, equipment and storage medium
Technical Field
The present invention relates to the field of audio processing technologies, and in particular, to an audio resampling method, apparatus, device, and storage medium.
Background
Speex is an open source free project mainly aiming at voice, and is widely adopted in voice projects at present, and a resampling module in the project is used as a common means for switching sampling rates, so that a large number of applications are provided in audio application products, and a bottom technical support is provided for various function realization in the audio application products.
In audio applications, such as recording, playing, and sound changing, all involve the conversion of sampling rate, and may be implemented by adopting a resampling module in Speex, however, when the resampling process is performed on audio data based on the Speex existing resampling module, in the existing resampling implementation, a filter coefficient table required by the resampling process needs to be determined at the filter coefficient initialization stage first, but the determination of each filter coefficient in the filter coefficient table needs a large amount of repeated computation, which takes a long time, so that the power consumption and resource occupation of the resampling execution carrier device are increased, and the response waiting time after the triggering of the audio application is also prolonged.
Disclosure of Invention
The embodiment of the invention provides an audio resampling method, an audio resampling device, audio resampling equipment and a storage medium, which effectively shorten the processing time of audio resampling and reduce the power consumption and resource occupation of carrier executing equipment.
In a first aspect, an embodiment of the present invention provides an audio resampling method, including:
intercepting audio data at a current sampling rate to obtain audio data to be resampled, wherein the audio data comprises a first number of sampling points;
filtering each sampling point according to a target sampling rate to be resampled and a pre-stored target filtering coefficient table to obtain resampled audio data containing a second number of resampling points;
the target filter coefficients included in the target filter coefficient table are obtained through interpolation processing of reference filter coefficients in a preset reference filter coefficient table, the target table length of the target filter coefficients is larger than the reference table length, and the reference table length of the reference filter coefficient table is associated with a preset over-sampling value and a preset filter length value.
In a second aspect, an embodiment of the present invention provides an audio resampling apparatus, including:
the sampling point acquisition module is used for intercepting the audio data at the current sampling rate to acquire the audio data to be resampled, wherein the audio data comprises a first number of sampling points;
the resampling processing module is used for carrying out filtering processing on each sampling point according to a target sampling rate to be resampled and a pre-stored target filtering coefficient table to obtain resampled audio data containing a second number of resampling points;
The target filter coefficients included in the target filter coefficient table are obtained through interpolation processing of reference filter coefficients in a preset reference filter coefficient table, the target table length of the target filter coefficients is larger than the reference table length, and the reference table length of the reference filter coefficient table is associated with a preset over-sampling value and a preset filter length value.
In a third aspect, an embodiment of the present invention provides an audio resampling apparatus, including:
one or more processors;
a storage means for storing one or more programs;
the one or more programs are executed by the one or more processors to cause the one or more processors to implement the methods provided by the above-described embodiments of the present invention.
In a fourth aspect, an embodiment of the present invention provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method provided by the above embodiment of the present invention.
The embodiment of the invention provides an audio resampling method, an audio resampling device, audio resampling equipment and a storage medium, wherein the audio resampling method comprises the following steps: intercepting audio data at a current sampling rate to obtain audio data to be resampled, wherein the audio data comprises a first number of sampling points; and filtering the sampling points according to a target sampling rate to be resampled and a pre-stored target filtering coefficient table to obtain resampled audio data containing a second number of resampled points, wherein the target filtering coefficients contained in the target filtering coefficient table are obtained through interpolation processing of reference filtering coefficients in a pre-determined reference filtering coefficient table, the target table length of the target filtering coefficients is larger than the reference table length, and the reference table length of the reference filtering coefficient table is associated with a preset over-sampling value and a preset filtering length value. According to the technical scheme, the target filter coefficient table for resampling is mainly formed by interpolation processing on the basis of the reference filter coefficient table, and compared with the existing method for obtaining the target filter coefficient table by complex and repeated calculation, the method has the advantages that the determination time of the target filter coefficient table for resampling is better saved, the overall time consumption of audio resampling is reduced, the power consumption and the resource occupation of carrier equipment for executing the audio resampling are reduced, and the response waiting time of audio application with audio resampling after triggering is shortened.
Drawings
Fig. 1 is a flowchart of an audio resampling method according to a first embodiment of the present invention;
FIG. 2 is a diagram showing an example of a flow for determining the reference filter coefficient table in the first embodiment of the present invention;
FIG. 3 is a diagram showing an example of a process of determining a target filter coefficient table according to the first embodiment of the present invention;
FIG. 4 is a flowchart showing the implementation of sorting the target filter coefficients in the target filter coefficient table according to the first embodiment of the present invention;
FIG. 5 is a flowchart of the implementation of resampling sampling points to obtain resampled audio data according to the first embodiment of the invention;
fig. 6 is a block diagram of an audio resampling apparatus according to a second embodiment of the present invention;
fig. 7 is a schematic hardware structure of an audio resampling apparatus according to a third embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following detailed description of the embodiments of the present invention will be given with reference to the accompanying drawings. It should be understood that the described embodiments are merely some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention. In addition, the embodiments of the present invention and features of the embodiments may be combined with each other without conflict, and the embodiments may be referred to and cited with each other.
It should be noted that, in the application scenario of the embodiment of the present invention in the field of audio processing related to audio resampling, the application scenario is applicable to the case of resampling audio data to be resampled in audio application based on a resampling module in Speex, it can be known that the key of implementing resampling by an existing resampling module in Speex is to initialize a filter coefficient, and resampling the audio data according to a filter coefficient table formed after initialization, where the existing resampling module has the following problems: taking the common sampling rate as a sampling rate changed from 16KHZ to 44.1KHZ as an example, when the resampled filter quality value (divided into 10 quality grades 0-9 by default) is set to 3, the number of filter coefficients to be initialized is up to 21168, and the sing function and the cubic spline interpolation calculation are needed when each filter coefficient is determined, if all filter coefficients are determined to be equivalent to the need of 21168 sing functions and the cubic spline interpolation calculation, the method is an extremely low-efficiency operation, the operation is reflected in that the power consumption and the resources of the device are excessively occupied due to the influence on the aspect of the carrier device, the response time after the triggering of the audio application is prolonged due to the influence on the aspect of the audio application, and the use experience of a user is reduced.
According to the audio resampling method provided by the embodiment of the invention, the target filter coefficient table for resampling processing is directly obtained through interpolation processing on the basis of a predetermined reference filter coefficient table, so that the problem that a large number of repeated calculations are needed in the existing implementation is effectively avoided, the processing time of audio resampling is effectively shortened, and the power consumption and resource occupation of the execution carrier equipment are reduced.
Example 1
Fig. 1 is a schematic flow chart of an audio resampling method according to a first embodiment of the present invention, where the method may be implemented by an audio resampling apparatus, where the apparatus may be implemented by software and/or hardware and may be generally integrated in an audio resampling device, where the audio resampling device is equivalent to a carrier device for performing the audio resampling method, and may specifically be a terminal device with an audio application function.
As shown in fig. 1, a method for resampling audio according to a first embodiment of the present invention specifically includes the following operations:
it should be noted that, the audio resampling method provided in this embodiment may be considered to be that when the user starts a certain audio application and triggers a certain function application in the audio application operation process, the following steps are started when the resampling process is needed.
S101, intercepting the audio data at the current sampling rate to obtain the audio data to be resampled, wherein the audio data contain a first number of sampling points.
In this embodiment, the current sampling rate may be understood as a sampling rate used when the currently running audio application samples audio data, the current sampling rate may be directly obtained from the running audio application, and the audio data may also be understood as an audio signal associated in the running audio application. When the resampling process is involved in the audio application, the audio data is firstly intercepted at the current sampling rate, so as to obtain the audio data to be resampled, wherein when the audio data is intercepted at the current sampling rate, the number of sampling points contained in the formed audio data to be resampled is constant, for example, when the current sampling rate is 16KHZ, the frame length of a frame of audio data to be resampled, which is obtained by sampling, is 160, namely 160 sampling points are contained in the audio data to be resampled.
S102, filtering the sampling points according to a target sampling rate to be resampled and a pre-stored target filtering coefficient table to obtain resampled audio data containing a second number of resampling points.
In this embodiment, the target sampling rate may be specifically understood as a sampling rate that should be provided after the resampling process is performed during the resampling process in the audio application, where a specific value of the target sampling rate may be determined according to a functional application specifically triggered by a user in the audio application, and an audio application default sampling rate is 16KHZ, and when the user needs to record a sound and selects 44.1KHZ to output the recorded content, the 44.1KHZ may be regarded as the target sampling rate to be resampled.
In this embodiment, the target filter coefficient table may be specifically understood as a filter coefficient set including each target filter coefficient required for resampling, which is determined in advance in the resampling initialization stage, and in this embodiment, a method of performing interpolation processing on a reference filter coefficient in a predetermined reference filter coefficient table is used to obtain the target filter coefficient on the basis of the reference filter coefficient.
In this embodiment, the target table length of the target filter coefficient is greater than the reference table length, and the process of obtaining the target filter coefficient table based on the reference filter coefficient table is equivalent to directly performing length expansion on the reference filter coefficient table, so that the process of determining the target filter coefficient table by adopting a large number of repeated calculations during conventional filter coefficient determination is avoided, and the time occupation of the resampling initialization filter coefficient stage is reduced.
In addition, the reference filter coefficient table may be determined in advance by an existing filter coefficient calculation method, and although the reference filter coefficient table determination by the given filter coefficient calculation method requires some repeated calculation, the reference table length in the reference filter coefficient table is considered to be far smaller than the target length of the target filter coefficient table, so that even if there is some time-consuming repeated calculation, the time taken for calculating the whole target filter coefficient table directly by adopting the existing filter coefficient calculation method is far smaller than the time taken for forming the whole target filter coefficient table.
In this embodiment, the reference table length of the reference filter coefficient table is associated with an over-sampling value and a filter length value preset during resampling, and the over-sampling value and the filter length value are both relatively small fixed values, and it should be noted that, the setting of the two values is related to a preset resampled filter quality value, the larger the filter quality value is, the corresponding over-sampling value and the filter length value are correspondingly increased, and in this embodiment, a moderate filter quality value is selected, and the resampling quality is ensured, and meanwhile, a small value of the over-sampling value and the filter length value required for calculation is ensured.
Specifically, the step may form a section of filtered audio data corresponding to each sampling point, then select a target filter coefficient sequence corresponding to each section of filtered audio data from the target filter coefficient table, and then perform filtering processing on the filtered audio data and the corresponding target filter coefficient sequence, thereby obtaining resampling points corresponding to each sampling point, and finally the step may form resampled audio data based on the obtained resampling points.
It is to be noted that the above-formed resampled audio data contains a second number of resampled points, which is specifically determined in advance based on the determined target sampling rate, for example, 44.1KHZ, and on the premise that the target sampling rate is 44.1KHZ, the data length of one frame of audio data intercepted at the sampling rate can be directly determined to be 441, that is, the number of resampled points corresponding to one frame of resampled audio data formed after resampling is 441.
It should be noted that, in this embodiment, the magnitude relation between the first number and the second number is specifically related to the current sampling rate and the magnitude of the target sampling rate, and when the known current sampling rate is smaller than the target sampling rate, the first number is smaller than the second number; the first number is greater than the second number when the current sampling rate is greater than the target sampling rate.
According to the audio resampling method provided by the embodiment of the invention, audio data is intercepted at the current sampling rate, and the audio data to be resampled containing a first number of sampling points is obtained; and filtering the sampling points according to a target sampling rate to be resampled and a pre-stored target filtering coefficient table to obtain resampled audio data containing a second number of resampled points, wherein the target filtering coefficients contained in the target filtering coefficient table are obtained through interpolation processing of reference filtering coefficients in a pre-determined reference filtering coefficient table, the target table length of the target filtering coefficients is larger than the reference table length, and the reference table length of the reference filtering coefficient table is associated with a preset over-sampling value and a preset filtering length value. By utilizing the method, the determination time of the target filter coefficient table for resampling is better saved, so that the overall time consumption of the audio resampling process is reduced, the power consumption and the resource occupation of carrier equipment for executing the audio resampling process are also reduced, and the response waiting time of the audio application with the audio resampling after triggering is further shortened.
Further, as an alternative embodiment of the first embodiment of the present invention, it is necessary to determine the reference filter coefficient table before determining the target filter coefficient table, and the present embodiment performs the determination of the reference filter coefficient table based on the following steps. Specifically, fig. 2 shows an exemplary flowchart of determining the reference filter coefficient table in the first embodiment of the present invention, and as shown in fig. 2, the step of determining the reference coefficient table in this embodiment includes:
S1001, acquiring a set filtering quality value, searching a pre-stored filtering quality table, and acquiring a corresponding over-sampling value and a filtering length value under the filtering quality value.
It should be noted that, the audio resampling method provided in this embodiment is mainly an improvement of the existing audio resampling method of the resampling module in Speex engineering, so some parameters in the method provided in this embodiment are original parameters of the existing resampling module in Speex, for example, the filtering quality is a parameter in the existing resampling module, and is used for defining the precision of the audio resampling result, the value of the filtering quality is specifically divided into 0-9 ten class values, the higher the selected class value is, the higher the precision of the obtained audio resampling result is indicated, the specific value of the filtering quality is recorded as the filtering quality value, and can be set by a developer in the development stage of an application product.
The step can specifically acquire the filter quality value set by a developer in the development stage, and can determine the corresponding over-sampling value and the filter length value under the filter quality value by searching the filter quality table. For example, if the filter quality value is 3, the over-sampling value corresponding to the filter quality value is 8 and the filter length value is 48.
S1002, determining a reference filter coefficient table with the length of the reference table being a third quantity value based on the over-sampling value and the filter length value.
In this embodiment, after the over-sampling value and the filter length value are determined, the reference table length of the reference filter coefficient table may be determined directly based on the over-sampling value and the filter length value, and it is understood that the reference table length may also be equal to the number of reference filter coefficients included in the reference filter coefficient table, where the number of reference filter coefficients included in the reference filter coefficient table is a third number value, and in consideration of the sampling rule in the filtering calculation, the third number value is set to be equal to the sum of the product value of the over-sampling value and the filter length value and a given target constant value, and the target constant value may be a constant multiple of 4, such as 8, 12, or the like, but in order to ensure that the reference table length is in a suitable range, the setting constant is preferably 8 in this embodiment.
In this embodiment, the determining, for the reference coefficient value included in the reference filter coefficient table, the reference filter coefficient table whose reference table length is the third number value based on the over-sampling value and the filter length value may include the following steps:
a) And determining a third quantity value serving as a reference filter length according to the over-sampling value, the filter length value and a given target constant value, acquiring an audio decibel limiting weight value under the filter quality value, and setting a reference length variable initialized to 0.
Illustratively, the reference filter length is equal to the product of the over-sampled value and the filter length value plus the target constant value. On the premise of determining the filter quality value, the corresponding audio decibel limiting weight value can be directly obtained. In this embodiment, a reference length variable is set for circularly determining the reference coefficient value of each reference filter coefficient in the reference filter coefficient table and the initialization value of the reference length variable is 0.
b) And determining the corresponding octyl function value of the given octyl function when the independent variable value is equal to the value of the reference length variable, and determining the corresponding interpolation result value when the intermediate variable value in the given Kaiser window cubic spline interpolation processing formula is equal to the value of the reference length variable.
Further, the sine function is expressed as:
wherein i represents a reference length variable which is an independent variable in the sine function, the initialization value of i is-k/2, and k is a given target constant value which is a multiple of 4; cutoff represents the audio db limiting weight value at the filter quality value, oversamples represents the over-sampled value, and filelen represents the filter length value; sinc (i) represents the sing function value when i is the corresponding value.
Further, the Kaiser window cubic spline interpolation processing formula is expressed as follows:
win represents an interpolation result value of a Kaiser window by cubic spline interpolation, interp1[ a ] represents an a-th coefficient value in the cubic spline interpolation, and
interp1[0]=-0.333333*frac+0.5*frac 2 -0.166667*frac 3
interp1[1]=1-0.5*frac-frac 2 -0.5*frac 3
interp1[2]=frac+0.5*frac 2 -0.5*frac 3
interp1[3]=-0.166667*frac+0.166667*frac 3
frac=y-ind represents the fractional part of the y value, ind=floor (y) is expressed as a downward rounding to y;
representation->I represents a reference length variable which is an intermediate variable in a cubic spline interpolation process, an initial value of i is-k/2, and k is the target constant value; kaiser [ ind+a ]]And the element value with the index of ind+a in the Kaiser window array corresponding to the filter quality value is represented.
c) And regarding the product value of the sine function value, the interpolation result value and the audio decibel limiting weight value as a reference coefficient value of the reference filter coefficient corresponding to the reference length variable, and correspondingly writing the reference coefficient value into the reference filter coefficient table.
It can be understood that, on the premise of giving the current value of the reference length variable, by combining the singer function and the Kaiser window cubic spline interpolation processing formula, the corresponding singer function value and interpolation result value can be respectively determined, and the reference coefficient value of the reference filter coefficient corresponding to the reference length variable in the current value can be the product value of the singer function value multiplied by the interpolation result value and the audio decibel limiting weight value; the present embodiment may write the reference coefficient value to the reference length filter coefficient table at a position with the current value of the reference length variable as a subscript.
d) And c), adding 1 to the value of the reference length variable as a new reference length variable, and returning to the step b) until the reference length variable reaches the reference table length.
The present embodiment can determine the reference coefficient value of each reference filter coefficient one by adding 1 to the value of the reference length variable as a new form of the reference length variable and write it in the corresponding position of the reference filter coefficient table until the reference length variable reaches the reference filter length, stopping the iteration.
It should be noted that, in the existing resampling method, the first filter coefficient calculation formula is directly adopted to determine the target filter coefficient table, the target table length of the target filter coefficient table is the product of the target line number and the filter length value, the target line number is the quotient of the target sampling rate and a given value, and the target line number is far greater than the oversampling number, so if the first filter coefficient calculation formula is directly adopted to determine the target filter coefficient table, the calculated amount is far greater than the calculated amount of the reference filter coefficient table in the embodiment, and the original time consumption is several times greater than the time consumption in the embodiment. Therefore, the technical scheme of determining the reference filter coefficient table in the alternative embodiment greatly reduces the calculated amount and the occupation of the calculated time, and improves the resampling processing efficiency.
On the basis of the above embodiment, the target filter coefficient table is represented by a two-dimensional array in which one line is the determined target line and the number of columns is the filter length value, and the product of the target line and the filter length value is used as the target filter length of the target filter coefficient table; the target line number is the quotient of the target sampling rate and a given value, and the given value is the greatest common divisor of the current sampling rate and the target sampling rate.
For example, assuming that the target sampling rate is 44.1KHZ and the current sampling rate is 16KHZ, the greatest common divisor of the current sampling rate and the target sampling rate is 100, so that the value of the target line number is the quotient of 44100 and 100, i.e., 441, and the filter length value is 48, the target filter coefficient table can be regarded as a two-dimensional array of line number 441 and column number 48.
In this embodiment, after the reference filter coefficient table is determined, in order to ensure the normal operation of S102, a target filter coefficient table is further obtained based on the reference filter coefficient table, and specifically, the target filter coefficient in the target filter coefficient table may be obtained by performing a cubic spline interpolation process on the reference filter coefficient in the reference filter coefficient table.
Accordingly, fig. 3 shows an example of a process of determining the target filter coefficient table in the first embodiment of the present invention, and as shown in fig. 3, the step of obtaining the target filter coefficient table by interpolation processing of the reference filter coefficients in the predetermined reference filter coefficient table may be described as follows:
s1003, according to the target line number, the over-sampling value and the filtering length value, determining the same number of extended index values as the target table length, and obtaining an index two-dimensional array formed by the extended index values.
It should be noted that, when performing cubic spline interpolation on the reference filter coefficient table in this embodiment, it is necessary to determine interpolation positions of the reference filter coefficient table for performing cubic spline interpolation, where the interpolation positions are determined by extended index values, the number of the extended index values is the same as the number of the target table lengths, and each extended index value may be determined by a given target line number, an over-sampling value, and a filter length value. Since the target filter coefficients in the target filter coefficient table are obtained by the cubic spline interpolation processing of the reference filter coefficient table, the number of the extension index values subjected to the cubic spline interpolation processing is the same as the value of the reference table length, and the extension index values determined based on the step are the same in consideration that the reference table length of the reference filter coefficient table is far smaller than the target table length
In addition, when the target filter coefficient table is known to be represented by a two-dimensional array, the number of extension index values which are the same as the target table length of the target filter coefficient table may also be represented by a two-dimensional array and may be denoted as an index two-dimensional array. It will be appreciated that the determination of the extended index value in this embodiment is also a loop iterative process.
Specifically, according to the target line number, the over-sampling value and the filtering length value, determining the extended index values with the same number as the target table length, and obtaining an index two-dimensional array formed by the extended index values, the method can be realized by the following steps:
a) An initial two-dimensional array with the number of lines as the target number of lines and the number of columns as the filtering length value is created, and the line index value of the first line in the initial two-dimensional array is used as the current line index value and the column index value of the first column is used as the current column index value.
In this embodiment, it may be assumed that the initial two-dimensional array is denoted as a [ gradient ] [ filter len ], where the gradient represents the total number of target rows, the filter len represents the total number of columns of the filter length values, and the element value corresponding to the first column of the first row in the initial two-dimensional array may be denoted as a [0] [0], so that the row index value of the first row is 0 and the column index value of the first column is also 0.
b) And taking the product of the current column index value added with 1 and the over-sampling value as a first intermediate value, taking the quotient of the current column index value multiplied by the over-sampling value and the target line number as a second intermediate value, and taking the difference between the first intermediate value and the second intermediate value as a third intermediate value.
c) And taking the current index value and the current column index value as the current two-dimensional index of the initial two-dimensional array, and writing the sum of half of the target constant value and the third intermediate value as an expansion index value into the corresponding element position of the current two-dimensional index in the initial two-dimensional array.
Illustratively, 0 in A0 corresponds to the current two-dimensional index of the initial two-dimensional array, and the target constant value is a constant value used in determining the reference coefficient value of the reference filter coefficient. The calculated numerical value is used as an expansion index value to be written into the element position corresponding to the current two-dimensional subscript of the initial two-dimensional array.
d) And c) adding 1 to the current column index value as a new current column index value, and returning to the step b) until the current column index value reaches the filtering length value.
e) And c), taking the first column index value in the initial two-dimensional array as a new current column index value, adding 1 to the current row index value as a new current row index value, and returning to the step b) until the current row index value reaches the target row number.
f) The initial two-dimensional array written with each extended index value is determined as an index two-dimensional array.
After the extended index values are written into the two-dimensional subscripts of the initial two-dimensional array through the circulation, an index two-dimensional array containing the extended index values is formed.
For example, taking the target constant value as 8, the target line number density as 441, and the filter length value as 48 as examples, in the above-mentioned loop operation, it is equivalent to taking the current index value as 0 first, and then performing 48 loops when the current index value is respectively taken as 0-47, thereby obtaining 48 extended index values when the current index value is 0; then, the current index value can be added with 1, 48 cycles when the current index value is respectively taken as 0 to 47 are repeatedly performed, thus 48 extended index values when the current index value is 1 are obtained, and then, the current index value can be sequentially taken as 2 to 440, and finally 48 multiplied by 441 extended index values are obtained.
S1004, for each extended index value in the index two-dimensional array, interpolation processing is carried out on the reference filter coefficient associated with the extended index value in the reference filter coefficient table, and a target filter coefficient corresponding to the extended index value is obtained.
In this embodiment, in order to obtain the target filter coefficient table whose target table length is the product of the target number of lines and the filter length value, this embodiment considers performing interpolation processing on the reference filter coefficient table in combination with each extended index value to obtain the target filter coefficient corresponding to each extended index value.
Further, for each extended index value, interpolation processing is performed on the reference filter coefficient associated with the extended index value in the reference filter coefficient table, and the step of obtaining the target filter coefficient corresponding to the extended index value is as follows:
a) And obtaining a target index value of the extended index value in the index two-dimensional array.
In this embodiment, each extended index value has its corresponding two-dimensional index value in the index two-dimensional array, and a row index value in the two-dimensional index value may be marked as a target row index value of the currently processed extended index value.
b) And determining four interpolation coefficients for cubic spline interpolation processing according to the target landmark value, the over-sampling value and the target line number.
Illustratively, determining four interpolation coefficients for cubic spline interpolation according to the target landmark value, the over-sampling value and the target line number, including: determining the product of the target landmark value and the over-sampling value, and marking the product as a target product value; determining the remainder of the target product value and the target line number, and marking the remainder as a target remainder value; determining the quotient of the target remainder value and the target line number as the duty ratio position of the target line number in the target line number; and determining four interpolation coefficients for cubic spline interpolation according to the duty ratio position and a given four interpolation coefficient determination formula.
Wherein, four interpolation coefficient determination formulas are respectively expressed as:
interp2[0]=-0.166667*frac1+0.166667*frac1 3
interp2[1]=frac1+0.5*frac1 2 -0.5*frac1 3
interp2[2]=1-0.5*frac1-frac1 2 -0.5*frac1 3
interp2[3]=-0.333333*frac1+0.5*frac1 2 -0.166667*frac1 3
wherein, the interpolation 2[ b ] represents the b coefficient value in the cubic spline interpolation, b is 0,1,2 and 3, and the 1 is the duty ratio position of the target row number.
c) For each interpolation coefficient, determining an associated reference coefficient value of the reference filter coefficient associated with the extended index value from the reference filter coefficient table according to the interpolation coefficient, and recording the product of the associated reference coefficient value and the interpolation coefficient as an associated intermediate value.
In this embodiment, after determining the interpolation coefficients, for each interpolation coefficient, the associated reference coefficient value of the reference filter coefficient associated with the currently processed extension index value may be determined in the reference filter coefficient table.
Specifically, determining, according to the interpolation coefficient, an associated reference coefficient value of the reference filter coefficient associated with the extended index value from the reference filter coefficient table may include: taking the sum of the difference value of the extended index value and one set constant value and the interpolation coefficient as an associated lower index value in a basic filtering coefficient table, wherein the set constant value is one quarter of the target constant value; and determining a reference coefficient value corresponding to the associated lower standard value in the basic filtering coefficient table as an associated reference coefficient value.
d) And taking the sum of the associated intermediate values as a target filter coefficient corresponding to the extended index value.
It can be understood that the cubic spline interpolation process includes four interpolation coefficients, and an associated intermediate value can be determined corresponding to each interpolation coefficient, and the sum of the four associated intermediate values can be used as the target filter coefficient corresponding to the extended index value in this step.
For example, in the above-mentioned determination operation of the target filter coefficient, the target constant value may be set to 8, the target line number to 441, the filter length value to 48, the oversampling value to 8, and the currently selected index value may be set to index 00 Then the current target index value can be considered as 0, and then the corresponding four interpolation coefficients under the expansion index value can be determined by combining the over-sampling value, the target line number and the four interpolation coefficient determination formulas; then, for the b-th interpolation coefficient, the index value index is extended 00 The corresponding associated reference filter coefficients in the reference filter coefficient table are sinctemp [ index ] 00 -k/4+b]For example, when b=0, the interpolation coefficient is extended by index value index 00 The relevant reference filter coefficient in the reference filter coefficient table is sine temp [ index ] 00 -2]When b=1, the corresponding correlation reference filter coefficient is sinc temp [ index ] 00 -1]When b=2, the corresponding correlation reference filter coefficient is sinc temp [ index ] 00 ]When b=3, the corresponding correlation reference filter coefficient is sinc temp [ index ] 00 +1]. Then, sinctemp [ index ] can be respectively calculated 00 -2],sinctemp[index 00 -1],sinctemp[index 00 ]Sinctemp [ index ] 00 +1]Multiplying the interpolation coefficients to obtain respective associated intermediate values, and determining the value added by the associated intermediate values as an extended index value index 00 Corresponding target filter coefficients.
S1005, a target filter coefficient table containing each target filter coefficient is obtained.
In this embodiment, after determining the target filter coefficients corresponding to the extension index values based on S1004, the target filter coefficients corresponding to the target table lengths are determined, so that the target filter coefficient table including the target filter coefficients can be obtained.
In the above alternative embodiment, the process of obtaining the target filter coefficient table is specifically implemented by interpolation processing on the reference filter coefficient table, and compared with the existing method of determining the target filter coefficient, the process greatly reduces the number of times of performing the sing function calculation, thereby reducing the calculation time and the calculation resource occupation, and further accelerating the processing time of audio resampling.
It should be noted that, in the audio resampling process, the most critical link is that a group of target filter coefficients are selected from the audio data to be processed formed by the corresponding sampling points in the target filter coefficient table for filtering calculation, in the existing audio resampling process, the target filter coefficient table is stored in the memory only in a conventional manner, and in the storage mode, when the corresponding target filter coefficient selection is performed on each sampling point in the memory after the resampling process stage is entered, the reading address in the memory is jumped and is not sequentially read continuously, thereby destroying the continuity of the data read in the memory and increasing the reading time of the data.
In an alternative embodiment provided in the following embodiment, before the resampling process, the determined target filter coefficient table is subjected to sorting optimization during storage, that is, the target filter coefficients in the target filter coefficient table are subjected to rearrangement processing, so that the target filter coefficients can be continuously read during the resampling process.
Specifically, based on the above-mentioned alternative embodiment, fig. 4 shows a flowchart for implementing sorting of the target filter coefficients in the target filter coefficient table in the first embodiment of the present invention, and as shown in fig. 4, before the filtering process is performed on each sampling point according to the target sampling rate to be resampled and the pre-stored target filter coefficient table to obtain the second number of resampling points, the present embodiment further preferably includes the following steps:
s1006, acquiring a position index set, wherein the position index set comprises position indexes of each target filter coefficient in the target filter coefficient table.
In this embodiment, each target filter coefficient in the target filter coefficient table has a position index for performing position identification according to the element sequence number, in addition to an array index, so that a position index set can be obtained in this step, and thus a position index of each target filter coefficient in the target filter coefficient table is obtained.
S1007, determining the selected sequence number corresponding to each position label in the position label set, and selecting the corresponding target filter coefficient from the target filter coefficient table according to the sequence of the selected sequence number.
In this embodiment, in order to reorder each target filter coefficient, the step may be specifically optimized as the following step to determine a selected sequence number corresponding to each position index in the position index set, so that the target filter coefficient of each position index may be selected from the target filter coefficient table according to the order of the selected sequence numbers.
Specifically, the determining the selected sequence number of each position label in the position label set includes:
a) A skip row variable initialized to 0, an offset column variable, and a selected row variable are set.
b) And multiplying the jump line variable by the filter length value, and determining the sum of the jump line variable and the offset column variable as the current position label in the position label set.
c) And multiplying the selected row variable by the filter length value, and determining the sum of the selected row variable and the offset column variable as a selected sequence number corresponding to the current position mark.
d) And (c) adding 1 to the offset column variable as a new offset column variable, and returning to the step (b) until the offset column variable reaches the filter length value.
e) The value of the offset column variable is set to 0 and the selected row variable is added to 1 as the new selected row variable.
f) Updating the jump line variable based on a given line offset update formula and returning to step b) until the value of the selected line variable reaches the target line number.
Wherein the row offset update formula is expressed as:
samp_num= (samp_num+num rate%Denrate)%Denrate, it being understood that num rate is the quotient of the current sample rate and the greatest common divisor; the repetition represents the target number of rows.
Specifically, the determination of the selected sequence number is also a process of loop iteration, the iteration number of the loop iteration is also the target table length, the iteration variable is an offset column variable corresponding to the selected row variable and the filtering length value comprising the target row number, and the updating of the jump row variable in the iteration process is realized through a navigation offset updating formula.
For example, when the current sampling rate is 16KHZ, the target sampling rate is 44.1KHZ, the greatest common divisor of the current sampling rate and the greatest common divisor is 100, the quotient numrate of the current sampling rate and the greatest common divisor is 160, the target line number index is 441, when both the selected line variable and the offset column variable are 0, the skip line variable is also 0, the current position index at this time is also 0, that is, the position index for which the first decision of the selected sequence number is made is 0, then according to step c), the selected sequence number corresponding to the current position index can be determined to be 0, after 48 calculations are performed, the value of the skip line variable samp_num is updated to 160, the offset column variable is reset to 0 again, at this time, the determined current position index is 160×48, and according to step c), the corresponding selected sequence number under the current position index can be determined to be 48.
S1008, storing the target filter coefficients selected according to the sequence of the selected sequence numbers in a memory to form a new target filter coefficient table.
In this embodiment, based on the selected sequence numbers of the position marks selected in the above steps, the present step may store each target filter coefficient selected in the order of each selected sequence number in the memory, thereby forming a new target filter coefficient table.
In the above-mentioned alternative embodiment, the rule of the existing selected filter coefficient is analyzed, so that before the resampling process is performed, the target filter coefficient is firstly ordered according to the analyzed rule, and the rearranged target filter coefficient is stored in the memory to form a new target filter coefficient table, so that the target filter coefficient can be continuously read from the memory when the resampling process is performed subsequently, and the time for obtaining the filter coefficient from the memory is shortened, so that the resampling process time is shortened.
On the basis of the above embodiment, in this embodiment, filtering processing is further performed on each sampling point according to a target sampling rate to be resampled and a pre-stored target filtering coefficient table, so as to obtain resampled audio data including a second number of resampling points, and fig. 5 shows a flowchart for implementing resampling processing on the sampling points to obtain resampled audio data in the first embodiment of the present invention, and as shown in fig. 5, the determination of resampled audio data specifically includes the following steps:
S1021, determining the number of sampling points to be formed into resampling points after resampling according to the target sampling rate, and recording the number as a second number.
For example, assuming that the target sampling rate is 44.1KHZ, the number of sampling points included when one frame of audio data is truncated at the target sampling rate is 441, and thus, the number of sampling points of resampling points to be formed after resampling is 441 in this step for resampling the audio data truncated at the current sampling rate.
And S1022, taking the sampling label of the first sampling point in the audio data to be resampled as the current sampling label.
It may be known that the audio data to be resampled includes a first number of sampling points, and in this embodiment, sequential labeling may be performed for each sampling point, so that each sampling point has a sampling label, and this step is an initialization step, where the sampling label of the first sampling point in the audio data to be resampled is first recorded as the current sampling label.
It should be noted that, the audio data to be resampled in this embodiment is one frame of audio data truncated at the current sampling rate. The audio resampling method provided by the embodiment resamples by taking the frame as a unit, and after the resampling processing of the audio data to be resampled of one frame is completed, the resampling processing of the audio data to be resampled of the next frame is restarted.
S1023, taking the first row in the target filter coefficient table as the current row, and setting an intermediate variable and a length variable initialized to 0.
In this embodiment, the target filter coefficient table uses the target line number as line information, uses the filter length value as line information, and can acquire the target filter coefficient in line units.
S1024, obtaining each target filter coefficient included in the current row to form a current filter coefficient sequence.
The current filtering sequence is used for resampling the sampling points associated with the current sampling marks.
S1025, obtaining each sampling point with the current sampling label as a starting point and the length as the filtering length value from the audio data to be resampled to form current audio data.
According to the resampling processing mode in the Speex internal resampling module, the audio data resampling is performed in this embodiment, that is, the sampling point with the length being the filtering length value is obtained from the current sampling label as the starting point to the next step, so as to form the current audio data to be processed in the current iteration.
For example, assuming that the corresponding filter length value under the set filter quality value is 48, starting with the sampling point corresponding to the current sampling label, taking 47 sampling points to form current audio data, assuming that the current sampling point is at the position of the audio data to be resampled, and assuming that the number of sampling points in the subsequent process is less than 47, expanding the audio data to be resampled for the next frame, and acquiring the rest sampling points from the audio data to be resampled for the next frame to form the current audio data with 48 sampling points.
S1026, multiplying and summing the signal value of each sampling point in the current audio data and each target filter coefficient in the current filter coefficient sequence correspondingly.
The step is a filtering processing step, and specifically realizes the summation of multiplication of signal values of sampling points contained in the current audio data and each target filter coefficient in the current line.
S1027, adding the obtained addition result as a signal value of a resampling point to a resampling output sequence, and adding the value of the length variable by 1.
This step corresponds to the formation of a resample point whose signal value is the result of the addition calculated above.
S1028, if the intermediate variable is smaller than the target line number, executing S1029; if not, S1030 is performed.
The present step may be regarded as a determination step of the inner loop, specifically determining whether the intermediate variable is smaller than the target number of lines, if it is smaller than the target number of lines indicating that the inner loop is still to be performed, the operation of S1029 may be performed, and if it is greater than or equal to the target number of lines indicating that the inner loop of the present time may be ended, the operation of S1030 may be performed to update the outer loop based on the outer loop update condition.
The internal circulation is equivalent to the determination of each associated resampling point for one sampling point
S1029, updating the current sampling label by a first updating formula, updating the intermediate variable by a second updating formula, taking the next line of the current line as a new current line, and returning to S1024.
Further, the first updated formula is expressed as:
lastsample=lastsample+numrate/denoise, wherein lastsample represents a current sample index in the audio data to be resampled, numrate is a quotient of the current sample rate and a given value, the given value is a greatest common divisor of the current sample rate and the target sample rate, and denoise represents the target line number;
It can be found that the current sampling index remains unchanged during the inner loop, and at the same time, it can also be found that the next line of the current line is directly selected as a new current line in this step, that is, it is equivalent to continuously reading the target filter coefficient in the memory for resampling.
The second updated formula is expressed as:
samp_frac_num=samp_frac_num+numrate%denrate。
where samp_frac_num represents the intermediate variable.
S1030, if the current sample number is the sample number of the last sample point in the audio data to be resampled or the value of the length variable is equal to the second number, executing S1031; otherwise, S1032 is performed.
The step is a judging condition of the outer loop, if the current sampling label is updated to the last one or the number of the obtained resampling points reaches the second number, the outer loop can be ended, and at this time, S1032 can be executed; if the above condition is not satisfied, it indicates that further resampling processing is required for the sampling point in the audio data to be resampled, at this time, S1031 may be executed.
S1031, taking the next sampling label of the current sampling label as a new current sampling label, updating the intermediate variable by a third updating formula, taking the next line of the current line as a new current line, and returning to execute S1024.
The step is an outer circulation updating step, wherein the next sampling label of the current sampling label is selected as a new current sampling label, a third updating formula is set according to a selection rule to update the intermediate variable, and meanwhile, the next row is still sequentially selected as a new current row.
Further, the third updated formula is expressed as:
samp_frac_num=samp_frac_num-denrate
s1032, forming resampled audio data based on the signal values of the resampled points in the resampled output sequence.
In this embodiment, the signal value of each resampling point may be obtained from the buffer in the resampling output sequence, so as to form resampled audio data, where the resampling audio data includes a second number of resampling points.
Compared with the existing resampling process, in the alternative embodiment, one row of target filter coefficients can be continuously read from the target filter coefficient table to serve as a current filter coefficient sequence for filtering process, so that the reading continuity is ensured, the acquisition time of the target filter coefficients in the resampling process is shortened, the processing time of the resampling process is further shortened, and the processing efficiency of the resampling process is improved.
On the basis of any optional embodiment, the audio resampling method provided in this embodiment further optimizes and increases after obtaining the resampled audio data including the second number of resampling points: and clearing the cache information cached in the memory during the filtering processing of each sampling point.
In this embodiment, the resampling process of the audio data is continuously performed in a unit of one frame, and the above-described audio resampling method only completes the resampling process of one frame of audio data to be resampled, so as to ensure the normal execution of the resampling process of the subsequent audio data frame.
Example two
Fig. 6 is a block diagram of an audio resampling apparatus according to a second embodiment of the present invention, where the apparatus is suitable for resampling audio data to be resampled in audio applications, and the apparatus may be implemented by software and/or hardware and may be generally integrated in an audio resampling device, where the audio resampling device is equivalent to a carrier device for performing an audio resampling method, and may specifically be a terminal device with an audio application function. As shown in fig. 6, the apparatus includes: a sample point acquisition module 21 and a resampling processing module 22.
The sampling point obtaining module 21 is configured to intercept audio data at a current sampling rate, and obtain audio data to be resampled including a first number of sampling points; the resampling processing module 22 is configured to perform filtering processing on each of the sampling points according to a target sampling rate to be resampled and a pre-stored target filtering coefficient table, so as to obtain resampled audio data including a second number of resampling points; in addition, the target filter coefficient included in the target filter coefficient table is obtained through interpolation processing of a reference filter coefficient in a predetermined reference filter coefficient table, the target table length of the target filter coefficient is larger than the reference table length, and the reference table length of the reference filter coefficient table is associated with a preset over-sampling value and a preset filter length value.
After each module in the audio resampling device provided by the second embodiment of the invention is matched with each other, firstly, audio data is intercepted at the current sampling rate to obtain audio data to be resampled, wherein the audio data comprises a first number of sampling points; and then filtering the sampling points according to a target sampling rate to be resampled and a pre-stored target filtering coefficient table to obtain resampled audio data containing a second number of resampled points, wherein the target filtering coefficient contained in the target filtering coefficient table is obtained through interpolation processing of a reference filtering coefficient in a pre-determined reference filtering coefficient table, the target table length of the target filtering coefficient is larger than the reference table length, the reference table length of the reference filtering coefficient table is related to a preset over-sampling value and a preset filtering length value for resampling, and the target filtering coefficient table is mainly formed through interpolation processing on the basis of the reference filtering coefficient table.
Further, when the current sampling rate is less than the target sampling rate, the first number is less than the second number; the first number is greater than the second number when the current sampling rate is greater than the target sampling rate.
Further, the apparatus may further include an information pre-determining module, where the information pre-determining module may specifically include: the first acquisition unit is used for acquiring a set filtering quality value, searching a pre-stored filtering quality table and acquiring an over-sampling value and a filtering length value corresponding to the filtering quality value; the reference coefficient determining unit is used for determining a reference filter coefficient table with a reference table length being a third quantity value based on the over-sampling value and the filter length value.
Further, the reference coefficient determining unit may be specifically configured to determine a third quantity value serving as a reference filter length according to the oversampling value, the filter length value and a given target constant value, obtain an audio decibel limiting weight value under the filter quality value, and set an initialization value of a reference length variable; determining the corresponding octyl function value of the given octyl function when the independent variable value is equal to the value of the reference length variable, and determining the corresponding interpolation result value when the intermediate variable value in the given Kaiser window cubic spline interpolation processing formula is equal to the value of the reference length variable; taking the product value of the sine function value, the interpolation result value and the audio decibel limiting weight value as a reference coefficient value of a reference filter coefficient corresponding to the reference length variable, and correspondingly writing the reference coefficient value into the reference filter coefficient table; and adding 1 to the value of the reference length variable to serve as a new reference length variable, and returning to the determining operation of the sine function value and the interpolation result value until the reference length variable reaches the length of the reference table.
Further, the sine function may be expressed as:
wherein i represents a reference length variable as an argument, the initialization value of i is-k/2, k is a given target constant value which is a multiple of 4; cutoff represents the audio db limiting weight value at the filter quality value, oversamples represents the over-sampled value, and filelen represents the filter length value; sinc (i) is expressed as the sing function value when i is the corresponding reference length variable.
Meanwhile, the Kaiser window cubic spline interpolation processing formula can be expressed as:
win represents an interpolation result value of a Kaiser window by cubic spline interpolation, interp1[ a ] represents an a-th coefficient value in the cubic spline interpolation, and
interp1[0]=-0.333333*frac+0.5*frac 2 -0.166667*frac 3
interp1[1]=1-0.5*frac-frac 2 -0.5*frac 3
interp1[2]=frac+0.5*frac 2 -0.5*frac 3
interp1[3]=-0.166667*frac+0.166667*frac 3
frac=y-ind represents the fractional part of the y value, ind=floor (y) is expressed as a downward rounding to y;
representation->I represents a reference length variable as an intermediate variable,an initial reference length variable is-k/2, k is the target constant value, oversamples represent the over-sampled values, and filelen represents the filter length value; kaiser [ ind+a ]]And the element value with the index of ind+a in the Kaiser window array corresponding to the filter quality value is represented.
Further, the target filter coefficient table is represented by a two-dimensional array with one row number as the determined target row number and one column number as the filter length value, and the product of the target row number and the filter length value is used as the target filter length of the target filter coefficient table; the target line number is the quotient of the target sampling rate and a given value, and the given value is the greatest common divisor of the current sampling rate and the target sampling rate.
Further, the device also comprises a target coefficient determining module, wherein the target coefficient determining module specifically comprises: the index determining unit is used for determining the extended index values with the same number as the target table length according to the target line number, the over-sampling value and the filtering length value, and obtaining an index two-dimensional array formed by the extended index values; the target coefficient determining unit is used for carrying out interpolation processing on the reference filter coefficient associated with the extended index value in the reference filter coefficient table aiming at each extended index value in the index two-dimensional array to obtain a target filter coefficient corresponding to the extended index value; the second acquisition unit is used for acquiring a target filter coefficient table containing each target filter coefficient.
Further, the index determining unit may be specifically configured to create an initial two-dimensional array with the number of rows being the target number of rows and the number of columns being the filtering length value, and use a row index value of a first row in the initial two-dimensional array as a current row index value and a column index value of a first column as a current column index value; taking the product of the current column index value added with 1 and the over-sampling value as a first intermediate value, taking the quotient of the current column index value multiplied by the over-sampling value and the target line number as a second intermediate value, and taking the difference between the first intermediate value and the second intermediate value as a third intermediate value; taking the current row index value and the current column index value as current two-dimensional subscript of the initial two-dimensional array, and writing the sum of half of the target constant value and the third intermediate value as an expansion index value into the corresponding element position of the current two-dimensional subscript in the initial two-dimensional array; adding 1 to the current column index value to serve as a new current column index value, and returning to the determining operation of the third intermediate value until the current column index value reaches the filtering length value; taking the first column index value in the initial two-dimensional array as a new current column index value, adding 1 to the current row index value as a new current row index value, and returning to the determination operation of a third intermediate value until the current row index value reaches the target row number; the initial two-dimensional array written with each extended index value is determined as an index two-dimensional array.
Further, the target coefficient determining unit may be specifically configured to obtain a target landmark value of the extended index value in the index two-dimensional array; determining four interpolation coefficients for cubic spline interpolation processing according to the target landmark value, the over-sampling value and the target line number; for each interpolation coefficient, determining an associated reference coefficient value of the reference filter coefficient associated with the extended index value from the reference filter coefficient table according to the interpolation coefficient, and recording the product of the associated reference coefficient value and the interpolation coefficient as an associated intermediate value; and taking the sum of the associated intermediate values as a target filter coefficient corresponding to the extended index value.
Wherein, the determining four interpolation coefficients for cubic spline interpolation processing according to the target landmark value, the over-sampling value and the target line number may include: determining the product of the target landmark value and the over-sampling value, and marking the product as a target product value; determining the remainder of the target product value and the target line number, and marking the remainder as a target remainder value; determining the quotient of the target remainder value and the target line number as the duty ratio position of the target line number in the target line number; and determining four interpolation coefficients for cubic spline interpolation according to the duty ratio position and a given four interpolation coefficient determination formula.
Further, the four interpolation coefficient determination formulas may be expressed as:
interp2[0]=-0.166667*frac1+0.166667*frac1 3
interp2[1]=frac1+0.5*frac1 2 -0.5*frac1 3
interp2[2]=1-0.5*frac1-frac1 2 -0.5*frac1 3
interp2[3]=-0.333333*frac1+0.5*frac1 2 -0.166667*frac1 3
wherein, the interpolation 2[ b ] represents the b coefficient value in the cubic spline interpolation, b is 0,1,2 and 3, and the 1 is the duty ratio position of the target row number.
On the basis of the above optimization, determining, from the reference filter coefficient table, the association coefficient value of the reference filter coefficient to which the extension index value is associated according to the interpolation coefficient may include: taking the sum of the difference value of the extended index value and one set constant value and the interpolation coefficient as an associated lower index value in a basic filtering coefficient table, wherein the set constant value is one quarter of the target constant value; and determining a reference coefficient value corresponding to the associated lower standard value in the basic filtering coefficient table as an associated reference coefficient value.
Further, the device also optimally comprises a label acquisition module, a selection sequence determination module and a filter coefficient ordering module, wherein the label acquisition module is used for acquiring a position label set before filtering processing is carried out on each sampling point according to a target sampling rate to be resampled and a pre-stored target filter coefficient table to obtain a second number of resampling points, and the position label set comprises position labels of each target filter coefficient in the target filter coefficient table; the selected sequence determining module is used for determining a selected sequence number corresponding to each position mark in the position mark set, and selecting a corresponding target filter coefficient from the target filter coefficient table according to the sequence of the selected sequence number; the filter coefficient ordering module is used for storing each target filter coefficient selected according to the sequence of each selected sequence number in the memory to form a new target filter coefficient table.
Further, the selected order determination module is specifically configured to set a skip row variable initialized to 0, an offset column variable, and a selected row variable; multiplying the jump line variable by the filter length value and then determining the sum of the jump line variable and the offset column variable as the current position label in the position label set; multiplying the selected row variable by the filter length value, and determining the sum of the selected row variable and the offset column variable as a selected sequence number corresponding to the current position mark; adding 1 to the offset column variable as a new offset column variable, and returning to execute the determining operation of the current position label until the offset column variable reaches the filtering length value; setting the value of the offset column variable to 0 and adding 1 to the selected row variable as a new selected row variable; updating the jump line variable based on a given line offset updating formula, and returning to execute the determination operation of the current position index until the value of the selected line variable reaches the target line number.
Further, the row offset update formula may be expressed as:
samp_num= (samp_num+numrate%Denrate)%Denrate, where numrate is the quotient of the current sampling rate and a given value, the given value being the greatest common divisor of the current sampling rate and the target sampling rate, and the Denrate represents the target number of lines.
Further, the resampling processing module is specifically configured to determine, according to the target sampling rate, the number of sampling points to be formed into resampled points after resampling and record the number as a second number; taking a sampling label of a first sampling point in the audio data to be resampled as a current sampling label; taking the first row in the target filtering coefficient table as the current row, and setting an intermediate variable and a length variable initialized to 0; obtaining each target filter coefficient included in the current row to form a current filter coefficient sequence; acquiring each sampling point with the current sampling label as a starting point and the length as the filtering length value from the audio data to be resampled to form current audio data; correspondingly multiplying and adding signal values of all sampling points in the current audio data with all target filter coefficients in the current filter coefficient sequence; adding the obtained addition result as a signal value of a resampling point to a resampling output sequence, and adding the value of the length variable by 1; updating the current sampling index by a first updating formula, updating the intermediate variable by a second updating formula, taking the next row of the current row as a new current row, and returning to continuously execute to acquire each target filter coefficient included in the current row to form a current filter coefficient sequence until the intermediate variable is greater than or equal to the target row number; taking the next sampling label of the current sampling label as a new current sampling label, updating the intermediate variable by a third updating formula, taking the next line of the current line as a new current line, and returning to continuously execute the acquisition of each target filter coefficient included in the current line to form a current filter coefficient sequence until the current sampling label is the sampling label of the last sampling point in the audio data to be resampled or the value of the length variable is equal to the second quantity; resampled audio data is formed based on signal values of respective resampled points in the resampled output sequence.
Further, the first updated formula may be expressed as:
lastsample=lastsample+numrate/Denrate, where lastsample represents the current sample index in the audio data to be resampled;
the second updated formula may be expressed as:
samp_frac_num=samp_frac_num+numrate%denrate,
the third updated formula may be expressed as:
samp_frac_num=samp_frac_num-denrate,
wherein lastsample represents a current sampling index in the audio data to be resampled, samp_frac_num represents the intermediate variable, numrate is a quotient of the current sampling rate and a given value, the given value is a greatest common divisor of the current sampling rate and the target sampling rate, and denominator represents the target line number.
Further, the device also comprises: and the resampling destroying module is used for clearing the cache information cached in the memory when the sampling points are subjected to filtering processing after the resampling audio data containing the second number of resampling points are obtained.
Example III
Fig. 7 is a schematic hardware structure of an audio resampling apparatus according to a third embodiment of the present invention. As shown in fig. 7, the audio resampling apparatus may specifically include: processor 60, storage device 61, display 62, input device 63, output device 64, and communication device 65. The number of processors 60 in the audio resampling apparatus may be one or more, one processor 60 being exemplified in fig. 7. The number of storage means 61 in the audio resampling apparatus may be one or more, one storage means 61 being exemplified in fig. 7. The processor 60, the storage means 61, the display 62, the input means 63, the output means 64 and the communication means 65 of the audio resampling apparatus may be connected by a bus or otherwise, in fig. 7 by way of example.
The storage device 61 is used as a computer readable storage medium for storing software programs, computer executable programs and modules, and program requests/modules (e.g., the sampling point acquisition module 21 and the resampling processing module 22 in the audio resampling apparatus) corresponding to the audio resampling method and/or the image stitching method according to any embodiment of the present invention. The storage device 61 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating device, at least one application program required for a function; the storage data area may store data created from the use of the audio resampling apparatus, and the like. Further, the storage 61 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some examples, the storage 61 may further include memory remotely located with respect to the processor 60, which may be connected to the audio resampling apparatus via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The display 62 is a touch-enabled display that may be a capacitive screen, an electromagnetic screen, or an infrared screen. Generally, the display 62 is used for displaying data according to the instruction of the processor 60, and also is used for receiving a touch operation applied to the display 62 and transmitting a corresponding signal to the processor 60 or other devices. Optionally, when the display screen 62 is an infrared screen, it further includes an infrared touch bezel disposed around the display screen 62, which may also be used to receive infrared signals and transmit the infrared signals to the processor 60 or other computer device.
The input means 63 may be used for receiving input digital or character information and for generating key signal inputs related to user settings and function control of the audio resampling apparatus, as well as a camera for capturing images and a sound pick-up audio resampling apparatus for capturing audio in video data. The output means 64 may comprise a video audio resampling device such as a display screen and an audio resampling device such as a speaker. The specific composition of the input device 63 and the output device 64 may be set according to the actual situation.
The communication means 65 may be used to establish a communication connection with other audio resampling apparatuses, which may be a wired communication means and/or a wireless communication means.
The processor 60 performs various functional applications of the audio resampling apparatus and data processing, i.e. implements the above-described audio resampling method, by running software programs, requests and modules stored in the storage 61.
Specifically, in the embodiment, when the processor 60 executes one or more programs stored in the storage device 61, the following operations are specifically implemented: intercepting audio data at a current sampling rate to obtain audio data to be resampled, wherein the audio data comprises a first number of sampling points; filtering each sampling point according to a target sampling rate to be resampled and a pre-stored target filtering coefficient table to obtain resampled audio data containing a second number of resampling points;
the target filter coefficients included in the target filter coefficient table are obtained through interpolation processing of reference filter coefficients in a preset reference filter coefficient table, the target table length of the target filter coefficients is larger than the reference table length, and the reference table length of the reference filter coefficient table is associated with a preset over-sampling value and a preset filter length value.
The embodiment of the present invention also provides a computer readable storage medium, where a program in the storage medium, when executed by a processor of an audio resampling apparatus, enables the audio resampling apparatus to perform the audio resampling method described in the above method embodiment. Illustratively, the audio resampling method comprises: intercepting audio data at a current sampling rate to obtain audio data to be resampled, wherein the audio data comprises a first number of sampling points; filtering each sampling point according to a target sampling rate to be resampled and a pre-stored target filtering coefficient table to obtain resampled audio data containing a second number of resampling points;
The target filter coefficients included in the target filter coefficient table are obtained through interpolation processing of reference filter coefficients in a preset reference filter coefficient table, the target table length of the target filter coefficients is larger than the reference table length, and the reference table length of the reference filter coefficient table is associated with a preset over-sampling value and a preset filter length value.
It should be noted that, for the apparatus, the audio resampling apparatus, and the storage medium embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and the relevant points are referred to in the description of the method embodiments.
From the above description of embodiments, it will be clear to a person skilled in the art that the present invention may be implemented by means of software and necessary general purpose hardware, but of course also by means of hardware, although in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, etc., comprising several requests for a single audio resampling apparatus (which may be a robot, a personal computer, a server, or a network device, etc.) to perform the audio resampling method and/or the image stitching method according to any embodiment of the present invention.
It should be noted that, in the audio resampling apparatus, each unit and module included are only divided according to the functional logic, but not limited to the above division, so long as the corresponding functions can be implemented; in addition, the specific names of the functional units are also only for distinguishing from each other, and are not used to limit the protection scope of the present invention.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable request execution device. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (22)

1. A method of audio resampling comprising:
intercepting audio data at a current sampling rate to obtain audio data to be resampled, wherein the audio data comprises a first number of sampling points;
filtering each sampling point according to a target sampling rate to be resampled and a pre-stored target filtering coefficient table to obtain resampled audio data containing a second number of resampling points;
the target filter coefficients contained in the target filter coefficient table are obtained through interpolation processing of reference filter coefficients in a preset reference filter coefficient table, the target table length of the target filter coefficients is larger than the reference table length of the reference filter coefficient table, the reference table length of the reference filter coefficient table is associated with preset over-sampling values and filter length values, and the over-sampling values and the filter length values are associated with preset resampled filter quality values.
2. The method of claim 1, wherein the step of determining the position of the substrate comprises,
when the current sampling rate is less than the target sampling rate, the first number is less than the second number;
the first number is greater than the second number when the current sampling rate is greater than the target sampling rate.
3. The method of claim 1, wherein the step of pre-determining the table of reference filter coefficients comprises:
acquiring a set filter quality value, searching a pre-stored filter quality table, and acquiring a corresponding over-sampling value and a filter length value under the filter quality value;
and determining a reference filter coefficient table with the length of the reference table being a third quantity value based on the over-sampling value and the filter length value.
4. A method according to claim 3, wherein said determining a reference filter coefficient table having a reference table length of a third number of values based on said over-sampled value and filter length value comprises:
according to the over-sampling value, the filtering length value and the given target constant value, determining a third quantity value serving as a reference filtering length, acquiring an audio decibel limiting weight value under the filtering quality value, and setting an initialization value of a reference length variable;
Determining the corresponding octyl function value of the given octyl function when the independent variable value is equal to the value of the reference length variable, and determining the corresponding interpolation result value when the intermediate variable value in the given Kaiser window cubic spline interpolation processing formula is equal to the value of the reference length variable;
taking the product value of the sine function value, the interpolation result value and the audio decibel limiting weight value as a reference coefficient value of a reference filter coefficient corresponding to the reference length variable, and correspondingly writing the reference coefficient value into the reference filter coefficient table;
and adding 1 to the value of the reference length variable to serve as a new reference length variable, and returning to the determining operation of the sine function value and the interpolation result value until the reference length variable reaches the length of the reference table.
5. The method of claim 4, wherein the step of determining the position of the first electrode is performed,
the sine function is expressed as:
wherein i represents a reference length variable as an argument, the initialization value of i is-k/2, k is a given target constant value which is a multiple of 4; cutoff represents the audio db limiting weight value at the filter quality value, oversamples represents the over-sampled value, and filelen represents the filter length value; sinc (i) is expressed as the sing function value when i is the corresponding reference length variable.
6. The method of claim 4, wherein the step of determining the position of the first electrode is performed,
the Kaiser window cubic spline interpolation processing formula is expressed as follows:
win represents an interpolation result value of a Kaiser window by cubic spline interpolation, interp1[ a ] represents an a-th coefficient value in the cubic spline interpolation, and
interp1[0]=-0.333333*frac+0.5*frac 2 -0.166667*frac 3
interp1[1]=1-0.5*frac-frac 2 -0.5*frac 3
interp1[2]=frac+0.5*frac 2 -0.5*frac 3
interp1[3]=-0.166667*frac+0.166667*frac 3
frac=y-ind represents the fractional part of the y value, ind=floor (y) is expressed as a downward rounding to y;
representation->I represents a reference length variable as an intermediate variable, the initial reference length variable being-k/2, k being the target constant value, oversamples representing the oversampled value, and filtered lengths representing the filtered length values; kaiser [ ind+a ]]And the element value with the index of ind+a in the Kaiser window array corresponding to the filter quality value is represented.
7. The method of claim 4, wherein the target filter coefficient table is represented by a two-dimensional array of the determined target number of rows and the determined number of columns as the filter length value, and a product of the target number of rows and the filter length value is used as a target filter length of the target filter coefficient table;
the target line number is the quotient of the target sampling rate and a given value, and the given value is the greatest common divisor of the current sampling rate and the target sampling rate.
8. The method of claim 7, wherein the step of interpolating reference filter coefficients in a predetermined reference filter coefficient table to obtain the target filter coefficient table comprises:
according to the target line number, the over-sampling value and the filtering length value, determining the extended index values with the same number as the target table length, and obtaining an index two-dimensional array formed by the extended index values;
for each extended index value in the index two-dimensional array, interpolation processing is carried out on the reference filter coefficient associated with the extended index value in the reference filter coefficient table, and a target filter coefficient corresponding to the extended index value is obtained;
a target filter coefficient table including each of the target filter coefficients is obtained.
9. The method of claim 8, wherein determining the same number of extended index values as the target table length based on the target line number, the over-sampled value, and the filter length value, and obtaining an index two-dimensional array of each of the extended index values, comprises:
creating an initial two-dimensional array with the number of lines being the target number of lines and the number of columns being the filter length value, and taking the line index value of the first line in the initial two-dimensional array as a current line index value and the column index value of the first column as a current column index value;
Taking the product of the current column index value added with 1 and the over-sampling value as a first intermediate value, taking the quotient of the current column index value multiplied by the over-sampling value and the target line number as a second intermediate value, and taking the difference between the first intermediate value and the second intermediate value as a third intermediate value;
taking the current row index value and the current column index value as current two-dimensional subscript of the initial two-dimensional array, and writing the sum of half of the target constant value and the third intermediate value as an expansion index value into the corresponding element position of the current two-dimensional subscript in the initial two-dimensional array;
adding 1 to the current column index value to serve as a new current column index value, and returning to the determining operation of the third intermediate value until the current column index value reaches the filtering length value;
taking the first column index value in the initial two-dimensional array as a new current column index value, adding 1 to the current row index value as a new current row index value, and returning to the determination operation of a third intermediate value until the current row index value reaches the target row number;
the initial two-dimensional array written with each extended index value is determined as an index two-dimensional array.
10. The method according to claim 8, wherein interpolating the reference filter coefficients associated with the extended index value in the reference filter coefficient table to obtain the target filter coefficient corresponding to the extended index value, comprises:
Obtaining a target index value of the extended index value in the index two-dimensional array;
determining four interpolation coefficients for cubic spline interpolation processing according to the target landmark value, the over-sampling value and the target line number;
for each interpolation coefficient, determining an associated reference coefficient value of the reference filter coefficient associated with the extended index value from the reference filter coefficient table according to the interpolation coefficient, and recording the product of the associated reference coefficient value and the interpolation coefficient as an associated intermediate value;
and taking the sum of the associated intermediate values as a target filter coefficient corresponding to the extended index value.
11. The method of claim 10, wherein determining four interpolation coefficients for a cubic spline interpolation process based on the target landmark value, the over-sampled value, and the target number of lines comprises:
determining the product of the target landmark value and the over-sampling value, and marking the product as a target product value;
determining the remainder of the target product value and the target line number, and marking the remainder as a target remainder value;
determining the quotient of the target remainder value and the target line number as the duty ratio position of the target line number in the target line number;
And determining four interpolation coefficients for cubic spline interpolation according to the duty ratio position and a given four interpolation coefficient determination formula.
12. The method of claim 11, wherein the four interpolation coefficient determination formulas are expressed as:
interp2[0]=-0.166667*frac1+0.166667*frac1 3
interp2[1]=frac1+0.5*frac1 2 -0.5*frac1 3
interp2[2]=1-0.5*frac1-frac1 2 -0.5*frac1 3
interp2[3]=-0.333333*frac1+0.5*frac1 2 -0.166667*frac1 3
wherein, the interpolation 2[ b ] represents the b coefficient value in the cubic spline interpolation, b is 0,1,2 and 3, and the 1 is the duty ratio position of the target row number.
13. The method according to claim 10, wherein determining, from the reference filter coefficient table, the association coefficient value of the reference filter coefficient to which the extension index value is associated according to the interpolation coefficient, comprises:
taking the sum of the difference value of the extended index value and one set constant value and the interpolation coefficient as an associated lower index value in a basic filtering coefficient table, wherein the set constant value is one quarter of the target constant value;
and determining a reference coefficient value corresponding to the associated lower standard value in the basic filtering coefficient table as an associated reference coefficient value.
14. The method of claim 1, further comprising, before filtering each of the sampling points according to the target sampling rate to be resampled and the pre-stored target filtering coefficient table to obtain the second number of resampling points:
Acquiring a position index set, wherein the position index set comprises position indexes of each target filter coefficient in the target filter coefficient table;
determining a selected sequence number corresponding to each position mark in the position mark set, and selecting a corresponding target filter coefficient from a target filter coefficient table according to the sequence of the selected sequence number;
the target filter coefficients selected in the order of the selected sequence numbers are stored in a memory to form a new target filter coefficient table.
15. The method of claim 14, wherein said determining a selected sequence number for each position index in said set of position indices comprises:
setting a skip row variable initialized to 0, an offset column variable, and a selected row variable;
multiplying the jump line variable by the filter length value and then determining the sum of the jump line variable and the offset column variable as the current position label in the position label set;
multiplying the selected row variable by the filter length value, and determining the sum of the selected row variable and the offset column variable as a selected sequence number corresponding to the current position mark;
adding 1 to the offset column variable as a new offset column variable, and returning to execute the determining operation of the current position label until the offset column variable reaches the filtering length value;
Setting the value of the offset column variable to 0 and adding 1 to the selected row variable as a new selected row variable;
updating the jump line variable based on a given line offset updating formula, and returning to execute the determination operation of the current position index until the value of the selected line variable reaches the target line number.
16. The method of claim 15, wherein the row offset update formula is expressed as:
samp_num= (samp_num+numrate% Denrate)% Denrate, where numrate is the quotient of the current sampling rate and a given value, the given value being the greatest common divisor of the current sampling rate and the target sampling rate; the repetition represents the target number of rows.
17. A method according to claim 3, wherein filtering each of the sampling points according to a target sampling rate to be resampled and a pre-stored target filtering coefficient table to obtain resampled audio data comprising a second number of resampling points comprises:
determining the number of sampling points to be formed into resampling points after resampling according to the target sampling rate, and recording the number as a second number;
taking a sampling label of a first sampling point in the audio data to be resampled as a current sampling label;
Taking the first row in the target filtering coefficient table as the current row, and setting an intermediate variable and a length variable initialized to 0;
obtaining each target filter coefficient included in the current row to form a current filter coefficient sequence;
acquiring each sampling point with the current sampling label as a starting point and the length as the filtering length value from the audio data to be resampled to form current audio data;
correspondingly multiplying and adding signal values of all sampling points in the current audio data with all target filter coefficients in the current filter coefficient sequence;
adding the obtained addition result as a signal value of a resampling point to a resampling output sequence, and adding the value of the length variable by 1;
updating the current sampling index by a first updating formula, updating the intermediate variable by a second updating formula, taking the next row of the current row as a new current row, and returning to continuously execute to acquire each target filter coefficient included in the current row to form a current filter coefficient sequence until the intermediate variable is greater than or equal to the target row number;
taking the next sampling label of the current sampling label as a new current sampling label, updating the intermediate variable by a third updating formula, taking the next line of the current line as a new current line, and returning to continuously execute the acquisition of each target filter coefficient included in the current line to form a current filter coefficient sequence until the current sampling label is the sampling label of the last sampling point in the audio data to be resampled or the value of the length variable is equal to the second quantity;
Resampled audio data is formed based on signal values of respective resampled points in the resampled output sequence.
18. The method of claim 17, wherein the first updated formula is expressed as:
lastsample=lastsample+numrate/denrate,
the second updated formula is expressed as:
samp_frac_num=samp_frac_num+numrate%denrate,
the third updated formula is expressed as:
samp_frac_num=samp_frac_num-denrate,
wherein lastsample represents a current sampling index in the audio data to be resampled, samp_frac_num represents the intermediate variable, numrate is a quotient of the current sampling rate and a given value, the given value is a greatest common divisor of the current sampling rate and the target sampling rate, and denominator represents the target line number.
19. The method according to any one of claims 1-18, further comprising, after obtaining the resampled audio data comprising the second number of resampled points:
and clearing the cache information cached in the memory during the filtering processing of each sampling point.
20. An audio resampling apparatus, comprising:
the sampling point acquisition module is used for intercepting the audio data at the current sampling rate to acquire the audio data to be resampled, wherein the audio data comprises a first number of sampling points;
the resampling processing module is used for carrying out filtering processing on each sampling point according to a target sampling rate to be resampled and a pre-stored target filtering coefficient table to obtain resampled audio data containing a second number of resampling points;
The target filter coefficients contained in the target filter coefficient table are obtained through interpolation processing of reference filter coefficients in a preset reference filter coefficient table, the target table length of the target filter coefficients is larger than the reference table length of the reference filter coefficient table, the reference table length of the reference filter coefficient table is associated with preset over-sampling values and filter length values, and the over-sampling values and the filter length values are associated with preset resampled filter quality values.
21. An audio resampling apparatus, comprising:
one or more processors;
a storage means for storing one or more programs;
the one or more programs being executed by the one or more processors to cause the one or more processors to implement the method of any of claims 1-19.
22. A computer storage medium storing one or more programs which when executed by a processor implement the method of any of claims 1-19.
CN201911182538.8A 2019-11-27 2019-11-27 Audio resampling method, device, equipment and storage medium Active CN110956970B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911182538.8A CN110956970B (en) 2019-11-27 2019-11-27 Audio resampling method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911182538.8A CN110956970B (en) 2019-11-27 2019-11-27 Audio resampling method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110956970A CN110956970A (en) 2020-04-03
CN110956970B true CN110956970B (en) 2023-11-14

Family

ID=69976963

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911182538.8A Active CN110956970B (en) 2019-11-27 2019-11-27 Audio resampling method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110956970B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112564670B (en) * 2020-11-20 2023-11-21 核工业二〇八大队 Filtering method for power frequency noise interference of audio magnetotelluric data
CN113823333B (en) * 2021-08-27 2022-11-15 深圳市灵镜技术有限公司 Method and system for controlling rising and falling of PCM audio sampling rate
CN114242105A (en) * 2022-02-24 2022-03-25 麒麟软件有限公司 Method and system for implementing recording and noise reduction on Android application

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005096508A1 (en) * 2004-04-01 2005-10-13 Beijing Media Works Co., Ltd Enhanced audio encoding and decoding equipment, method thereof
CN101714379A (en) * 2008-10-08 2010-05-26 安凯(广州)软件技术有限公司 Audio resampling method
CN103259602A (en) * 2012-02-15 2013-08-21 安立股份有限公司 Method and system for signal generation
CN103440313A (en) * 2013-08-27 2013-12-11 复旦大学 Music retrieval system based on audio fingerprint features
CN104426485A (en) * 2013-08-30 2015-03-18 富士通株式会社 Device and method for digital pre-distortion

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005096508A1 (en) * 2004-04-01 2005-10-13 Beijing Media Works Co., Ltd Enhanced audio encoding and decoding equipment, method thereof
CN101714379A (en) * 2008-10-08 2010-05-26 安凯(广州)软件技术有限公司 Audio resampling method
CN103259602A (en) * 2012-02-15 2013-08-21 安立股份有限公司 Method and system for signal generation
CN103440313A (en) * 2013-08-27 2013-12-11 复旦大学 Music retrieval system based on audio fingerprint features
WO2015027751A1 (en) * 2013-08-27 2015-03-05 复旦大学 Audio fingerprint feature-based music retrieval system
CN104426485A (en) * 2013-08-30 2015-03-18 富士通株式会社 Device and method for digital pre-distortion

Also Published As

Publication number Publication date
CN110956970A (en) 2020-04-03

Similar Documents

Publication Publication Date Title
CN110956970B (en) Audio resampling method, device, equipment and storage medium
CN109634598B (en) Page display method, device, equipment and storage medium
JP6651629B2 (en) Expansion of neural network using external memory
CN111639476B (en) Support of location cards by operating systems
KR102170620B1 (en) Method and system for generating training data to train classifiers with localizable features
US20160313874A1 (en) Visual effects system for "big data" analysis workflow editors, distribution platforms, execution engines, and management systems comprising same
CN101206663A (en) Apparatus and method for automatically composing album and managing cover image of album
CA2932897A1 (en) Visual effects system for "big data" analysis workflow editors, distribution platforms, execution engines, and management systems comprising same
JP6794347B2 (en) Application interface navigation
US20190370694A1 (en) Machine learning (ml) modeling by dna computing
CN111324330B (en) Electronic book playing processing method, computing device and computer storage medium
CN114443058A (en) Method for creating private mirror image in public cloud and related equipment
CN110232156A (en) Information recommendation method and device based on long text
CN112860188A (en) Data migration method, system, device and medium
CN110764702B (en) Data processing method, device and equipment and readable storage medium
KR102238025B1 (en) Information processing method and processing apparatus
US11151778B2 (en) Optimized browser object rendering
CN110536077B (en) Video synthesis and playing method, device and equipment
US10310823B2 (en) Program development support system and program development support software
CN110888649B (en) Application deployment method, application baseline creation method and device
CN115629763A (en) Target code generation method and NPU instruction display method and device
CN109358919A (en) Dynamic Configuration, device, computer equipment and the storage medium of Universal page
US11481088B2 (en) Dynamic data density display
CN104699765B (en) A kind of date storage method and mobile terminal
CN113158620A (en) Bookshelf page editing processing method, electronic equipment and computer storage medium

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