Summary of the invention
The technical problem to be solved in the present invention provides a kind of reverberation model generation method and device, can realize simulating the reverberation characteristic of special scenes.
For solving the problems of the technologies described above, embodiments of the invention provide technical scheme as follows:
On the one hand, provide a kind of reverberation model generation method, comprising:
Determine reverberation model to be optimized argument sequence and the objective function of described argument sequence;
With the input of described argument sequence as genetic algorithm, described objective function is formed the search volume as the fitness function of genetic algorithm, obtains the argument sequence with optimal adaptation degree;
Make up reverberation model according to described argument sequence with optimal adaptation degree.
Wherein, described definite reverberation model to be optimized argument sequence and the step of the objective function of described argument sequence before also comprise:
Set up reverberation model, described reverberation model comprises at least six filter cells, each filter cell has 4 parameter (pi, Di, gi, ai), wherein pi is the reference position of i filter cell, Di is the time-delay length of i filter cell, gi is the gain factor of i filter cell, and ai is the low-pass filtering coefficient of i filter cell, and described reverberation model is output as y (n), wherein, described parameter satisfies constraint condition 0<p1<p2<p3<p4<N, pi+di<N, 0<gi<1,0<ai<1, wherein N is the delay line total length of described reverberation model.
Wherein, the step of the objective function of the argument sequence of described definite described reverberation model and described argument sequence comprises:
Determine all filter cells of described reverberation model parameter combinations (p1, d1, g1, a1, p2, d2, g2, a2 ..., p6, d6, g6, a6 ...) and be the parameter series of described reverberation model;
Gather the reverberation shock response h (n) of special scenes, and will
Be made as the objective function of described argument sequence, wherein L is the length of h (n).
Wherein, described with the input of described argument sequence as genetic algorithm, described objective function is formed the search volume as the fitness function of genetic algorithm, and the step of obtaining the argument sequence with optimal adaptation degree comprises:
Initialization gene Selection probability;
A, each parameter in the described argument sequence is carried out bits of encoded, an argument sequence behind the coding as body one by one, is produced individuality more than according to described gene Selection probability;
B, to described more than one individuality decode, obtain the corresponding parameters sequence, calculate the target function value that each satisfies the argument sequence of described constraint condition, the target function value of argument sequence as corresponding individual fitness, is found out the individuality with optimal adaptation degree;
C, according to described individuality with optimal adaptation degree, upgrade the gene Selection probability, and evolutionary generation added one;
Repeating said steps A~C presets the individual of fitness or reaches default evolutionary generation until occurring reaching, and obtains the argument sequence with optimal adaptation degree.
Wherein, the described step of obtaining the argument sequence with optimal adaptation degree comprises:
The individuality that reaches default fitness is decoded, with the corresponding parameters sequence as argument sequence with optimal adaptation degree; Or
After reaching default evolutionary generation, the highest individuality of fitness in all generations of evolving is decoded, with the corresponding parameters sequence as argument sequence with optimal adaptation degree.
The embodiment of the invention also provides a kind of reverberation model generating apparatus, comprising:
Determination module, be used for determining reverberation model to be optimized argument sequence and the objective function of described argument sequence;
Computing module is used for the input of described argument sequence as genetic algorithm, and described objective function is formed the search volume as the fitness function of genetic algorithm, obtains the argument sequence with optimal adaptation degree;
Make up module, be used for making up reverberation model according to described argument sequence with optimal adaptation degree.
Wherein, described device also comprises:
Set up module, be used to set up reverberation model, described reverberation model comprises at least six filter cells, each filter cell has 4 parameters (pi, Di, gi, ai), wherein pi is the reference position of i filter cell, and Di is the time-delay length of i filter cell, and gi is the gain factor of i filter cell, ai is the low-pass filtering coefficient of i filter cell, described reverberation model is output as y (n), and wherein, described parameter satisfies constraint condition 0<p1<p2<p3<p4<N, pi+di<N, 0<gi<1,0<ai<1, wherein N is the delay line total length of described reverberation model.
Wherein, described determination module comprises:
Determine submodule, be used for determining all filter cells of described reverberation model parameter combinations (p1, d1, g1, a1, p2, d2, g2, a2 ..., p6, d6, g6, a6 ...) and be the argument sequence of described reverberation model;
Collection is provided with submodule, is used to gather the reverberation shock response h (n) of special scenes, and will
Be made as the objective function of described argument sequence, wherein L is the length of h (n).
Wherein, described computing module comprises:
The initialization submodule is used for initialization gene Selection probability;
The coding submodule is used for according to described gene Selection probability each parameter of described argument sequence being carried out bits of encoded, and an argument sequence behind the coding as body one by one, is produced individuality more than;
The decoding calculating sub module, be used for to described more than one individuality decode, obtain the corresponding parameters sequence, calculate the target function value that each satisfies the argument sequence of described constraint condition, the target function value of argument sequence as corresponding individual fitness, is found out the individuality with optimal adaptation degree;
Updating submodule is used for the individuality that has the optimal adaptation degree according to described, upgrades the gene Selection probability, and evolutionary generation is added one;
Processing sub is used for obtaining the argument sequence with optimal adaptation degree after the individual of default fitness occurring reaching or reaching default evolutionary generation.
Embodiments of the invention have following beneficial effect:
In the such scheme, at first determine the argument sequence of reverberation model to be optimized and the objective function of this argument sequence, then with of the input of this argument sequence as genetic algorithm, this objective function is as the fitness function of genetic algorithm, form the search volume, obtain argument sequence with optimal adaptation degree, just near the reverberation shock response of true environment and the argument sequence of frequency characteristic, make up reverberation model according to this argument sequence afterwards, just obtained simulating the reverberation model of this true environment reverberation characteristic.The technical scheme of the embodiment of the invention can be true to nature any specific arenas of simulation, the reverberation characteristic of buildingss such as cinema perfect reappears on-the-spot audio.
Embodiment
For technical matters, technical scheme and advantage that embodiments of the invention will be solved is clearer, be described in detail below in conjunction with the accompanying drawings and the specific embodiments.
Embodiments of the invention at reverberation model in the prior art can only be comparatively rough the problem of simulated environment characteristic, a kind of reverberation model generation method and device are provided, can realize simulating the reverberation characteristic of special scenes.
Figure 2 shows that the schematic flow sheet of embodiments of the invention reverberation model generation method, as shown in Figure 2, present embodiment comprises:
Step 201, determine reverberation model to be optimized argument sequence and the objective function of this argument sequence;
Step 202, with of the input of this argument sequence as genetic algorithm, this objective function is as the fitness function of genetic algorithm, forms the search volume, obtains the argument sequence with optimal adaptation degree;
Step 203, make up reverberation model according to this argument sequence with optimal adaptation degree.
The reverberation model generation method of present embodiment, at first determine the argument sequence of reverberation model to be optimized and the objective function of this argument sequence, then with of the input of this argument sequence as genetic algorithm, this objective function is as the fitness function of genetic algorithm, form the search volume, obtain argument sequence with optimal adaptation degree, just near the reverberation shock response of true environment and the argument sequence of frequency characteristic, make up reverberation model according to this argument sequence afterwards, just obtained simulating the reverberation model of this true environment reverberation characteristic.The technical scheme of the embodiment of the invention can be true to nature any specific arenas of simulation, the reverberation characteristic of buildingss such as cinema perfect reappears on-the-spot audio.
Fig. 3 is the structural representation of embodiments of the invention reverberation model generating apparatus, and as shown in Figure 3, present embodiment comprises:
Determination module 30, be used for determining reverberation model to be optimized argument sequence and the objective function of this argument sequence;
Computing module 31 is used for the input of this argument sequence as genetic algorithm, and this objective function is formed the search volume as the fitness function of genetic algorithm, obtains the argument sequence with optimal adaptation degree;
Make up module 32, be used for having the argument sequence structure reverberation model of optimal adaptation degree according to this.
Wherein, this device also comprises:
Set up module 33, be used to set up reverberation model, described reverberation model comprises at least six filter cells, each filter cell has 4 parameters (pi, Di, gi, ai), wherein pi is the reference position of i filter cell, and Di is the time-delay length of i filter cell, and gi is the gain factor of i filter cell, ai is the low-pass filtering coefficient of i filter cell, described reverberation model is output as y (n), and wherein, described parameter satisfies constraint condition 0<p1<p2<p3<p4<N, pi+di<N, 0<gi<1,0<ai<1, wherein N is the delay line total length of described reverberation model.
Further, determination module 30 comprises:
Determine submodule 34, be used for determining all filter cells of this reverberation model parameter combinations (p1, d1, g1, a1, p2, d2, g2, a2 ..., p6, d6, g6, a6 ...) and be the argument sequence of this reverberation model;
Collection is provided with submodule 35, is used to gather the reverberation shock response h (n) of special scenes, and will
Be made as the objective function of this argument sequence, wherein L is the length of h (n).
Further, computing module 31 comprises:
Initialization submodule 36 is used for initialization gene Selection probability;
Coding submodule 37 is used for according to the gene Selection probability each parameter of argument sequence being carried out bits of encoded, and an argument sequence behind the coding as body one by one, is produced individuality more than;
Decoding calculating sub module 38, be used for individuality more than is decoded, obtain the corresponding parameters sequence, calculate the target function value that each satisfies the argument sequence of constraint condition, the target function value of argument sequence as corresponding individual fitness, is found out the individuality with optimal adaptation degree;
Updating submodule 39 is used for upgrading the gene Selection probability according to the individuality with optimal adaptation degree, and evolutionary generation is added one;
Processing sub 40 is used for obtaining the argument sequence with optimal adaptation degree after the individual of default fitness occurring reaching or reaching default evolutionary generation.
After updating submodule 39 is upgraded the gene Selection probability, coding submodule 37 carries out bits of encoded to each parameter in the argument sequence again according to the gene Selection probability that upgrades, produce more than one individual, after decoding calculating sub module 38 is found out the individuality with optimal adaptation degree, updating submodule 39 is upgraded the gene Selection probability again, repeat this step, preset the individual of fitness or reach default evolutionary generation until occurring reaching, processing sub 40 is obtained the argument sequence with optimal adaptation degree according to the individuality that reaches default fitness, perhaps after reaching default evolutionary generation, find out the highest individuality of fitness in all generations of evolving, and then obtain the argument sequence that has the optimal adaptation degree in all generations of evolving.
The reverberation model generating apparatus of present embodiment, at first determine the argument sequence of reverberation model to be optimized and the objective function of this argument sequence, then with of the input of this argument sequence as genetic algorithm, this objective function is as the fitness function of genetic algorithm, form the search volume, obtain argument sequence with optimal adaptation degree, just near the reverberation shock response of true environment and the argument sequence of frequency characteristic, make up reverberation model according to this argument sequence afterwards, just obtained simulating the reverberation model of this true environment reverberation characteristic.Present embodiment can be true to nature any specific arenas of simulation, the reverberation characteristic of buildingss such as cinema perfect reappears on-the-spot audio.
Below reverberation model generation method of the present invention is further introduced, Fig. 4 is another schematic flow sheet of embodiments of the invention reverberation model generation method, and as shown in Figure 4, present embodiment comprises:
Step 401, set up reverberation model;
Reverberation model is made up of filter cell, Figure 5 shows that the structural representation of filter cell, and wherein D is time-delay, and LP is a low-pass filter.The input/output relation of whole filter unit is:
y[n]=gx[n]+x[n-D]-gy′[n-D]
Wherein y ' is the result of y (n) through low-pass filtering (n).Low-pass filter can adopt firstorder filter, that is: y ' (n)=α y ' (n-1)+(1-α) y (n).
Above-mentioned filter cell has time-delay, feedback, and the characteristic of decay and high frequency absorption, reflecting wave is through the characteristic after the wall reflection to a certain extent.General buildings all by about, front and back, about six faces form, therefore, need at least 6 above-mentioned filter cells to form reverberation model, present embodiment is that example is formed reverberation model with 6 filter cells, these 6 filter cells are nested against one another, form network, can simulate the reverberation characteristic of any environment, Figure 6 shows that 6 filter cell mutual relationship synoptic diagram in the reverberation model, each two is that the line segment of arrow is all represented a filter cell shown in Figure 5, and totally 6 filter cells can comprise between the filter cell mutually nested or mutually, the position of arrow indication is that this filter cell is in the position from the delay line that is input to output, the delay line total length is made as N, and each filter cell all has 4 parameters (pi, Di, gi, ai), wherein: pi is the reference position of i filter cell, and Di is the time-delay length of i filter cell, gi is the gain factor of i filter cell, and ai is the low-pass filtering coefficient of i filter cell;
Step 402, determine reverberation model to be optimized argument sequence and the objective function of this argument sequence;
The parameter of 6 filter cells is coupled together, just constituted argument sequence to be optimized, that is: (p1, d1, g1, a1, p2, d2, g2, a2 ..., p6, d6, g6, a6), need find a best parameter sequence, make pulse signal the most approaching with the reverberation shock response h (n) that collects under true environment through the output y (n) that produces behind this reverberation model, just optimum target is:
Minimum, wherein L is the sampling instant total length of h (n).The argument sequence that can satisfy this optimum target makes that y (n) and h (n) are the most approaching, the reverberation effect that the reverberation model of realizing with this group argument sequence can the best simulation true environment, and the argument sequence constraint condition that need satisfy is simultaneously:
1.0<p1<p2<p3<p4<N, wherein N is a reverberation model delay line total length;
2.pi+di<N,i=1,2,3,4,5,6;
3.0<gi<1,i=1,2,3,4,5,6;
4.0<ai<1,i=1,2,3,4,5,6;
Step 403, initialization gene Selection probability;
Initialization gene Selection probability P [i]=0.5, i=0~M-1, wherein M is each individual gene number, because this model has 6 filter cells, each filter cell has 4 parameters, if each parameter is with 8bit coding, then M=6*4*8=192;
Step 404, argument sequence is carried out bits of encoded according to the gene Selection probability;
To argument sequence (p1, d1, g1, a1, p2, d2, g2, a2, ..., p6, d6, g6, a6) encode, an argument sequence behind the coding as body one by one, is encoded with 8bit such as each parameter, body is exactly the character string of 192 bit long so one by one, the gene Selection probability be exactly each bit be 1 probability, behind coding, produce J individual, the number of J can decide according to the operand that practical application can be born, and in theory, J is not more than 2 192 powers;
Step 405, the individuality that produces is decoded, obtain the corresponding parameters sequence;
J the individuality that produces decoded, obtain each individual corresponding parameters sequence, altogether J group argument sequence;
Step 406, calculate the target function value of the argument sequence satisfy constraint condition, the target function value of argument sequence as corresponding individual fitness, is found out the individuality with optimal adaptation degree;
By foregoing constraint condition, at first eliminate the argument sequence that does not satisfy constraint condition, then to remaining argument sequence, calculate the shock response y (n) of corresponding reverberation model respectively, and then can be according to objective function
Calculate the fitness of every group of argument sequence, promptly reflect the target function value of error, find out the argument sequence of target function value minimum, the individuality of this argument sequence correspondence has the individuality of optimal adaptation degree in this generation of evolving just;
Step 407, have the individuality of optimal adaptation degree, upgrade the gene Selection probability, and evolutionary generation is added one according to this;
Having bit in the individuality of optimal adaptation degree according to this is 1 probability, upgrades the gene Selection probability, and evolutionary generation adds one simultaneously;
Step 408, judge whether to satisfy default target function value or reach default evolutionary generation,, otherwise turn to step 404 if turn to step 409;
Step 409, the highest individuality of fitness is decoded, according to this individuality corresponding parameters sequence construct reverberation model.
If reach the individuality of default fitness, this individuality is decoded, with the corresponding parameters sequence as argument sequence with optimal adaptation degree; Or after reaching default evolutionary generation, the highest individuality of fitness in all generations of evolving is decoded, with the corresponding parameters sequence as argument sequence with optimal adaptation degree.Make up reverberation model according to the argument sequence that obtains afterwards, just can obtain and the immediate reverberation model of the reverberation characteristic of true environment.
In the present embodiment, the effect that intersects in the genetic algorithm and make a variation is replaced finishing by the gene Selection probability P, because before producing individuality of new generation, P can make progress an evolution for the highest genes of individuals inclination of fitness, thereby help the individual good characteristic of inheriting lasted evolution generation to a certain extent of a new generation, make population of individuals develop towards the high direction of fitness.Simultaneously, so-called P is to the highest individual inclination of fitness, wherein the highest individuality of fitness is last one optimum individual of evolving generation, rather than the optimum individual since the successive dynasties, the reason of doing like this is, though the fitness of the optimum individual of previous generation may be lower than the fitness of the optimum individual since the successive dynasties, if with the optimum individual since the successive dynasties as each inclination reference for the gene Selection probability, so with regard to the locally optimal solution of easy premature convergence to problem, rather than globally optimal solution.The gene Selection probability P can substitute the effect that intersects and make a variation, and reduces computational complexity greatly.
After the process genetic algorithm is carried out optimal treatment, just obtained and the immediate reverberation model parameter of the reverberation characteristic of true environment, owing to the optimizing process of argument sequence and the foundation of reverberation model are separated, so the foundation of reverberation model can not be subjected to the high influence of genetic algorithm complexity.And because the employing of the filter cell of this reverberation model is the tupe of feedback filtering, therefore required memory space and calculated amount is all very little during the reverberation model real-time working, this reverberation model is used for music handles, can produce the sound special efficacy of simulation true environment.
The reverberation model generation method of present embodiment, at first create a general model, promptly by some all pass filters, a reverberation model of delay line and the mutually nested composition of gain factor, to control these wave filters then, the parameter of delay line and gain factor is encoded according to genetic algorithm, the groups of individuals that coding produces is selected the superior and eliminated the inferior in genetic algorithm, after the several times iteration, can produce near the reverberation shock response of true environment and the individuality of frequency characteristic, after this individual decoding, just obtained simulating the reverberation model parameter of this true environment reverberation characteristic.The embodiment of the invention can be true to nature any specific arenas of simulation, the reverberation characteristic of buildingss such as cinema perfect reappears on-the-spot audio.
Described method embodiment is corresponding with described device embodiment, the description of relevant portion gets final product among the part comparable device embodiment that does not describe in detail in method embodiment, and the description of relevant portion gets final product among the part reference method embodiment that does not describe in detail in device embodiment.
One of ordinary skill in the art will appreciate that, realize that all or part of step in the foregoing description method is to instruct relevant hardware to finish by program, described program can be stored in the computer read/write memory medium, this program is when carrying out, comprise step as above-mentioned method embodiment, described storage medium, as: magnetic disc, CD, read-only storage memory body (Read-Only Memory, ROM) or at random store memory body (Random Access Memory, RAM) etc.
In each method embodiment of the present invention; the sequence number of described each step can not be used to limit the sequencing of each step; for those of ordinary skills, under the prerequisite of not paying creative work, the priority of each step is changed also within protection scope of the present invention.
The above is a preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from principle of the present invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.