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

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

Info

Publication number
CN110956970A
CN110956970A CN201911182538.8A CN201911182538A CN110956970A CN 110956970 A CN110956970 A CN 110956970A CN 201911182538 A CN201911182538 A CN 201911182538A CN 110956970 A CN110956970 A CN 110956970A
Authority
CN
China
Prior art keywords
value
target
filter coefficient
length
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.)
Granted
Application number
CN201911182538.8A
Other languages
Chinese (zh)
Other versions
CN110956970B (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

Images

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 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 a target sampling rate to be resampled and a pre-stored target filter 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 by interpolation processing of the reference filter coefficient in the 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 the preset oversampling value and filter length value. Compared with the existing method, the method better saves the determination time of the target filter coefficient table for resampling processing, reduces the whole time consumption of audio resampling processing, and accordingly 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 a set of open source free engineering mainly aiming at voice, is widely adopted in voice projects at present, a resampling module in the engineering is used as a common means for switching sampling rate, a large amount of applications are provided in audio application products, and bottom technical support is provided for realizing various functions in the audio application products.
In audio applications, such as recording, playing, changing sound, and the like, all involve sampling rate conversion, and may be implemented by processing with a resampling module in Speex, however, when audio data is resampled based on the Speex existing resampling module, in the existing resampling implementation, a filter coefficient table required for resampling processing needs to be determined at a filter coefficient initialization stage, but determination of each filter coefficient in the filter coefficient table requires a large amount of repeated calculations, which is time-consuming, so that power consumption and resource occupation of a resampling execution carrier device are increased, and response latency after an audio application is triggered is lengthened.
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 execution 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 filter 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 by interpolating a reference filter coefficient in a predetermined reference filter coefficient table, the target table length of the target filter coefficient is greater than the reference table length, and the reference table length of the reference filter coefficient table is associated with a preset oversampling 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 obtain audio data to be resampled, wherein the audio data to be resampled 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 filter coefficient table to obtain resampling audio data containing a second number of resampling points;
the target filter coefficient contained in the target filter coefficient table is obtained by interpolating a reference filter coefficient in a predetermined reference filter coefficient table, the target table length of the target filter coefficient is greater than the reference table length, and the reference table length of the reference filter coefficient table is associated with a preset oversampling 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;
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, on which a computer program is stored, and the computer program, when executed by a processor, implements the method provided by the above-mentioned 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 each sampling point according to a target sampling rate to be resampled and a pre-stored target filter coefficient table to obtain resampled audio data containing a second number of resampling points, wherein the target filter coefficient contained in the target filter coefficient table is obtained by interpolating a reference filter coefficient in a pre-determined reference filter coefficient table, the target table length of the target filter coefficient is greater than the reference table length, and the reference table length of the reference filter coefficient table is associated with a preset oversampling value and a preset filter length value. Above-mentioned technical scheme, the target filter coefficient table for resampling processing mainly forms through interpolation processing on the basis of benchmark filter coefficient table, compare with current needs carry out complicated and repeated calculation and obtain the target filter coefficient table, this technical scheme better saves the time of confirming of the target filter coefficient table for resampling processing, the whole consuming time of audio frequency resampling processing has been reduced from this, thereby also reduced the consumption and the resource occupation of the carrier equipment who carries out audio frequency resampling processing, and then shortened the response latency of the audio frequency application that possesses audio frequency resampling after triggering.
Drawings
Fig. 1 is a flowchart illustrating an audio resampling method according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating an exemplary process for determining a reference filter coefficient table according to a first embodiment of the present invention;
FIG. 3 is a diagram illustrating an example of a process for determining a table of target filter coefficients according to a first embodiment of the present invention;
FIG. 4 is a flowchart illustrating an implementation of sorting target filter coefficients in a target filter coefficient table according to a first embodiment of the present invention;
FIG. 5 is a flowchart illustrating an implementation of resampling sample points to obtain resampled audio data according to a first embodiment of the present 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 diagram of a 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, embodiments of the present invention will be described in detail with reference to the accompanying drawings. It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. In addition, the embodiments and features of the embodiments of the present invention may be combined with each other without conflict, and the respective embodiments may be mutually referred to and cited.
It should be noted that the application scenarios of the embodiment of the present invention are applicable to various audio processing fields related to audio resampling processing, and are applicable to cases where audio data to be resampled in audio application is resampled based on a resampling module in Speex, and it can be known that the key for implementing resampling processing by an existing resampling module in Speex is to initialize a filter coefficient and resample audio data according to a filter coefficient table formed after initialization, and the existing resampling module has problems: the time consumption for initializing the filter coefficients is too long, for example, when the common sampling rate is changed from 16KHZ to 44.1KHZ, when the resampling filter quality value (default division is 10 quality levels 0-9) is set to 3, the number of the filter coefficients which need to be initialized is up to 21168, and each filter coefficient needs to be calculated by using the sine function and the cubic spline interpolation, if all the filter coefficients are determined to be equivalent to 21168 times of the sine function and the cubic spline interpolation, the operation is very inefficient, the operation is corresponding to the fact that the influence of the carrier device level is performed and the power consumption and resources of the device are excessively occupied, the influence of the audio application level is reflected in the response time after the audio application trigger is prolonged, and the user experience is reduced.
Based on the audio resampling method provided by the embodiment of the invention, the target filter coefficient table for resampling processing is directly obtained by interpolation processing on the basis of a predetermined reference filter coefficient table, and the method effectively avoids the problem that a large amount of repeated calculation is needed in the existing implementation, effectively shortens the processing time of audio resampling, and reduces the power consumption and resource occupation of the execution carrier equipment.
Example one
Fig. 1 is a schematic flowchart of an audio resampling method according to an 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 apparatus, where the audio resampling apparatus is equivalent to an execution carrier apparatus of the audio resampling method, and specifically may be a terminal apparatus with an audio application function.
As shown in fig. 1, a method for resampling audio according to an embodiment of the present invention includes the following operations:
it should be noted that the audio resampling method provided in this embodiment may be considered to start the following steps when the user needs to perform resampling processing after triggering a certain functional application in the operation process of an audio application after starting a certain audio application.
S101, intercepting the audio data at the current sampling rate to obtain audio data to be resampled, wherein the audio data comprises a first number of sampling points.
In this embodiment, the current sampling rate may be understood as a sampling rate adopted when the currently running audio application performs audio data sampling, 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 resampling processing is involved in audio application, the audio data is intercepted at a current sampling rate, so as to obtain audio data to be resampled for resampling processing, where when the audio data is intercepted at the current sampling rate, the number of sampling points included in the audio data to be resampled formed by the audio data is certain, for example, when the current sampling rate is 16KHZ, a frame length of a frame of audio data to be resampled obtained by sampling is 160, that is, the audio data to be resampled includes 160 sampling points.
And S102, filtering each sampling point according to the target sampling rate to be resampled and a pre-stored target filter 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 resampling processing when resampling processing is involved in an audio application, and a specific value of the target sampling rate may be determined according to a function application specifically triggered by a user in the audio application, for example, a default sampling rate of the audio application is 16KHZ, and when a user needs to record and selects 44.1KHZ to output recording content, 44.1KHZ thereof may be regarded as a target sampling rate to be resampled.
In this embodiment, the target filter coefficient table may be specifically understood as a filter coefficient set that is determined in advance at a resampling initialization stage and includes each target filter coefficient required for resampling, and in this embodiment, a manner of performing interpolation processing on a reference filter coefficient in a predetermined reference filter coefficient table is adopted to obtain a 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 amount of repeated calculations during conventional filter coefficient determination is avoided, and the time occupation of the stage of resampling initialization filter coefficients is reduced.
In addition, the reference filter coefficient table may be determined in advance by an existing filter coefficient calculation method, and although some repeated calculation is required when the reference filter coefficient table is determined by a given filter coefficient calculation method, the time taken for calculating and forming the entire target filter coefficient table is much shorter than the time taken for directly adopting the existing filter coefficient calculation method even if some repeated calculation is performed, because the length of the reference table in the reference filter coefficient table is far shorter than the target mark length of the target filter coefficient table.
In this embodiment, the length of the reference table of the reference filter coefficient table is associated with the oversampling value and the filter length value preset during resampling, and both the oversampling value and the filter length value are relatively small fixed values, it should be noted that both the settings of the two values are related to the preset re-sampling filter quality value, and the larger the filter quality value is, the larger the corresponding oversampling value and filter length value are, the larger the corresponding filter quality value is, and the proper filter quality value is selected in this embodiment, so that while the quality of resampling is ensured, it is ensured that the oversampling value and filter length value required for calculation have a small value.
Specifically, in this step, a section of filtered audio data may be formed corresponding to each sampling point, then a target filter coefficient sequence corresponding to each section of filtered audio data is selected from the target filter coefficient table, and then filtering processing is performed on the filtered audio data and the corresponding target filter coefficient sequence, so as to obtain a resampling point corresponding to each sampling point.
It is understood that the resampled audio data formed above includes a second number of resample points, the second number is determined in advance based on the determined target sampling rate, for example, 44.1KHZ, and on the premise that the target sampling rate is known to be 44.1KHZ, the data length of the intercepted frame of audio data at the sampling rate can be directly determined to be 441, that is, the data length is equivalent to 441 resample points included in the frame of resampled audio data formed after resampling.
It should be noted that, in this embodiment, the magnitude relationship between the first number and the second number is specifically associated with 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.
The audio resampling method provided by the first embodiment of the present invention intercepts audio data at a current sampling rate, and obtains audio data to be resampled that includes a first number of sampling points; and filtering each sampling point according to a target sampling rate to be resampled and a pre-stored target filter coefficient table to obtain resampled audio data containing a second number of resampling points, wherein the target filter coefficient contained in the target filter coefficient table is obtained by interpolating a reference filter coefficient in a pre-determined reference filter coefficient table, the target table length of the target filter coefficient is greater than the reference table length, and the reference table length of the reference filter coefficient table is associated with a preset oversampling value and a preset filter length value. By using the method, the determination time of the target filter coefficient table for the resampling processing is better saved, so that the overall time consumption of the audio resampling processing is reduced, the power consumption and the resource occupation of the carrier equipment for executing the audio resampling processing are 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, before determining the target filter coefficient table, the reference filter coefficient table needs to be determined, and the present embodiment performs the determination of the reference filter coefficient table based on the following steps. Specifically, fig. 2 is a diagram illustrating a flow of determining a reference filter coefficient table according to a first embodiment of the present invention, and as shown in fig. 2, the step of pre-determining the reference coefficient table according to this embodiment includes:
s1001, obtaining a set filtering quality value, searching a pre-stored filtering quality table, and obtaining an oversampling value and a filtering length value corresponding to the filtering quality value.
It should be noted that the audio resampling method provided in this embodiment is mainly an improvement of an existing audio resampling method of a resampling module in Speex engineering, and therefore, some parameters in the method provided in this embodiment are original parameters of the existing resampling module in Speex, for example, the filter quality is a parameter in the existing resampling module, and is used to limit the precision of an audio resampling result, a value of the filter quality is specifically divided into ten level values of 0 to 9, a higher selected level value indicates that the precision of an obtained audio resampling result is higher, and a specific value of the filter quality is denoted as a filter quality value, and can be set by a developer in an application product development stage.
In this step, the filtering quality value set by the developer in the development stage can be known, and the corresponding oversampling value and filtering length value under the filtering quality value can be determined by looking up the filtering quality table. For example, if the filter quality value is 3, the over-sampled value corresponding to the filter quality value is 8, and the filter length value is 48.
And S1002, determining a reference filter coefficient table with the reference table length being a third quantity value based on the oversampling value and the filter length value.
In this embodiment, after determining the oversampling value and the filter length value, the reference table length of the reference filter coefficient table may be determined directly based on the oversampling value and the filter length value, it may be understood that the reference table length may also be equivalent to the number of reference filter coefficients included in the reference filter coefficient table, the number of reference filter coefficients included in the reference filter coefficient table is a third number value, in consideration of a sampling rule in the filtering calculation, in this embodiment, the third number value is set to be equal to the sum of a product value of the oversampling value and the filter length value and a given target constant value, and the target constant value may be a constant taking 4 as a multiple, such as 8 or 12, but in order to ensure that the reference table length is in a suitable range, in this embodiment, it is preferable that the set constant is 8.
In this embodiment, the process of determining a reference coefficient value of a reference filter coefficient in a reference filter coefficient table in a loop implementation manner, specifically, the step of determining the reference filter coefficient table with the reference table length as a third quantity value based on the oversampling 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 oversampling value, the filter length value and a given target constant value, acquiring an audio decibel limit 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 that the filtering quality value is determined, the corresponding audio decibel limit weight value can be directly obtained. In this embodiment, a reference length variable is set for cyclically determining a reference coefficient value of each reference filter coefficient in the reference filter coefficient table, and an initialization value of the reference length variable is 0.
b) And determining a corresponding sine function value of the given sine function when the argument value is equal to the value of the reference length variable, and determining a 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 represented as:
Figure BDA0002291655420000061
wherein i represents a reference length variable as an independent variable in the Singer function, the initialization value of i is-k/2, and k is a given target constant value which is multiplied by 4; cutoff represents an audio decibel limit weight value under the filtering quality value, oversample represents the oversampling value, and filterlen represents the filtering length value; sinc (i) represents the sine function value when i is the corresponding value.
Further, the formula for the Kaiser window cubic spline interpolation is expressed as:
Figure BDA0002291655420000071
win represents the interpolation result value processed by cubic spline interpolation for the Kaiser window, interp1[ a ] represents the a-th coefficient value in the cubic spline interpolation, and
interp1[0]=-0.333333*frac+0.5*frac2-0.166667*frac3
interp1[1]=1-0.5*frac-frac2-0.5*frac3
interp1[2]=frac+0.5*frac2-0.5*frac3
interp1[3]=-0.166667*frac+0.166667*frac3
frac-ind represents the fractional part of the y value, ind-floor (y) represents the rounding down of y;
Figure BDA0002291655420000072
to represent
Figure BDA0002291655420000073
Absolute value of (1) and oversample, i represents a reference length variable which is an intermediate variable in cubic spline interpolation processing, the initial value of i is-k/2, and k is the value of the target constant; kaiser [ ind + a [ ]]And representing the element value with index of ind + a in the corresponding Kaiser window array under the filtering quality value.
c) And taking the product value of the sine function value, the interpolation result value and the audio decibel limit 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.
It can be understood that, on the premise of giving a current value of a reference length variable, by combining the above-mentioned sine function and a casser window cubic spline interpolation processing formula, a corresponding sine function value and an interpolation result value can be respectively determined, and a reference coefficient value of a reference filter coefficient corresponding to the reference length variable when the reference length variable takes a value at present can be a product value of the multiplication of the sine function value and the interpolation result value and an audio decibel limit weight value; the present embodiment may write the reference coefficient value to a position in the reference length filter coefficient table that is indexed by the current value of the reference length variable.
d) And (c) adding 1 to the value of the reference length variable to serve as a new reference length variable, and returning to execute the step b) until the reference length variable reaches the length of the reference table.
The present embodiment may 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 at a corresponding position in the reference filter coefficient table until the iteration is stopped when the reference length variable reaches the reference filter length.
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. Therefore, the technical scheme of determining the reference filter coefficient table in the optional embodiment greatly reduces the occupation of calculation amount and calculation time, and improves the processing efficiency of resampling.
On the basis of the above embodiment, the target filter coefficient table is represented by a two-dimensional array in which one row is the determined target row number and the column number is 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.
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 target row number is 441 which is the quotient of 44100, and further the filter length is 48, the target filter coefficient table can be regarded as a two-dimensional array with 441 rows and 48 columns.
In this embodiment, after the reference filter coefficient table is determined, in order to ensure normal operation of S102, a target filter coefficient table needs to be obtained on the basis of the reference filter coefficient table, and specifically, the target filter coefficient in the target filter coefficient table may be obtained by performing cubic spline interpolation on the reference filter coefficient in the reference filter coefficient table.
Accordingly, fig. 3 is a diagram illustrating an example of a process for determining a target filter coefficient table according to a first embodiment of the present invention, and as shown in fig. 3, the step of obtaining the target filter coefficient table by performing interpolation processing on the reference filter coefficients in the predetermined reference filter coefficient table may be described as follows:
s1003, determining the number of expansion index values with the same length as the target table according to the target line number, the oversampling value and the filter length value, and obtaining an index two-dimensional array formed by the expansion 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 an interpolation position where the reference filter coefficient table performs cubic spline interpolation, where the interpolation position is determined by extension index values, the number of the extension index values is the same as the number of the target table lengths, and each extension index value may be determined by a given target line number, an oversampling value, and a filter length value. Because the target filter coefficients in the target filter coefficient table are obtained by 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 length of the reference table, and the condition that the values of the extension index values determined based on the step are the same is considered in consideration that the length of the reference table of the reference filter coefficient table is far smaller than the length of the target table
When the target filter coefficient table is known to be represented by a two-dimensional array, the extended index values whose number is 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 referred to as an index two-dimensional array. It is understood that the determination of the extended index value in the present embodiment is also a loop iteration process.
Specifically, according to the target line number, the oversampling value and the filter length value, the extension index values with the same number as the length of the target table are determined, and the index two-dimensional array composed of the extension index values is obtained, which can be realized by the following steps:
a) and creating an initial two-dimensional array with the row number as a target row number and the column number as a filtering length value, and taking the row index value of the first row in the initial two-dimensional array as a current row index value and taking the column index value of the first column as a current column index value.
In this embodiment, it may be assumed that the initial two-dimensional array is represented by a [ denrate ] [ filterlen ], where denrate represents the total number of rows of the target row number, filterlen represents the total number of columns of the filter length value, and the element value corresponding to the first row and the first column in the initial two-dimensional array may be represented by 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 plus 1 and the oversampling value as a first intermediate value, taking the quotient of the current row index value multiplied by the oversampling value and the target row 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 row index value and the current column index value as the current two-dimensional subscript of the initial two-dimensional array, and taking the sum of half of the target constant value and the third intermediate value as an expansion index value to write the corresponding element position of the current two-dimensional subscript in the initial two-dimensional array.
Illustratively, [0] [0] in a [0] [0] corresponds to the current two-dimensional index of the initial two-dimensional array, and the target constant value is a constant value employed when the reference coefficient value of the reference filter coefficient is determined. In the step, the calculated numerical value is written into the element position of the initial two-dimensional array corresponding to the current two-dimensional subscript as an extension index value.
d) And b), adding 1 to the current list value to serve as a new current list value, and returning to execute the step b) until the current list value reaches the filtering length value.
e) And taking the column index value of the first column 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 execute the step b) until the current row index value reaches the target row number.
f) And determining the initial two-dimensional array written with each expansion index value as an index two-dimensional array.
After the extension index values are written in the positions of the two-dimensional subscripts of the initial two-dimensional array through the circulation, the index two-dimensional array containing the extension index values is formed.
Illustratively, taking a target constant value of 8, a target row number of 441, and a filter length value of 48 as an example, in the above loop operation, it is equivalent to first take the current row index value of 0, and then perform 48 loops when the current column index value takes 0-47 respectively, thereby obtaining 48 extended index values when the current row index value is 0; then, the current row index value can be added with 1, 48 times of circulation when the current column index value respectively takes 0-47 is repeatedly carried out, so that 48 expansion index values when the current row index value is 1 are obtained, then, the current row index value can be sequentially taken from 2-440, and finally, 48 times of 441 expansion index values are obtained.
S1004, for each extended index value in the index two-dimensional array, performing interpolation processing on the reference filter coefficient associated with the extended index value in the reference filter coefficient table to obtain a target filter coefficient corresponding to the extended index value.
In this embodiment, in order to obtain a target filter coefficient table whose target table length is a product of the target line number and the filter length value, the present embodiment considers that the reference filter coefficient table is subjected to interpolation processing in combination with each extension index value to obtain a target filter coefficient corresponding to each extension index value.
Further, for each extension index value, performing interpolation processing on the reference filter coefficient associated with the extension index value in the reference filter coefficient table to obtain a target filter coefficient corresponding to the extension index value, includes:
a) and obtaining a target row 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 values may be recorded 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 row index value, the oversampling value and the target row number.
Illustratively, determining four interpolation coefficients for cubic spline interpolation processing according to the target row index value, the oversampling value and the target row number includes: determining the product of the target row mark value and the oversampling value, and recording as a target product value; determining the remainder of the target product value and the target line number, and recording the remainder as a target remainder value; determining the quotient of the target remainder value and the target line number as the proportion position of the target line standard value in the target line number; and determining four interpolation coefficients for cubic spline interpolation processing according to the ratio positions and a given four interpolation coefficient determination formula.
Wherein, the four interpolation coefficient determination formulas are respectively expressed as:
interp2[0]=-0.166667*frac1+0.166667*frac13
interp2[1]=frac1+0.5*frac12-0.5*frac13
interp2[2]=1-0.5*frac1-frac12-0.5*frac13
interp2[3]=-0.333333*frac1+0.5*frac12-0.166667*frac13
wherein interp2[ b ] represents the value of the b-th coefficient in cubic spline interpolation, b takes 0,1,2 and 3, frac1 is the proportion position of the target row index value in the target row number.
c) And for each interpolation coefficient, determining an associated reference coefficient value of the reference filter coefficient associated with the expansion 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 the interpolation coefficients are determined as described above, 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 a set constant value and the interpolation coefficient as an associated index value in a basic filter coefficient table, wherein the set constant value is one fourth of the target constant value; and determining the reference coefficient value corresponding to the associated index value in the basic filter 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 expansion index value.
It can be understood that the cubic spline interpolation process includes four interpolation coefficients, and one associated intermediate value may be determined for each interpolation coefficient.
For example, in the above operation of determining the target filter coefficient, the target constant value may still be 8, the target line number is 441, the filter length value is 48, and the oversampling value is 8, assuming that the currently selected extended index value is index00If the current target row index value is 0, determining a formula by combining the oversampling value, the target row number and the four interpolation coefficients, and determining the four corresponding interpolation coefficients under the extended index value; then, for the b-th interpolation coefficient, the index value index is extended00The associated reference filter coefficients in the reference filter coefficient table are sinctemp [ index ] respectively00-k/4+b]If b is 0, the interpolation coefficient is extended by the index value index00The corresponding associated reference filter coefficient in the reference filter coefficient table is sinc temp index00-2]When b is 1, the corresponding associated reference filter coefficient is sinc temp [ index ]00-1]When b is 2, the corresponding associated reference filter coefficient is sinc temp [ index ]00]When b is 3, the corresponding associated reference filter coefficient is sinc temp [ index ]00+1]. Next, sincutemp [ index ] can be set separately00-2],sinctemp[index00-1],sinctemp[index00]And sincutemp [ index [ ]00+1]Multiplying with corresponding interpolation coefficient to obtain respective associated intermediate values, and determining the added value of the associated intermediate values as the extended index value index00The corresponding target filter coefficient.
S1005, obtaining a target filter coefficient table containing each of the target filter coefficients.
In this embodiment, after the target filter coefficient corresponding to the extension index value is determined based on S1004, the target filter coefficient table including the target filter coefficient can be obtained by determining each target filter coefficient corresponding to the target table length.
In the above optional embodiment, the process of obtaining the target filter coefficient table is specifically implemented by performing 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 sigma-delta function calculation, thereby reducing the calculation time and the calculation resource occupation, and accelerating the processing time of audio resampling.
It should be noted that, in the audio resampling process, the most critical step is to select a set of target filter coefficients from the audio data to be processed formed by corresponding sampling points in the target filter coefficient table to perform filter calculation, in the existing audio resampling method, the target filter coefficient table is only stored conventionally when being stored in the memory, and in such a storage manner, after the resampling process stage, when the corresponding target filter coefficients are selected for each sampling point in the memory, the reading addresses in the memory are jumped and are not read in a continuous sequence, thereby destroying the continuity of reading data in the memory and increasing the reading time of data.
In the following described alternative embodiments of this embodiment, before performing 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 a rearrangement process, so that the target filter coefficients can be read continuously during the resampling process.
Specifically, on the basis of the optional embodiment, fig. 4 is a flowchart illustrating an implementation of sorting target filter coefficients in a target filter coefficient table according to a first embodiment of the present invention, and as shown in fig. 4, before performing filtering processing 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 resample points, the implementation further includes the following steps:
s1006, a position label set is obtained, and the position label set comprises position labels of the target filter coefficients in the target filter coefficient table.
In this embodiment, each target filter coefficient in the target filter coefficient table has a position label for performing position identification according to an element number, in addition to an array subscript, so that this step may obtain a position label set, thereby obtaining the position label of each target filter coefficient in the target filter coefficient table.
S1007, determining a selected sequence number corresponding to each position label number in the position label set, and selecting a 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 achieve reordering of each target filter coefficient, this step may be specifically optimized 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 sequence of the selected sequence number.
Specifically, the determining the selected sequence number of each position label in the position label set includes:
a) a jump row variable initialized to 0, an offset column variable, and a selected row variable are set.
b) And determining the sum of the jump row variable multiplied by the filtering length value and the offset column variable as the current position label in the position label set.
c) And determining the sum of the selected row variable and the offset column variable after multiplying the selected row variable by the filter length value as the selected sequence number corresponding to the current position label.
d) And (c) adding 1 to the offset column variable to serve as a new offset column variable, and returning to execute the step b) until the offset column variable reaches the filtering length value.
e) The value of the offset column variable is set to 0 and the selected row variable is incremented by 1 as the new selected row variable.
f) Updating the jump line variable based on a given line offset updating formula, and returning to execute the step b) until the value of the selected line variable reaches the target line number.
Wherein the row offset update formula is represented as:
sampjnum ═ sampjnum + numrate% rate% rate, it can be known that num rate is the quotient of the current sampling rate and the greatest common divisor; the density represents the target number of rows.
Specifically, the determination of the selected sequence number is also a loop iteration process, the iteration times of the loop iteration is also the length of the target table, the iteration variables are offset column variables corresponding to the selected line variable and the filter length value corresponding to the target line number, and the update of the skip line variable in the iteration process is realized through an offset update formula.
Illustratively, when the current sampling rate is 16KHZ and the target sampling rate is 44.1KHZ, the greatest common divisor of the two is 100, the quotient numrate of the current sampling rate and the greatest common divisor is 160, the target row number denrate is 441, when both the selected row variable and the offset column variable are 0, the skip row variable is also 0, and the current position index is also 0, i.e., the position index at which the first selected sequence number determination is made is 0, then according to step c), the selected sequence number corresponding to the current position index is determined to be 0, after 48 calculations, the value of the skip row variable samp _ num is updated to 160, the offset column variable is reset to 0, at this time, the determined current position index is 160 × 48, and according to step c), the selected sequence number corresponding to the current position index is determined to be 48.
S1008 stores the target filter coefficients selected in the order of the selected sequence numbers in the memory, and constructs a new target filter coefficient table.
In this embodiment, based on the selection sequence number of each position number selected in the above step, this step may store each target filter coefficient selected in the order of each selected sequence number in a memory, thereby forming a new target filter coefficient table.
In the above optional embodiment, by analyzing the rule of the existing selected filter coefficient, before the resampling process is performed, the target filter coefficients are sorted according to the analyzed selection rule and the rearranged target filter coefficients are stored in the memory to form a new target filter coefficient table, so that the target filter coefficients can be continuously read from the memory during the subsequent resampling process, and the time for obtaining the filter coefficients from the memory is obtained, thereby speeding up the resampling process time.
On the basis of the foregoing embodiment, this embodiment further performs filtering processing on each sampling point according to a target sampling rate to be resampled and a pre-stored target filter coefficient table to obtain resampled audio data including a second number of resampled points, and optimizes the resampled audio data, where fig. 5 is a flowchart illustrating an implementation of performing resampling processing on the sampling points to obtain resampled audio data according to the first embodiment of the present invention, and as shown in fig. 5, the determining of the resampled audio data specifically includes the following steps:
and S1021, determining the number of sampling points to be re-sampled after re-sampling according to the target sampling rate, and recording as a second number.
For example, assuming that the target sampling rate is 44.1KHZ, the number of sampling points included when a frame of audio data is extracted at the target sampling rate is 441, and therefore, the resampling of the audio data extracted at the current sampling rate in this step is to obtain 441 sampling points after resampling.
And S1022, taking the sampling label of the first sampling point in the audio data to be resampled as the current sampling label.
It can be known that the audio data to be resampled includes a first number of sampling points, and this embodiment can perform sequential labeling for each sampling point, so that each sampling point has a sampling label.
It should be noted that the audio data to be resampled in this embodiment is a frame of audio data cut at the current sampling rate. The audio resampling method provided in this embodiment resamples in units of frames, and restarts resampling processing on next frame of audio data to be resampled after resampling processing on one frame of audio data to be resampled is completed.
And S1023, taking the first row in the target filter coefficient table as the current row, and setting an intermediate variable and a length variable which are initialized to 0.
It should be noted that the target table length of the target filter coefficient table is equivalent to the product of one row and column value, in this embodiment, the target filter coefficient table uses the target row number as row information, uses the filter length value as column information to store, and can obtain the target filter coefficient in row units, this step is equivalent to an initialization step, and can use the first row in the target filter coefficient table as the current row, and at the same time, this step can also initialize two variables, which are respectively an intermediate variable and a length variable, and both of which are initialized to 0.
And S1024, obtaining each target filter coefficient included in the current line to form a current filter coefficient sequence.
And the current filtering sequence is used for resampling the sampling points associated with the current sampling labels.
And S1025, 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 the current audio data.
According to the resampling processing mode in the Speex internal resampling module, in the present embodiment, the audio data resampling is performed by first obtaining the sampling points with the length of the filter length value from the current sampling label as the starting point to the next, and forming the current audio data to be processed under the current iteration.
For example, assuming that the corresponding filtering length value under the set filtering quality value is 48, 47 sampling points are taken backward to form current audio data starting from the sampling point corresponding to the current sampling label, and assuming that the current sampling point is at the position in the audio data to be resampled and the number of subsequent sampling points is less than 47, the audio data to be resampled in the next frame can be expanded, and the remaining sampling points are obtained from the audio data to be resampled in the next frame to form the current audio data with 48 sampling points.
And S1026, correspondingly multiplying and summing the signal values of the sampling points in the current audio data and the target filter coefficients in the current filter coefficient sequence.
The step is a filtering processing step, and particularly realizes the summation of the signal values of sampling points contained in the current audio data and the corresponding multiplication of each target filtering 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 1 to the value of the length variable.
This step is equivalent to forming a resampling point, and the signal value of the resampling point is the summation result calculated above.
S1028, judging whether the intermediate variable is smaller than the target row number or not, if so, executing S1029; if not, S1030 is performed.
This step can 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 smaller than the target number, indicating that the inner loop still needs to be performed, the operation of S1029 may be performed, and if greater than or equal to the target number, indicating that the current inner loop can be ended, the operation of S1030 may be performed to update the outer loop based on the outer loop update condition.
The inner loop is equivalent to determining each correlated resampling point for one sampling point
S1029, updating the current sampling index 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 execute S1024.
Further, the first update formula is expressed as:
lastsample + numrate/denrate, wherein lastsample represents a current sampling index in the audio data to be resampled, 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 denrate represents the target line number;
it can be found that, in the inner circulation process, the current sampling label is kept unchanged, and meanwhile, it can also be found that, in this step, the next line of the current line is directly selected as a new current line, that is, it is equivalent to continuously reading the target filter coefficient in the memory for resampling processing.
The second update formula is expressed as:
samp_frac_num=samp_frac_num+numrate%denrate。
wherein samp _ frac _ num represents the intermediate variable.
S1030, if 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 number, executing S1031; otherwise, S1032 is performed.
If the current sampling label is updated to the last one, or the number of the obtained resampling points reaches the second number, the step indicates that the outer loop can be ended, and then S1032 can be executed; if the above condition is not satisfied, it indicates that further resampling processing needs to be performed on the sampling points in the audio data to be resampled, and at this time, S1031 may be performed.
And 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 loop updating step, 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 line is still selected in sequence as a new current line.
Further, the third update formula is expressed as:
samp_frac_num=samp_frac_num-denrate
and S1032, forming the resampled audio data based on the signal value of each resampling point in the resampled output sequence.
In this embodiment, the signal values of the resampling points may be obtained from the resampling output sequence to form the resampling audio data, where the resampling audio data includes the second number of resampling points.
Compared with the existing resampling process, the implementation process of resampling process is specifically provided, in the optional embodiment, a row of target filter coefficients can be continuously read from the target filter coefficient table to be used as the 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 resampling process is further shortened, and the processing efficiency of resampling process is improved.
On the basis of any optional embodiment described above, the audio resampling method provided by this embodiment further optimizes and increases, after obtaining the resampled audio data containing the second number of resample points: and clearing cache information cached in the memory when filtering each sampling point.
In this embodiment, the resampling process of the audio data is continuously performed in units of one frame, the above-described audio resampling method only completes the resampling process of one frame of audio data to be resampled, and in order to ensure normal execution of the resampling process of the subsequent audio data frame, in this embodiment, the data information related to the audio data to be resampled of the current frame in the memory needs to be cleared, so that the cleared buffer is used for the resampling process of the subsequent audio data.
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 an audio application, 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 an execution carrier device of 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 sampling point acquisition module 21 and a resampling processing module 22.
The sampling point acquisition module 21 is configured to intercept audio data at a current sampling rate to obtain audio data to be resampled, where the audio data includes a first number of sampling points; the resampling processing module 22 is configured to perform filtering processing on each sampling point according to a target sampling rate to be resampled and a pre-stored target filter coefficient table, and obtain resampling audio data including a second number of resampling points; in addition, the target filter coefficient contained in the target filter coefficient table is obtained by interpolation processing of a reference filter coefficient in a predetermined reference filter coefficient table, the target table length of the target filter coefficient is greater than the reference table length, and the reference table length of the reference filter coefficient table is associated with a preset oversampling value and a preset filter length value.
In the audio resampling device provided by the second embodiment of the present invention, after the modules in the device are matched with each other, firstly, the audio data is intercepted at the current sampling rate, and audio data to be resampled including a first number of sampling points is obtained; then 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 resampled audio data containing a second number of resampled points, wherein the target filter coefficient contained in the target filter coefficient table is obtained by 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, the reference table length of the reference filter coefficient table is associated with a preset over-sampling value and a filter length value, the target filter coefficient table for resampling processing is mainly formed by interpolation processing on the basis of the reference filter coefficient table, compared with the existing method which needs complex and repeated calculation to obtain the target filter coefficient table, the technical scheme better saves the determination time of the target filter coefficient table for resampling processing, therefore, the whole time consumption of the audio resampling processing is reduced, the power consumption and the resource occupation of the carrier equipment for executing the audio resampling processing are reduced, and the response waiting time of the audio application with the audio resampling after triggering is shortened.
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, and the information pre-determining module may specifically include: the first obtaining unit is used for obtaining a set filtering quality value, searching a pre-stored filtering quality table and obtaining an oversampling value and a filtering length value corresponding to the filtering quality value; and the reference coefficient determining unit is used for determining a reference filter coefficient table with the reference table length being a third number value based on the oversampling 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 limit weight value under the filter quality value, and set an initialization value of a reference length variable; determining a corresponding sine function value of the given sine function when the argument value is equal to the value of the reference length variable, and determining a 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 limit 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 determination 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 represented as:
Figure BDA0002291655420000171
wherein i represents a reference length variable as an independent variable, the initialization value of i is-k/2, and k is a given target constant value which is multiplied by 4; cutoff represents an audio decibel limit weight value under the filtering quality value, oversample represents the oversampling value, and filterlen represents the filtering length value; sinc (i) is expressed as the sine function value when i is the corresponding reference length variable.
Meanwhile, the Kaiser window cubic spline interpolation processing formula can be expressed as:
Figure BDA0002291655420000172
win represents the interpolation result value processed by cubic spline interpolation for the Kaiser window, interp1[ a ] represents the a-th coefficient value in the cubic spline interpolation, and
interp1[0]=-0.333333*frac+0.5*frac2-0.166667*frac3
interp1[1]=1-0.5*frac-frac2-0.5*frac3
interp1[2]=frac+0.5*frac2-0.5*frac3
interp1[3]=-0.166667*frac+0.166667*frac3
frac-ind represents the fractional part of the y value, ind-floor (y) represents the rounding down of y;
Figure BDA0002291655420000173
to represent
Figure BDA0002291655420000174
I represents a reference length variable as an intermediate variable, an initial reference length variable is-k/2, k is the target constant value, oversample represents the oversampling value, filterlen represents the filter length value; kaiser [ ind + a [ ]]And representing the element value with index of ind + a in the corresponding Kaiser window array under the filtering quality value.
Further, the target filter coefficient table is represented by a two-dimensional array in which one row is the determined target row number and the column number is 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 apparatus further includes an objective coefficient determining module, and the objective coefficient determining module may specifically include: the index determining unit is used for determining the extended index values with the same number as the length of the target table according to the target line number, the oversampling value and the filter 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 a reference filter coefficient associated with the expansion index value in the reference filter coefficient table aiming at each expansion index value in the index two-dimensional array to obtain a target filter coefficient corresponding to the expansion 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 a number of rows as the target number of rows and a number of columns as the filter 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 plus 1 and the oversampling value as a first intermediate value, taking the quotient of the current row index value multiplied by the oversampling value and the target row 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 the current two-dimensional subscript of the initial two-dimensional array, and taking the sum of half of the target constant value and the third intermediate value as an extension index value to write the corresponding element position of the current two-dimensional subscript in the initial two-dimensional array; adding 1 to the current list index value to serve as a new current list index value, and returning to the determination operation of a third intermediate value until the current list index value reaches the filtering length value; taking the column index value of the first column 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; and determining the initial two-dimensional array written with each expansion index value as an index two-dimensional array.
Further, the target coefficient determining unit may be specifically configured to obtain a target row 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 row index value, the oversampling value and the target row number; for each interpolation coefficient, determining an associated reference coefficient value of a reference filter coefficient associated with the extended index value from the reference filter coefficient table according to the interpolation coefficient, and recording a 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 expansion index value.
Wherein, the determining four interpolation coefficients for cubic spline interpolation processing according to the target row index value, the oversampling value and the target row number may include: determining the product of the target row mark value and the oversampling value, and recording as a target product value; determining the remainder of the target product value and the target line number, and recording the remainder as a target remainder value; determining the quotient of the target remainder value and the target line number as the proportion position of the target line standard value in the target line number; and determining four interpolation coefficients for cubic spline interpolation processing according to the ratio positions and a given four interpolation coefficient determination formula.
Further, the four interpolation coefficient determination formulas may be respectively expressed as:
interp2[0]=-0.166667*frac1+0.166667*frac13
interp2[1]=frac1+0.5*frac12-0.5*frac13
interp2[2]=1-0.5*frac1-frac12-0.5*frac13
interp2[3]=-0.333333*frac1+0.5*frac12-0.166667*frac13
wherein interp2[ b ] represents the value of the b-th coefficient in cubic spline interpolation, b takes 0,1,2 and 3, frac1 is the proportion position of the target row index value in the target row number.
On the basis of the above optimization, determining, from the reference filter coefficient table, an associated coefficient value of the reference filter coefficient associated with the extended index value according to the interpolation coefficient may include: taking the sum of the difference value of the extended index value and a set constant value and the interpolation coefficient as an associated index value in a basic filter coefficient table, wherein the set constant value is one fourth of the target constant value; and determining the reference coefficient value corresponding to the associated index value in the basic filter coefficient table as an associated reference coefficient value.
Furthermore, the device also comprises a label acquisition module, a selected 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 number in the position mark set and selecting corresponding target filter coefficients from a target filter coefficient table according to the sequence of the selected sequence number; the filter coefficient sorting module is used for storing each target filter coefficient selected according to the sequence of each selected sequence number in a memory to form a new target filter coefficient table.
Further, the selected order determining module is specifically configured to set a skip row variable initialized to 0, an offset column variable, and a selected row variable; determining the sum of the jump row variable and the offset column variable after multiplying the jump row variable and the filter length value 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 label; adding 1 to the offset column variable to serve as a new offset column variable, and returning to execute the determination operation of the current position label until the offset column variable reaches the filtering length value; setting the value of an offset column variable to be 0, and adding 1 to the selected row variable to serve as a new selected row variable; and updating the jump row variable based on a given row offset updating formula, and returning to execute the determination operation of the current position label until the value of the selected row variable reaches the target row number.
Further, the row offset update formula can be expressed as:
sampjnum ═ sampjnum + numrate% rate, where 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 rate represents the target line number.
Further, the resampling processing module is specifically configured to determine, according to the target sampling rate, the number of sampling points to be resampled and record the number as a second number; taking the sampling label of the first sampling point in the audio data to be resampled as the current sampling label; taking the head line in the target filter coefficient table as the current line, and setting an intermediate variable and a length variable initialized to 0; obtaining each target filter coefficient included in the current line to form a current filter coefficient sequence; acquiring sampling points 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 summing signal values of all sampling points in the current audio data and all target filter coefficients in the current filter coefficient sequence; adding the obtained addition result as a signal value of a resampling point into a resampling output sequence, and adding 1 to the value of the length variable; 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, returning and continuously executing the steps of obtaining each target filter coefficient included in the current line to form a current filter coefficient sequence until the intermediate variable is greater than or equal to the target line number; taking the next sampling label of the current sampling label as a new current sampling label, updating the intermediate variable by using a third updating formula, taking the next line of the current line as a new current line, returning and continuously acquiring 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; forming resampled audio data based on the signal values of the resampled points in the resampled output sequence.
Further, the first update formula may be expressed as:
lastsample + numrate/denrate, wherein lastsample represents a current sampling index in the audio data to be resampled;
the second update formula may be expressed as:
samp_frac_num=samp_frac_num+numrate%denrate,
the third update 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 denrate represents the target line number.
Further, the device also comprises: and the resampling destruction module is used for clearing cache information cached in the memory when filtering each sampling point after resampling audio data containing a second number of resampling points is obtained.
EXAMPLE III
Fig. 7 is a schematic diagram of a 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: a processor 60, a storage device 61, a display 62, an input device 63, an output device 64, and a communication device 65. The number of processors 60 in the audio resampling apparatus may be one or more, and one processor 60 is taken as an example in fig. 7. The number of the storage devices 61 in the audio resampling apparatus may be one or more, and one storage device 61 is taken as an example 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 other means, which is exemplified by the bus connection in fig. 7.
The storage device 61 is a computer-readable storage medium, and can be used to store software programs, computer-executable programs, and modules, such as program requests/modules corresponding to the audio resampling method and/or the image stitching method according to any embodiment of the present invention (for example, the sampling point acquisition module 21 and the resampling processing module 22 in the audio resampling device). 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, an application program required for at least one function; the storage data area may store data created according to use of the audio resampling apparatus, and the like. Further, the storage device 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 located remotely from the processor 60, which may be connected to the audio resampling device over 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 screen 62 is a display screen with a touch function, and may be a capacitive screen, an electromagnetic screen, or an infrared screen. In general, the display screen 62 is used for displaying data according to instructions from the processor 60, and is also used for receiving touch operations applied to the display screen 62 and sending corresponding signals to the processor 60 or other devices. Optionally, when the display screen 62 is an infrared screen, the display screen further includes an infrared touch frame, and the infrared touch frame is disposed around the display screen 62, and may also be configured to receive an infrared signal and send the infrared signal to the processor 60 or other computer devices.
The input means 63 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function controls of the audio resampling apparatus, as well as a camera for acquiring images and a pick-up audio resampling apparatus for acquiring audio in video data. The output means 64 may include a video audio resampling device such as a display screen and an audio resampling device such as a speaker. It should be noted that the specific composition of the input device 63 and the output device 64 can be set according to actual conditions.
The communication means 65 may be used to establish a communication connection with other audio resampling devices, which may be wired communication means and/or wireless communication means.
The processor 60 executes various functional applications of the audio resampling apparatus and data processing, i.e. implements the audio resampling method described above, by running software programs, requests and modules stored in the storage device 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 filter 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 by interpolating a reference filter coefficient in a predetermined reference filter coefficient table, the target table length of the target filter coefficient is greater than the reference table length, and the reference table length of the reference filter coefficient table is associated with a preset oversampling value and a preset filter length value.
Embodiments of the present invention further provide 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 execute the audio resampling method according to 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 filter 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 by interpolating a reference filter coefficient in a predetermined reference filter coefficient table, the target table length of the target filter coefficient is greater than the reference table length, and the reference table length of the reference filter coefficient table is associated with a preset oversampling value and a preset filter length value.
It should be noted that, as for the embodiments of the apparatus, the audio resampling apparatus, and the storage medium, since they are basically similar to the embodiments of the method, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the embodiments of the method.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, and the computer software product may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several requests to enable an audio resampling device (which may be a robot, a personal computer, a server, or a network device) to execute 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 above audio resampling apparatus, the units and modules included in the audio resampling apparatus are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It should 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 memory and executed by a suitable requesting execution device. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean 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 invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. 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, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended 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 filter 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 by interpolating a reference filter coefficient in a predetermined reference filter coefficient table, the target table length of the target filter coefficient is greater than the reference table length, and the reference table length of the reference filter coefficient table is associated with a preset oversampling value and a preset filter length value.
2. The method of claim 1,
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 reference filter coefficient table comprises:
acquiring a set filtering quality value, searching a pre-stored filtering quality table, and acquiring an oversampling value and a filtering length value corresponding to the filtering quality value;
and determining a reference filter coefficient table with the reference table length being a third quantity value based on the oversampling value and the filter length value.
4. The method of claim 3, wherein determining a reference filter coefficient table having a reference table length of a third magnitude value based on the over-sampled value and a filter length value comprises:
determining 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, acquiring an audio decibel limit weight value under the filter quality value, and setting an initialization value of a reference length variable;
determining a corresponding sine function value of the given sine function when the argument value is equal to the value of the reference length variable, and determining a 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 limit 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 determination 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,
the sine function is expressed as:
Figure FDA0002291655410000021
wherein i represents a reference length variable as an independent variable, the initialization value of i is-k/2, and k is a given target constant value which is multiplied by 4; cutoff represents an audio decibel limit weight value under the filtering quality value, oversample represents the oversampling value, and filterlen represents the filtering length value; sinc (i) is expressed as the sine function value when i is the corresponding reference length variable.
6. The method of claim 4,
the Kaiser window cubic spline interpolation processing formula is expressed as:
Figure FDA0002291655410000022
win represents the interpolation result value processed by cubic spline interpolation for the Kaiser window, interp1[ a ] represents the a-th coefficient value in the cubic spline interpolation, and
interp1[0]=-0.333333*frac+0.5*frac2-0.166667*frac3
interp1[1]=1-0.5*frac-frac2-0.5*frac3
interp1[2]=frac+0.5*frac2-0.5*frac3
interp1[3]=-0.166667*frac+0.166667*frac3
frac-ind represents the fractional part of the y value, ind-floor (y) represents the rounding down of y;
Figure FDA0002291655410000031
to represent
Figure FDA0002291655410000032
The product of the absolute value of (c) and over sample, table iShowing a reference length variable as an intermediate variable, wherein an initial reference length variable is-k/2, k is the target constant value, oversample represents the oversampling value, and filterlen represents the filter length value; kaiser [ ind + a [ ]]And representing the element value with index of ind + a in the corresponding Kaiser window array under the filtering quality value.
7. The method of claim 4, wherein the target filter coefficient table is represented by a two-dimensional array having a number of rows as the determined target number of rows and a 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 according to claim 7, wherein the step of obtaining the target filter coefficient table by interpolating the reference filter coefficients in the predetermined reference filter coefficient table comprises:
determining the number of extended index values with the same length as the target table according to the target line number, the oversampling value and the filter length value, and obtaining an index two-dimensional array formed by the extended index values;
for each expansion index value in the index two-dimensional array, performing interpolation processing on a reference filter coefficient associated with the expansion index value in the reference filter coefficient table to obtain a target filter coefficient corresponding to the expansion index value;
a target filter coefficient table containing 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 length of the target table according to the target number of lines, the oversampling value and the filter length value, and obtaining an index two-dimensional array formed by each extended index value comprises:
creating an initial two-dimensional array with the number of rows as the target number of rows and the number of columns as the filtering length value, and taking the row index value of the first row in the initial two-dimensional array as the current row index value and the column index value of the first column as the current column index value;
taking the product of the current column index value plus 1 and the oversampling value as a first intermediate value, taking the quotient of the current row index value multiplied by the oversampling value and the target row 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 the current two-dimensional subscript of the initial two-dimensional array, and taking the sum of half of the target constant value and the third intermediate value as an extension index value to write the corresponding element position of the current two-dimensional subscript in the initial two-dimensional array;
adding 1 to the current list index value to serve as a new current list index value, and returning to the determination operation of a third intermediate value until the current list index value reaches the filtering length value;
taking the column index value of the first column 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;
and determining the initial two-dimensional array written with each expansion index value as an index two-dimensional array.
10. The method according to claim 8, wherein the interpolating the reference filter coefficient 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 row 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 row index value, the oversampling value and the target row number;
for each interpolation coefficient, determining an associated reference coefficient value of a reference filter coefficient associated with the extended index value from the reference filter coefficient table according to the interpolation coefficient, and recording a 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 expansion index value.
11. The method of claim 10, wherein determining four interpolation coefficients for cubic spline interpolation based on the target row index value, the oversampled value, and the target row number comprises:
determining the product of the target row mark value and the oversampling value, and recording as a target product value;
determining the remainder of the target product value and the target line number, and recording the remainder as a target remainder value;
determining the quotient of the target remainder value and the target line number as the proportion position of the target line standard value in the target line number;
and determining four interpolation coefficients for cubic spline interpolation processing according to the ratio positions and a given four interpolation coefficient determination formula.
12. The method according to claim 11, wherein the four interpolation coefficient determination formulas are respectively expressed as:
interp2[0]=-0.166667*frac1+0.166667*frac13
interp2[1]=frac1+0.5*frac12-0.5*frac13
interp2[2]=1-0.5*frac1-frac12-0.5*frac13
interp2[3]=-0.333333*frac1+0.5*frac12-0.166667*frac13
wherein interp2[ b ] represents the value of the b-th coefficient in cubic spline interpolation, b takes 0,1,2 and 3, frac1 is the proportion position of the target row index value in the target row number.
13. The method according to claim 10, wherein determining, from the reference filter coefficient table, the associated coefficient value of the reference filter coefficient associated with the extended index value according to the interpolation coefficient comprises:
taking the sum of the difference value of the extended index value and a set constant value and the interpolation coefficient as an associated index value in a basic filter coefficient table, wherein the set constant value is one fourth of the target constant value;
and determining the reference coefficient value corresponding to the associated index value in the basic filter coefficient table as an associated reference coefficient value.
14. The method according to claim 1, wherein before filtering each of the sampling points according to the target sampling rate to be resampled and a pre-stored target filter coefficient table to obtain a second number of resample points, the method further comprises:
acquiring a position label set, wherein the position label set comprises position labels of all target filter coefficients in the target filter coefficient table;
determining a selected sequence number corresponding to each position mark number in the position mark set, and selecting corresponding target filter coefficients from a target filter coefficient table according to the sequence of the selected sequence number;
and 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.
15. The method of claim 14, wherein determining the selected sequence number for each position label in the set of position labels comprises:
setting a jump row variable initialized to 0, an offset column variable and a selected row variable;
determining the sum of the jump row variable and the offset column variable after multiplying the jump row variable and the filter length value 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 label;
adding 1 to the offset column variable to serve as a new offset column variable, and returning to execute the determination operation of the current position label until the offset column variable reaches the filtering length value;
setting the value of an offset column variable to be 0, and adding 1 to the selected row variable to serve as a new selected row variable;
and updating the jump row variable based on a given row offset updating formula, and returning to execute the determination operation of the current position label until the value of the selected row variable reaches the target row number.
16. The method of claim 15, wherein the row offset update formula is expressed as:
sampjnum ═ sampjnum + numrate% rate% rate, where numrate is the quotient of the current 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; and the density represents the target row number.
17. The method of claim 3, wherein the filtering each of the samples according to the target sampling rate to be resampled and a pre-stored target filter coefficient table to obtain resampled audio data including a second number of resampled points comprises:
determining the number of sampling points to be re-sampled and recording as a second number according to the target sampling rate;
taking the sampling label of the first sampling point in the audio data to be resampled as the current sampling label;
taking the head line in the target filter coefficient table as the current line, and setting an intermediate variable and a length variable initialized to 0;
obtaining each target filter coefficient included in the current line to form a current filter coefficient sequence;
acquiring sampling points 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 summing signal values of all sampling points in the current audio data and all target filter coefficients in the current filter coefficient sequence;
adding the obtained addition result as a signal value of a resampling point into a resampling output sequence, and adding 1 to the value of the length variable;
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, returning and continuously executing the steps of obtaining each target filter coefficient included in the current line to form a current filter coefficient sequence until the intermediate variable is greater than or equal to the target line number;
taking the next sampling label of the current sampling label as a new current sampling label, updating the intermediate variable by using a third updating formula, taking the next line of the current line as a new current line, returning and continuously acquiring 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;
forming resampled audio data based on the signal values of the resampled points in the resampled output sequence.
18. The method of claim 17, wherein the first update formula is represented as:
lastsample=lastsample+numrate/denrate,
the second update formula is expressed as:
samp_frac_num=samp_frac_num+numrate%denrate,
the third update 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 denrate represents the target line number.
19. The method of any of claims 1-18, further comprising, after obtaining resampled audio data comprising a second number of resample points:
and clearing cache information cached in the memory when filtering 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 obtain audio data to be resampled, wherein the audio data to be resampled 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 filter coefficient table to obtain resampling audio data containing a second number of resampling points;
the target filter coefficient contained in the target filter coefficient table is obtained by interpolating a reference filter coefficient in a predetermined reference filter coefficient table, the target table length of the target filter coefficient is greater than the reference table length, and the reference table length of the reference filter coefficient table is associated with a preset oversampling value and a preset filter length value.
21. An audio resampling device, characterized by comprising:
one or more processors;
storage means for storing one or more programs;
the one or more programs are executed by the one or more processors such that the one or more processors implement the method of any of claims 1-19.
22. A computer storage medium, comprising: the program when executed by a processor implementing the method of any one of claims 1 to 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 true CN110956970A (en) 2020-04-03
CN110956970B 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)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112564670A (en) * 2020-11-20 2021-03-26 核工业二〇八大队 Filtering method for power frequency noise interference of audio magnetotelluric data
CN113823333A (en) * 2021-08-27 2021-12-21 深圳市灵镜技术有限公司 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

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112564670A (en) * 2020-11-20 2021-03-26 核工业二〇八大队 Filtering method for power frequency noise interference of audio magnetotelluric data
CN112564670B (en) * 2020-11-20 2023-11-21 核工业二〇八大队 Filtering method for power frequency noise interference of audio magnetotelluric data
CN113823333A (en) * 2021-08-27 2021-12-21 深圳市灵镜技术有限公司 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

Also Published As

Publication number Publication date
CN110956970B (en) 2023-11-14

Similar Documents

Publication Publication Date Title
CN110956970A (en) Audio resampling method, device, equipment and storage medium
JP4698385B2 (en) Special effects such as titles, transitions, and / or effects that change depending on the position
US20080172646A1 (en) Array transformation in a behavioral synthesis tool
CN105354315B (en) Method, sublist node and the system of distributed data base neutron table splitting
EP2591413A2 (en) Visualizing expressions for dynamic analytics
CN101206663A (en) Apparatus and method for automatically composing album and managing cover image of album
CN104243590A (en) Resource object recommendation method and device
CN111949832A (en) Method and device for analyzing dependency relationship of batch operation
CN108171528A (en) A kind of attribution method and attribution system
CN109298888B (en) Queue data access method and device
JP2005071370A (en) System and method for determining activity factor for circuit design
CN114997117A (en) Document editing method, device, terminal and non-transitory storage medium
CN107807993B (en) Method and device for realizing webpage history recording function
US10310823B2 (en) Program development support system and program development support software
CN111767435B (en) User behavior analysis method and device
CN109495786B (en) Pre-configuration method and device of video processing parameter information and electronic equipment
CN110619079B (en) Method and device for pushing information
CN108628540A (en) Data storage device and method
JP3738802B2 (en) Information processing system
CN106934555B (en) Workflow organization method and device, computer equipment and storage medium
CN111951355A (en) Animation processing method and device, computer equipment and storage medium
JP7416832B2 (en) Slide storage method and device
CN108037867A (en) Application program page display method and device, terminal, readable storage medium storing program for executing
CN115964305B (en) Cross-project test case library management method, device and storage medium
CN114647781A (en) Book recommendation method, computing device 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