CN115083427A - Audio resampling method, audio processing equipment and storage medium - Google Patents

Audio resampling method, audio processing equipment and storage medium Download PDF

Info

Publication number
CN115083427A
CN115083427A CN202210644539.5A CN202210644539A CN115083427A CN 115083427 A CN115083427 A CN 115083427A CN 202210644539 A CN202210644539 A CN 202210644539A CN 115083427 A CN115083427 A CN 115083427A
Authority
CN
China
Prior art keywords
initial
audio
sampling
sampling frequency
target
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
CN202210644539.5A
Other languages
Chinese (zh)
Other versions
CN115083427B (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.)
Zhuhai Haiqi Semiconductor Co ltd
Original Assignee
Zhuhai Haiqi Semiconductor 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 Zhuhai Haiqi Semiconductor Co ltd filed Critical Zhuhai Haiqi Semiconductor Co ltd
Priority to CN202210644539.5A priority Critical patent/CN115083427B/en
Publication of CN115083427A publication Critical patent/CN115083427A/en
Application granted granted Critical
Publication of CN115083427B publication Critical patent/CN115083427B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS OR SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING; SPEECH OR AUDIO CODING OR DECODING
    • G10L21/00Processing of the speech or voice signal 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The invention discloses an audio resampling method, audio processing equipment and a storage medium, which improve an audio sampling method based on linear interpolation, and select two initial audio samples corresponding to a sample selection parameter for a certain target audio sample to resample by calculating the sample selection parameter. Meanwhile, a plurality of sampling weight parameters corresponding to the plurality of sample selection parameters in a one-to-one manner are calculated and obtained under the decimal taking method. In actual processor operation, a plurality of sampling weight parameters obtained by a decimal method are processed in an integer form, so that floating point operation is converted into fixed point operation. For a small embedded system which cannot perform floating point operation, by using the audio resampling method of the embodiment of the invention, the calculated amount is reduced by several times compared with the traditional hardware adopting a filter, and meanwhile, the processed tone quality effect is ensured to meet the auditory requirement of human ears in actual use, thereby being beneficial to being applied to the small embedded system to reduce the cost.

Description

Audio resampling method, audio processing equipment and storage medium
Technical Field
The present invention relates to the field of audio sampling technologies, and in particular, to an audio resampling method, an audio processing device, and a storage medium.
Background
In a multimedia audio-video system, it is sometimes necessary to resample audio for output, and resample input audio of one frequency into audio of another frequency for output. Resampling technology is processing from one set of digital signals to another set of digital signals, and can be implemented by using special hardware. At present, signal acquisition instruments put into use in China all have a resampling function realized by a hardware method. The vibration signal is obtained by the sensor, low-pass filtered by the filter circuit and then digitally extracted by the hardware circuit. This method of decimation by hardware filtering is inflexible and expensive to use. Meanwhile, the existing software method is adopted to carry out audio resampling, and for a small embedded system, the computing resources of a CPU (central processing unit) are very limited, for example, the running frequency of the CPU of some small embedded devices is very low, so that the audio resampling cannot be carried out.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art. Therefore, the invention provides an audio resampling method, which solves the problems that the current audio resampling depends on hardware, so that the use is not flexible, the price is high, and the audio resampling method is difficult to be applied to a small embedded system depending on software.
The present invention also provides a computer-readable storage medium for executing the above-described audio processing apparatus and audio resampling method.
An audio resampling method according to an embodiment of the first aspect of the invention, the method comprising:
obtaining an initial sampling frequency and a plurality of initial audio samples, the initial audio samples representing samples obtained based on audio sampling at the initial sampling frequency;
determining the number of target audio samples according to the initial sampling frequency, the number of the initial audio samples and a preset target sampling frequency, wherein the target audio samples represent the samples determined according to the target sampling frequency;
according to the initial sampling frequency, the number of the target audio samples and the target sampling frequency, obtaining a plurality of sampling weight parameters and a plurality of sample selection parameters which are in one-to-one correspondence with the plurality of sampling weight parameters, wherein each sampling weight parameter represents and calculates the weight of the initial audio sample required by the corresponding target audio sample, and the plurality of sample selection parameters represent the serial numbers of the plurality of initial audio samples;
obtaining a plurality of target audio samples according to the plurality of sampling weight parameters, the plurality of sample selection parameters and the plurality of initial audio samples.
The audio resampling method according to the embodiment of the invention has at least the following beneficial effects:
the embodiment of the invention improves an audio sampling method based on linear interpolation, particularly determines the relation among parameters according to the initial sampling frequency, the number of target audio samples and the target sampling frequency, calculates and obtains a plurality of sample selection parameters based on an integer taking method by taking a formula as constraint, and the sample selection parameters represent the serial number of the initial audio samples. Therefore, by calculating the sample selection parameter, two initial audio samples corresponding to the sample selection parameter are selected for a certain target audio sample to be resampled. Meanwhile, under the decimal method, a plurality of sampling weight parameters which are in one-to-one correspondence with the plurality of sample selection parameters are calculated and obtained according to the same formula. Specifically, in an actual processor operation, a plurality of sampling weight parameters obtained by a decimal method are processed in an integer form, so that the conversion from a floating-point operation to a fixed-point operation is realized. For a small embedded system which cannot perform floating point operation, the audio resampling method provided by the embodiment of the invention has the calculation amount of only 10M to 20M DMIPS, and compared with the audio resampling method of a filter adopted by a traditional hardware mode, the calculation amount of the filter generally exceeds 100M DMIPS, the processing requirement on a CPU is obviously reduced. The CPU calculation amount is reduced, meanwhile, the tone quality effect after audio resampling can be well guaranteed, the hearing requirement of human ears in actual product use can be met, and therefore the method is favorable for being well applied to a small embedded system, and the design cost of the product is reduced.
According to some embodiments of the invention, a plurality of the target audio samples are constrained by the following first relational mathematical model:
Figure BDA0003685409550000021
X=(x 0 ,x 1 ,…,x n ),
Y=(y 0 ,y 1 ,…,y m ),
wherein X represents a plurality of the initial audio samples, Y represents a plurality of the target audio samples, n represents the number of the initial audio samples, m represents the number of the target audio samples, Y represents the number of the target audio samples i Representing the ith said target audio sample, coe i Represents the ith said sampling weight parameter,
Figure BDA0003685409550000023
denotes the a i The number of initial audio samples is one,
Figure BDA0003685409550000022
denotes the b-th i An initial audio sample, a i And b i Representing two adjacent ones of said sample selection parameters.
According to some embodiments of the present invention, the obtaining a plurality of sampling weight parameters and a plurality of sample selection parameters in a one-to-one correspondence according to the initial sampling frequency, the number of target audio samples, and the target sampling frequency includes:
obtaining a plurality of floating conversion parameters according to the initial sampling frequency, the number of the target audio samples and the target sampling frequency;
and respectively taking a decimal part and an integer part of each floating conversion parameter to obtain a plurality of sampling weight parameters and a plurality of sample selection parameters which are in one-to-one correspondence.
According to some embodiments of the invention, the plurality of floating-up conversion parameters, the plurality of sampling weight parameters, and the plurality of sample selection parameters are respectively constrained by the following second relational mathematical model:
μ i =(i×f x )/f y
coef i =frac(μ i ),
a i =int(μ i ),
wherein f is x Representing said initial sampling frequency, f y Represents the target sampling frequency, mu i Representing the ith said float conversion parameter, coef i Representing the ith said sample weight parameter, frac (μ) i ) Indicating the fractional part, int (μ), of the ith of said float conversion parameter i ) Indicating that the integer part is taken for the ith floating conversion parameter.
According to some embodiments of the present invention, the taking a fractional part and an integer part of each of the floating-up conversion parameters to obtain a plurality of the sampling weight parameters and a plurality of the sample selection parameters in a one-to-one correspondence includes:
setting the initial values of the sampling weight parameter and the sample selection parameter to be 0;
calculating to obtain a first sampling weight parameter and a first sample selection parameter according to the second relation mathematical model;
and based on accumulation operation, sequentially obtaining a plurality of sampling weight parameters and a plurality of sample selection parameters according to the first sampling weight parameter and the first sample selection parameter.
According to some embodiments of the present invention, the initial sampling frequency and the target sampling frequency both use binary floating point numbers, and the calculating obtains a first sampling weight parameter and a first sample selection parameter according to the second relational mathematical model, including the following steps:
carrying out shift operation of shifting the initial sampling frequency by k bits to the left to obtain a quantization sampling frequency, wherein k represents quantization precision;
converting the quantized sampling frequency into an ultralong integer number and dividing the ultralong integer number by the target sampling frequency to obtain an integer number floating and integer conversion parameter;
performing a shift operation of shifting the integer number by k bits to the right to obtain the sample selection parameter of the integer number;
will decimal number 2 k -1 converting into a binary number to obtain a decimal fraction fetching code;
and operating the integer number floating and integer conversion parameter and the decimal place-taking code to obtain the sampling weight parameter of the integer number.
According to some embodiments of the present invention, the obtaining a plurality of the sampling weight parameters and a plurality of the sample selection parameters in sequence based on the accumulation operation and according to the first sampling weight parameter and the first sample selection parameter comprises:
accumulating i of the first sample selection parameters to obtain a first temporary value;
accumulating the i first sampling weight parameters to obtain a second temporary value;
if the second temporary value is less than 1, taking the first temporary value as the ith sampling weight parameter, and taking the second temporary value as the ith sampling weight parameter;
if the second temporary value is greater than 1, adding the integer part of the second temporary value to the first temporary value to obtain a third temporary value, taking the decimal part of the second temporary value to obtain a fourth temporary value, taking the third temporary value as the ith sampling weight parameter, and taking the fourth temporary value as the ith sampling weight parameter.
According to some embodiments of the invention, the obtaining a number of target audio samples from the initial sampling frequency, the number of initial audio samples, and the target sampling frequency comprises:
obtaining a number offset value of the target audio sample according to a third correlation coefficient model;
rounding down the number offset value to obtain the number of the target audio samples;
wherein the third correlation coefficient model is:
m′=(n×f y )/f x
wherein m' represents the number offset value, n represents the number of the initial audio samples, f x Representing said initial sampling frequency, f y Representing the target sampling frequency.
An audio processing device according to an embodiment of the second aspect of the present invention comprises a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the audio resampling method as described in the embodiment of the first aspect when executing the computer program. Since the audio processing device adopts all technical solutions of the audio resampling method of the above embodiment, at least all beneficial effects brought by the technical solutions of the above embodiments are achieved.
A computer-readable storage medium according to an embodiment of the third aspect of the present invention stores computer-executable instructions for performing the audio resampling method as described in the embodiment of the first aspect above. Since the computer-readable storage medium adopts all the technical solutions of the audio resampling method of the above embodiments, at least all the advantages brought by the technical solutions of the above embodiments are achieved.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a flow chart of an audio resampling method according to an embodiment of the invention;
FIG. 2 is a flow chart of obtaining a plurality of sample weight parameters and a plurality of sample selection parameters according to an embodiment of the present invention;
FIG. 3 is a flow diagram of a fractional part and an integer part for each floating-up conversion parameter to obtain a plurality of sampling weight parameters and a plurality of sample selection parameters according to an embodiment of the present invention;
FIG. 4 is a flow chart of a calculation of a first sample weight parameter and a first sample selection parameter according to an embodiment of the present invention;
FIG. 5 is a flow chart of obtaining a plurality of sample weight parameters and a plurality of sample selection parameters based on an accumulation operation according to an embodiment of the invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
In the description of the present invention, if there are first, second, etc. described, it is only for the purpose of distinguishing technical features, and it is not understood that relative importance is indicated or implied or that the number of indicated technical features is implicitly indicated or that the precedence of the indicated technical features is implicitly indicated.
In the description of the present invention, it should be understood that the orientation or positional relationship referred to, for example, the upper, lower, etc., is indicated based on the orientation or positional relationship shown in the drawings, and is only for convenience of description and simplification of description, but does not indicate or imply that the device or element referred to must have a specific orientation, be constructed in a specific orientation, and be operated, and thus should not be construed as limiting the present invention.
In the description of the present invention, it should be noted that unless otherwise explicitly defined, terms such as arrangement, installation, connection and the like should be broadly understood, and those skilled in the art can reasonably determine the specific meanings of the above terms in the present invention in combination with the specific contents of the technical solutions.
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it should be understood that the embodiments described below are some, but not all embodiments of the present invention.
Referring to fig. 1, a flowchart of an audio resampling method according to an embodiment of the present invention is provided, where the audio resampling method includes, but is not limited to, the following steps:
step S100, obtaining an initial sampling frequency and a plurality of initial audio samples, and determining a target sampling frequency, wherein the initial audio samples represent samples obtained by audio sampling based on the initial sampling frequency, and the target sampling frequency represents the sampling frequency required by audio resampling;
it is understood that audio sampling refers to discretizing a continuous analog signal into a digital signal for digital signal processing. Sampling a section of audio at an initial sampling frequency to obtain a plurality of initial audio samples, and performing audio resampling on the basis, wherein a required sampling frequency, namely a target sampling frequency, needs to be determined. Therefore, if we want to obtain the target audio sample after audio resampling, we first obtain three known quantities under the conventional linear interpolation-based method: an initial sampling frequency, a plurality of initial audio samples, a target sampling frequency. Meanwhile, the audio resampling method of the embodiment of the invention is typically applied to the situation that the target sampling frequency is smaller than the initial sampling frequency, namely, the high sampling frequency is converted into the low sampling frequency.
Step S200, obtaining the number of target audio samples according to the initial sampling frequency, the number of initial audio samples and the target sampling frequency, wherein the target audio samples represent samples determined according to the target sampling frequency;
since the initial sampling frequency, the plurality of initial audio samples, and the target sampling frequency are obtained in step S100, the number of obtained target audio samples can be calculated according to the relationship among the three, that is, it can be determined how many target audio samples can be obtained at the target sampling frequency during audio resampling.
Step S300, obtaining a plurality of sampling weight parameters and a plurality of sample selection parameters which are in one-to-one correspondence with the plurality of sampling weight parameters according to the initial sampling frequency, the number of target audio samples and the target sampling frequency, wherein each sampling weight parameter represents and calculates the weight of the initial audio sample required by the corresponding target audio sample, and the plurality of sample selection parameters represent the serial numbers of the plurality of initial audio samples;
it should be noted that, for the conventional linear interpolation algorithm to perform audio resampling, when a first target audio sample is obtained, two initial adjacent audio samples are first used for calculation, and when a plurality of subsequent target audio samples are calculated, two initial adjacent audio samples are sequentially selected according to a sequence number for calculation. In step S300 of the embodiment of the present invention, instead of sequentially selecting two adjacent initial audio samples for calculation, a sample selection parameter is obtained by calculation according to the relationship constraints of the initial sampling frequency, the number of target audio samples, and the target sampling frequency, one initial audio sample is determined according to the sequence number of the initial audio sample represented by the sample selection parameter, and another adjacent initial audio sample is simultaneously selected, and meanwhile, a plurality of sampling weight parameters corresponding to the plurality of sample selection parameters one to one can also be obtained according to the relationship constraints of the initial sampling frequency, the number of target audio samples, and the target sampling frequency, and the sampling weight parameters can be understood to be equivalent to weight coefficients in a linear interpolation algorithm. Thus, the computationally obtained sampling weight parameters and sample selection parameters provide prerequisites for obtaining a plurality of target audio samples for subsequent computations.
Step S400, a plurality of target audio samples are obtained according to the plurality of sampling weight parameters, the plurality of sample selection parameters and the plurality of initial audio samples.
It can be understood that, on the basis of step S300, for a certain target audio sample, the proportional weights of two adjacent initial audio samples and two adjacent initial audio samples are determined, that is, the proportional weights can be calculated according to the sampling weight parameter and the sample selection parameter, and the proportional weights can be obtained by using the correlation formula of audio resampling. Further, with a plurality of initial audio samples, a plurality of target audio samples may be computed accordingly.
According to the audio resampling method, an audio sampling method based on linear interpolation is improved, specifically, according to initial sampling frequency, the number of target audio samples and target sampling frequency, the relation among parameters is determined, a formula is used as constraint, a plurality of sample selection parameters are obtained through calculation under an integer taking method, and the sample selection parameters represent the serial number of the initial audio samples. Therefore, by calculating the sample selection parameter, two initial audio samples corresponding to the sample selection parameter are selected for a certain target audio sample to be resampled. Meanwhile, under the decimal method, a plurality of sampling weight parameters which are in one-to-one correspondence with the plurality of sample selection parameters are calculated and obtained according to the same formula. Specifically, in an actual processor operation, a plurality of sampling weight parameters obtained by a decimal method are processed in an integer form, so that the conversion from a floating-point operation to a fixed-point operation is realized. For a small embedded system which cannot perform floating point operation, the audio resampling method provided by the embodiment of the invention has the calculation amount of only 10M to 20M DMIPS, and compared with the audio resampling method of a filter adopted by a traditional hardware mode, the calculation amount of the filter generally exceeds 100M DMIPS, the processing requirement on a CPU is obviously reduced. The CPU calculation amount is reduced, meanwhile, the tone quality effect after audio resampling can be well guaranteed, the hearing requirement of human ears in actual product use can be met, and therefore the method is favorable for being well applied to a small embedded system, and the design cost of the product is reduced.
In some embodiments of the invention, the plurality of target audio samples are constrained by the following first relational mathematical model:
Figure BDA0003685409550000071
X=(x 0 ,x 1 ,…,x n ),
Y=(y 0 ,y 1 ,…,y m ),
where X represents a plurality of initial audio samples, Y represents a plurality of target audio samples, n represents the number of initial audio samples, m represents the number of target audio samples, Y represents the number of target audio samples i Representing the ith target audio sample, coe i Represents the ith sample weight parameter,
Figure BDA0003685409550000072
denotes the a i The number of initial audio samples is one,
Figure BDA0003685409550000073
denotes the b-th i An initial audio sample, a i And b i Representing two adjacent sample selection parameters.
It can be understood that, according to the first relational mathematical model, for a target audio sample, two adjacent initial audio samples are respectively obtained by adding the proportions allocated by the sampling weight parameters, and for two adjacent initial audio samples, the selection is performed according to the sample selection parameters, wherein the target audio sample, the initial audio samples and the sample selection parameters are corresponding to each other.
In some embodiments of the present invention, as shown in fig. 2, obtaining a plurality of sampling weight parameters and a plurality of sample selection parameters in a one-to-one correspondence according to the initial sampling frequency, the number of target audio samples, and the target sampling frequency includes the following steps:
step S310, obtaining a plurality of floating conversion parameters according to the initial sampling frequency, the number of target audio samples and the target sampling frequency;
step S320, respectively taking a fractional part and an integer part for each floating conversion parameter to obtain a plurality of sampling weight parameters and a plurality of sample selection parameters in one-to-one correspondence.
It is understood that the plurality of sampling weight parameters and the plurality of sample selection parameters in a one-to-one correspondence are calculated by using the initial sampling frequency, the number of target audio samples and the target sampling frequency in the same relation. Specifically, an intermediate floating conversion parameter is calculated first, a sampling weight parameter is obtained by taking a decimal part for the floating conversion parameter, and a sample selection parameter is obtained by taking an integer part for the floating conversion parameter. For the conventional linear interpolation algorithm, the proportion of the target audio sample in the initial audio sample and the sequence numbers of the two selected adjacent initial audio samples are irrelevant, so that the audio resampling method of the embodiment of the invention obviously improves the linear interpolation algorithm and enhances the correlation degree during audio resampling to a certain extent.
In some embodiments of the present invention, the plurality of floating conversion parameters, the plurality of sampling weight parameters, and the plurality of sample selection parameters are respectively constrained by the following second relational mathematical model:
μ i =(i×f x )/f y
coef i =frac(μ i ),
a i =int(μ i ),
wherein, f x Representing the initial sampling frequency, f y Representing the target sampling frequency, mu i Representing the ith float conversion parameter, coef i Denotes the ith sample weight parameter, frac (μ) i ) Denotes the fractional part, int (μ), of the ith float conversion parameter i ) Indicating that the integer part is taken for the ith float conversion parameter.
It is understood that the above formula is a representation of the steps S310 and S320 in a specific mathematical relationship, so that a plurality of sampling weight parameters and a plurality of sample selection parameters, which correspond to each other one by one, can be calculated by the above formula.
In some embodiments of the present invention, as shown in fig. 3, the taking a fractional part and an integer part of each floating-up conversion parameter respectively to obtain a plurality of sampling weight parameters and a plurality of sample selection parameters in a one-to-one correspondence includes the following steps:
step S321, setting the initial values of the sampling weight parameter and the sample selection parameter to be 0;
step S322, calculating to obtain a first sampling weight parameter and a first sample selection parameter according to the second relation mathematical model;
step S323 is based on the accumulation operation and according to the first sampling weight parameter and the first sample selection parameter, to sequentially obtain a plurality of sampling weight parameters and a plurality of sample selection parameters.
It will be appreciated that, according to the second relational mathematical model: mu.s i =(i×f x )/f y It can be seen that the calculation in the formula is a multiply-divide calculation, while in practice, the CPU of the embedded system is relatively inefficient in handling multiplication than in handling addition, and therefore it is necessary to convert the multiplication into addition as much as possible at compile time. In the embodiment of the invention, when each sampling weight parameter and each sample selection parameter are calculated, the first obtained floating conversion parameter, namely mu, is firstly calculated 1 To obtain a first sampling weight parameter and a second sampling weight parameterOne sample selection parameter, coef 1 And a 1 (ii) a And each subsequent sampling weight parameter and each subsequent sample selection parameter are successively obtained in an accumulation mode, so that multiplication operation is converted into addition operation, and the processing efficiency of the processor is improved to a certain extent.
In some embodiments of the present invention, as shown in fig. 4, the initial sampling frequency and the target sampling frequency both use binary floating point numbers, and the first sampling weight parameter and the first sample selection parameter are obtained by calculation according to the second mathematical relational model, which includes the following steps:
step S3221, performing a shift operation of shifting the initial sampling frequency by k bits to the left to obtain a quantized sampling frequency, where k represents quantization precision;
step S3222, converting the quantized sampling frequency into an ultra-long integer and dividing the ultra-long integer by the target sampling frequency to obtain integer floating conversion parameters;
step S3223, performing a shift operation of right shifting by k bits on the integer floating conversion parameter to obtain a sample selection parameter of the integer;
step S3224, decimal number 2 k -1 converting into a binary number to obtain a decimal fraction fetching code;
step S3225, and-calculating the integer floating-integer conversion parameter and the fractional bit-taking code to obtain the sampling weight parameter of the integer.
It is understood that in practice, some processors may process data in a high-level language such as C, and the data may be binary floating point numbers, and for the miniaturized embedded system, the binary floating point numbers cannot be processed, so that the CPU of the miniaturized embedded system can process the data by converting the binary floating point numbers into binary integers.
Specifically, taking the quantization precision of 14bits as an example, the initial sampling frequency of a binary floating point number is shifted to the left by 14bits, that is, the 14-bit fractional part from high to low in the initial sampling frequency is partially stolen into an integer, and the quantized sampling frequency is obtained. For decimal, it is equivalent to enlarging the initial sampling frequency by a factor of 14 of 2, so the quantization precision represents the degree of quantization size of this process.
Converting the quantized sampling frequency into an ultra-long integer number to remove the unquantized low-order decimal in the original initial sampling frequency, and then according to the formula: mu.s 1 =f x /f y And calculating to obtain floating integer conversion parameters of the integer number. And (3) shifting the floating integer conversion parameter of the integer number by 14bits to the right, namely removing the 14-bit decimal of the floating integer conversion parameter after quantization processing to obtain the integer part of the floating integer conversion parameter, namely the sample selection parameter.
Will decimal number 2 14 -1 is converted into a binary number, which in practice results in a binary number with 14bits all being 1, which is taken as a decimal digit code, and the decimal part of the initial sampling frequency is obtained by summing the last 14bits of the floating conversion parameter. I.e. the sampling weight parameter.
Therefore, according to the above steps, the processor converts the floating-point operation into the fixed-point operation, and can be well applied to a small embedded system which cannot process the floating-point operation.
In some embodiments of the present invention, as shown in fig. 5, the method for obtaining a plurality of sampling weight parameters and a plurality of sample selection parameters in sequence based on an accumulation operation and according to a first sampling weight parameter and a first sample selection parameter comprises the following steps:
step S3231, accumulating the i first sample selection parameters to obtain a first temporary value;
step S3232, accumulating the i first sampling weight parameters to obtain a second temporary value;
step S3233, if the second temporary value is smaller than 1, using the first temporary value as the ith sampling weight parameter, and using the second temporary value as the ith sampling weight parameter;
step S3234, if the second temporary value is greater than 1, adding the integer part of the second temporary value to the first temporary value to obtain a third temporary value, taking the fractional part of the second temporary value to obtain a fourth temporary value, taking the third temporary value as the ith sampling weight parameter, and taking the fourth temporary value as the ith sampling weight parameter.
Can understand thatFor a plurality of coef 1 And a plurality of a 1 When the sampling weight parameters and the sample selection parameters are respectively accumulated to obtain corresponding sampling weight parameters and sample selection parameters, because the sampling weight parameters and the sample selection parameters are actually the fractional part and the integer part of the floating conversion parameters, when the sampling weight parameters are accumulated and a plurality of fractional accumulation results are more than 1, the integer part of the sampling weight parameters at the moment is removed and added into the sample selection parameters in a carry mode.
In some embodiments of the present invention, obtaining the number of target audio samples according to the initial sampling frequency, the number of initial audio samples, and the target sampling frequency includes the following steps:
obtaining a quantity deviation value of the target audio sample according to the third correlation coefficient model;
rounding down the number offset value to obtain the number of target audio samples;
wherein, the third correlation coefficient model is:
m′=(n×f y )/f x
where m' represents a number offset value, n represents the number of initial audio samples, f x Representing the initial sampling frequency, f y Representing the target sampling frequency.
It will be appreciated that since there may be a fractional part of the sampling frequency, the third correlation model is used to first determine an estimate of the number of target audio samples, i.e. a number offset value, and then to round the number offset value down to determine the final number of samples of the target sampling frequency.
In some embodiments of the invention, the sample selection parameter b i And a sample selection parameter a i The relationship between them is constrained by the following fourth relational mathematical model:
Figure BDA0003685409550000101
where n represents the number of initial audio samples.
It is understood thatExpressed by a four-relation mathematical model, a parameter b is selected for a sample i And a sample selection parameter a i Is two adjacent sample selection parameters, and a is obtained by calculation i When the number of the initial audio samples is equal to the number of the initial audio samples, a is correspondingly selected ii Two initial audio samples.
In addition, an embodiment of the present invention also provides an audio processing apparatus, the control device including: a memory, a processor, and a computer program stored on the memory and executable on the processor. The processor and memory may be connected by a bus or other means.
The memory, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs as well as non-transitory computer executable programs. Further, the memory may include high speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory optionally includes memory located remotely from the processor, and these remote memories may be connected to the processor through 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 non-transitory software programs and instructions required to implement the audio resampling method of the above-described embodiment are stored in a memory, and when executed by a processor, perform the audio resampling method in the above-described embodiment, for example, performing the above-described method steps S100 to S400 in fig. 1, method steps S310 to S320 in fig. 2, method steps S321 to S323 in fig. 3, method steps S3221 to S3225 in fig. 4, and method steps S3231 to S3234 in fig. 5.
The above-described embodiments of the apparatus are merely illustrative, wherein the units illustrated as separate components may or may not be physically separate, i.e. may be located in one place, or may also be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
Furthermore, an embodiment of the present invention also provides a computer-readable storage medium storing computer-executable instructions, which are executed by a processor or a controller, for example, by a processor in the above-mentioned air conditioner embodiment, and can make the above-mentioned processor execute the audio resampling method in the above-mentioned embodiment, for example, execute the above-mentioned method steps S100 to S400 in fig. 1, method steps S310 to S320 in fig. 2, method steps S321 to S323 in fig. 3, method steps S3221 to S3225 in fig. 4, and method steps S3231 to S3234 in fig. 5.
One of ordinary skill in the art will appreciate that all or some of the steps, systems, and methods disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as is well known to those of ordinary skill in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by a computer. In addition, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as is well known to those skilled in the art.
The embodiments of the present invention have been described in detail with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the gist of the present invention.

Claims (10)

1. A method of audio resampling, the method comprising:
obtaining an initial sampling frequency and a plurality of initial audio samples, the initial audio samples representing samples obtained based on audio sampling at the initial sampling frequency;
determining the number of target audio samples according to the initial sampling frequency, the number of the initial audio samples and a preset target sampling frequency, wherein the target audio samples represent the samples determined according to the target sampling frequency;
according to the initial sampling frequency, the number of the target audio samples and the target sampling frequency, obtaining a plurality of sampling weight parameters and a plurality of sample selection parameters which are in one-to-one correspondence with the plurality of sampling weight parameters, wherein each sampling weight parameter represents and calculates the weight of the initial audio sample required by the corresponding target audio sample, and the plurality of sample selection parameters represent the serial numbers of the plurality of initial audio samples;
obtaining a plurality of target audio samples according to the plurality of sampling weight parameters, the plurality of sample selection parameters and the plurality of initial audio samples.
2. The audio resampling method as recited in claim 1, wherein a plurality of the target audio samples are constrained by the following first relation mathematical model:
Figure FDA0003685409540000011
X=(x 0 ,x 1 ,…,x n ),
Y=(y 0 ,y 1 ,…,y m ),
wherein X represents a plurality of the initial audio samples, Y represents a plurality of the target audio samples, n represents the number of the initial audio samples, m represents the number of the target audio samples, Y represents the number of the target audio samples i Representing the ith said target audio sample, coef i Represents the ith said sampling weight parameter,
Figure FDA0003685409540000012
denotes the a i The number of initial audio samples is one,
Figure FDA0003685409540000013
denotes the b-th i An initial audio sample, a i And i representing two adjacent ones of said sample selection parameters.
3. The audio resampling method as claimed in claim 2, wherein the obtaining a plurality of sampling weight parameters and a plurality of sample selection parameters in one-to-one correspondence according to the initial sampling frequency, the number of target audio samples and the target sampling frequency comprises the following steps:
obtaining a plurality of floating conversion parameters according to the initial sampling frequency, the number of the target audio samples and the target sampling frequency;
and respectively taking a decimal part and an integer part of each floating conversion parameter to obtain a plurality of sampling weight parameters and a plurality of sample selection parameters which are in one-to-one correspondence.
4. The audio resampling method as claimed in claim 3, wherein a plurality of the floating-up conversion parameters, a plurality of the sampling weight parameters, and a plurality of the sample selection parameters are respectively constrained by the following second relational mathematical models:
μ i =(i×f x )/f y
coef i =frac(μ i ),
a i =int(μ i ),
wherein f is x Representing said initial sampling frequency, f y Represents the target sampling frequency, mu i Representing the ith said float conversion parameter, coef i Represents the ith said sampling weight parameter, frac (mu) i ) Indicating the fractional part, int (μ), of the ith of said float conversion parameter i ) Indicating that the integer part is taken for the ith floating conversion parameter.
5. The audio resampling method as claimed in claim 4, wherein said taking a fractional part and an integer part for each said floating conversion parameter respectively to obtain a plurality of said sampling weight parameters and a plurality of said sample selection parameters in a one-to-one correspondence, comprises the following steps:
setting the initial values of the sampling weight parameter and the sample selection parameter to be 0;
calculating to obtain a first sampling weight parameter and a first sample selection parameter according to the second relation mathematical model;
and based on accumulation operation, sequentially obtaining a plurality of sampling weight parameters and a plurality of sample selection parameters according to the first sampling weight parameter and the first sample selection parameter.
6. The method of claim 5, wherein the initial sampling frequency and the target sampling frequency both use binary floating point numbers, and the first sampling weight parameter and the first sample selection parameter are obtained by calculation according to the second mathematical relational model, comprising the steps of:
carrying out shift operation of shifting the initial sampling frequency by k bits to the left to obtain a quantization sampling frequency, wherein k represents quantization precision;
converting the quantized sampling frequency into an ultralong integer number and dividing the ultralong integer number by the target sampling frequency to obtain an integer number floating and integer conversion parameter;
performing a shift operation of shifting the integer number by k bits to the right to obtain the sample selection parameter of the integer number;
will decimal number 2 k -1 converting into a binary number to obtain a decimal fraction fetching code;
and the integer number floating and integer conversion parameter and the decimal place-taking code are subjected to AND operation to obtain the sampling weight parameter of the integer number.
7. The audio resampling method as claimed in claim 5, wherein said obtaining a plurality of said sampling weight parameters and a plurality of said sample selection parameters in sequence based on the accumulation operation and according to said first sampling weight parameter and said first sample selection parameter comprises:
accumulating i of said first sample selection parameters to obtain a first temporary value;
accumulating the i first sampling weight parameters to obtain a second temporary value;
if the second temporary value is less than 1, taking the first temporary value as the ith sampling weight parameter, and taking the second temporary value as the ith sampling weight parameter;
if the second temporary value is greater than 1, adding the integer part of the second temporary value to the first temporary value to obtain a third temporary value, taking the decimal part of the second temporary value to obtain a fourth temporary value, taking the third temporary value as the ith sampling weight parameter, and taking the fourth temporary value as the ith sampling weight parameter.
8. The audio resampling method as claimed in claim 2, wherein said obtaining the number of target audio samples according to the initial sampling frequency, the number of initial audio samples and the target sampling frequency comprises the following steps:
obtaining a number offset value of the target audio sample according to a third correlation coefficient model;
rounding down the number offset value to obtain the number of the target audio samples;
wherein the third correlation coefficient model is:
m′=(n×f y )/f x
wherein m' represents the number offset value, n represents the number of the initial audio samples, f x Representing said initial sampling frequency, f y Representing the target sampling frequency.
9. An audio processing device comprising: memory, processor and computer program stored on the memory and executable on the processor, characterized in that the processor implements the audio resampling method as claimed in any of claims 1 to 8 when executing the computer program.
10. A computer-readable storage medium storing computer-executable instructions for performing the audio resampling method as recited in any of claims 1-8.
CN202210644539.5A 2022-06-09 2022-06-09 Audio resampling method, audio processing device and storage medium Active CN115083427B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210644539.5A CN115083427B (en) 2022-06-09 2022-06-09 Audio resampling method, audio processing device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210644539.5A CN115083427B (en) 2022-06-09 2022-06-09 Audio resampling method, audio processing device and storage medium

Publications (2)

Publication Number Publication Date
CN115083427A true CN115083427A (en) 2022-09-20
CN115083427B CN115083427B (en) 2023-06-16

Family

ID=83252148

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210644539.5A Active CN115083427B (en) 2022-06-09 2022-06-09 Audio resampling method, audio processing device and storage medium

Country Status (1)

Country Link
CN (1) CN115083427B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0677768A (en) * 1992-08-25 1994-03-18 Kowa Co Sampling rate converting method for digital audio data
JP2010033406A (en) * 2008-07-30 2010-02-12 Sony Corp Image processing device, image device, and image processing method
CN106134514B (en) * 2010-05-14 2013-10-23 航天恒星科技有限公司 Sampling rate converting method based on Farrow Structure Filter and device
CN104123943A (en) * 2013-04-28 2014-10-29 安凯(广州)微电子技术有限公司 Audio signal resampling method and apparatus
CN106972840A (en) * 2017-02-28 2017-07-21 深圳市鼎阳科技有限公司 A kind of sampling rate converting method and device
CN109889692A (en) * 2019-02-21 2019-06-14 无锡中感微电子股份有限公司 A kind of TV signal resampling processing method and processing device
CN109976660A (en) * 2019-02-25 2019-07-05 安徽白鹭电子科技有限公司 Any resampling methods and sampled-data system based on linear interpolation
CN113630212A (en) * 2021-08-05 2021-11-09 深圳市思码逻辑技术有限公司 Digital signal down-sampling method and down-sampling device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0677768A (en) * 1992-08-25 1994-03-18 Kowa Co Sampling rate converting method for digital audio data
JP2010033406A (en) * 2008-07-30 2010-02-12 Sony Corp Image processing device, image device, and image processing method
CN106134514B (en) * 2010-05-14 2013-10-23 航天恒星科技有限公司 Sampling rate converting method based on Farrow Structure Filter and device
CN104123943A (en) * 2013-04-28 2014-10-29 安凯(广州)微电子技术有限公司 Audio signal resampling method and apparatus
CN106972840A (en) * 2017-02-28 2017-07-21 深圳市鼎阳科技有限公司 A kind of sampling rate converting method and device
CN109889692A (en) * 2019-02-21 2019-06-14 无锡中感微电子股份有限公司 A kind of TV signal resampling processing method and processing device
CN109976660A (en) * 2019-02-25 2019-07-05 安徽白鹭电子科技有限公司 Any resampling methods and sampled-data system based on linear interpolation
CN113630212A (en) * 2021-08-05 2021-11-09 深圳市思码逻辑技术有限公司 Digital signal down-sampling method and down-sampling device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
冯承景: ""数字音频重压缩与重采样检测算法的研究"" *

Also Published As

Publication number Publication date
CN115083427B (en) 2023-06-16

Similar Documents

Publication Publication Date Title
JP4875041B2 (en) Data compression system and method
CN109993298B (en) Method and apparatus for compressing neural networks
CN112990438B (en) Full-fixed-point convolution calculation method, system and equipment based on shift quantization operation
CN113936647B (en) Training method of voice recognition model, voice recognition method and system
CN107770525B (en) Image coding method and device
CN113783962B (en) Data acquisition system and method based on edge calculation
CN111723901A (en) Training method and device of neural network model
CN110730369B (en) Video recommendation method and server
CN113869599A (en) Fish epidemic disease development prediction method, system, equipment and medium
CN113630212B (en) Downsampling method and downsampling device for digital signals
CN115083427A (en) Audio resampling method, audio processing equipment and storage medium
CN111383157A (en) Image processing method and device, vehicle-mounted operation platform, electronic equipment and system
CN114820755B (en) Depth map estimation method and system
CN115952916A (en) Artificial intelligence-based wind power prediction error correction method, device and equipment
CN112561050B (en) Neural network model training method and device
CN115374989A (en) Load prediction method, device, equipment and computer readable storage medium
CN115293292A (en) Training method and device for automatic driving decision model
WO2020217620A1 (en) Training device, estimation device, training method, estimation method, and program
CN112152633A (en) Vibration signal compression method and device
CN113535407B (en) Optimization method, system, equipment and storage medium of server
CN116384452B (en) Dynamic network model construction method, device, equipment and storage medium
CN117526318A (en) Power distribution network state evaluation method and device, electronic equipment and storage medium
CN114550735A (en) Musical instrument tone conversion model construction method and musical instrument tone conversion method
CN115454807A (en) Capacity prediction method, device and equipment of operation and maintenance system
CN116957007A (en) Feature quantization method, device, medium and program product for neural network training

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