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 forms 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 forms the search volume as the fitness function of genetic algorithm, and the step of obtaining the argument sequence with optimal adaptation degree comprises:
The initialization gene is selected probability;
A, select probability that each parameter in the described argument sequence is carried out bits of encoded according to described gene, an argument sequence behind the coding as body one by one, is produced individuality more than;
B, to described more than one individuality decode, obtain corresponding argument 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 gene and select probability, and evolutionary generation is added one;
Repeating said steps A~C, until occur reaching the individual of default fitness or reaching default evolutionary generation, and obtain 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 argument sequence of correspondence as the 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 argument sequence of correspondence as the 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 to determine 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 forms 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 for setting 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 to 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 argument sequence of described reverberation model;
The capture setting submodule is used for gathering 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 the initialization gene and selects probability;
The coding submodule is used for selecting probability that each parameter of described argument sequence is carried out bits of encoded according to described gene, 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 corresponding argument 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 according to described individuality with optimal adaptation degree, upgrades gene and selects probability, and evolutionary generation is added one;
Process submodule, be used for after occurring reaching the individual of default fitness or reaching default evolutionary generation, obtaining the argument sequence with optimal adaptation degree.
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 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 the argument sequence with optimal adaptation degree, namely 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 the 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 for 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 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 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 the argument sequence with optimal adaptation degree, namely 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 the 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 to determine 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 forms 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 according to this argument sequence structure reverberation model of optimal adaptation degree.
Wherein, this device also comprises:
Set up module 33, be used for setting 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 to determine 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;
Capture setting submodule 35 is used for gathering 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 the initialization gene and selects probability;
Coding submodule 37 is used for selecting probability that each parameter of argument sequence is carried out bits of encoded according to gene, 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 corresponding argument 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 according to the individuality with optimal adaptation degree, upgrades gene and selects probability, and evolutionary generation is added one;
Process submodule 40, be used for after occurring reaching the individual of default fitness or reaching default evolutionary generation, obtaining the argument sequence with optimal adaptation degree.
After updating submodule 39 is upgraded gene selection probability, coding submodule 37 selects probability again each parameter in the argument sequence to be carried out bits of encoded according to the gene 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 gene again and is selected probability, repeat this step, until the individual of default fitness occur reaching or reach default evolutionary generation, process submodule 40 and obtain 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 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 the argument sequence with optimal adaptation degree, namely 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 the buildingss such as cinema perfect reappears on-the-spot audio.
The below further introduces reverberation model generation method of the present invention, and 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 comprised of filter cell, Figure 5 shows that the structural representation of filter cell, and wherein D is time-delay, and LP is low-pass filter.The input/output relation of whole filter cell is:
y[n]=gx[n]+x[n-D]-gy′[n-D]
Wherein y ' is that y (n) is through the result of 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 forms reverberation model as an example of 6 filter cells example, these 6 filter cells are nested against one another, and network consisting can be simulated 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 represents 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 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 consisted of argument sequence to be optimized, that is: (p1, d1, g1, a1, p2, d2, g2, a2 ..., p6, d6, g6, a6), need to find the argument sequence of an optimum, so that pulse signal is 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, namely optimum target is:
Minimum, wherein L is the sampling instant total length of h (n).Can satisfy the argument sequence of this optimum target so 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, the argument sequence constraint condition that need to satisfy is simultaneously:
1.0<p1<p2<p3<p4<N, wherein N is 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 are selected probability;
The initialization gene is selected probability P [i]=0.5, i=0~M-1, and wherein M be each individual gene number, because this model has 6 filter cells, each filter cell has 4 parameters, if each parameter is encoded M=6*4*8=192 then with 8bit;
Step 404, select probability that argument sequence is carried out bits of encoded according to gene;
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, gene select probability be exactly each bit be 1 probability, behind coding, produces J individuality, 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 corresponding argument sequence;
J the individuality that produces decoded, obtain each individual corresponding argument 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 respectively the shock response y (n) of corresponding reverberation model, and then can be according to objective function
Calculate the fitness of every group of argument sequence, namely reflect the target function value of error, find out the argument sequence of target function value minimum, the individuality that this argument sequence is corresponding has the individuality of optimal adaptation degree in namely this generation of evolving;
Step 407, have the individuality of optimal adaptation degree according to this, upgrade gene and select probability, and evolutionary generation is added one;
Having bit in the individuality of optimal adaptation degree according to this is 1 probability, upgrades gene and selects probability, and evolutionary generation adds one simultaneously;
Step 408, judge whether to satisfy default target function value or reach default evolutionary generation, if turn to step 409, otherwise turn to step 404;
Step 409, the highest individuality of fitness is decoded, make up reverberation model according to the argument sequence of this individuality correspondence.
If there is the individuality that reaches default fitness, this individuality is decoded, with the argument sequence of correspondence as the 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 argument sequence of correspondence as the 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 of crossover and mutation selects probability P to replace finishing by gene in the genetic algorithm, because before producing individuality of new generation, P can make progress an evolution for the highest genes of individuals inclination of fitness, thereby be conducive to the individual good characteristic of inheriting to a certain extent upper evolution generation of a new generation, so that population of individuals is towards the high future development of fitness.Simultaneously, so-called P is to the highest individual inclination of fitness, wherein the highest individuality of fitness is upper one optimum individual of evolving generation, rather than the optimum individual since the successive dynasties, the reason of doing like this is, although the fitness of the optimum individual of previous generation may be lower than the fitness of the optimum individual since the successive dynasties, if selected the inclination reference of probability as every generation gene with the optimum individual since the successive dynasties, arrive so the locally optimal solution of problem with regard to easy Premature Convergence, rather than globally optimal solution.Gene selects probability P can substitute the effect of crossover and mutation, and greatly reduces computational complexity.
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 subject to the high impact 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 processes, can produce the sound special efficacy of Reality simulation environment.
The reverberation model generation method of present embodiment, at first create a general model, namely by some all pass filters, a reverberation model of delay line and the mutually nested composition of gain factor, then will control these wave filters, 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 the buildingss such as cinema perfect reappears on-the-spot audio.
Described embodiment of the method 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 embodiment of the method, 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 above-described embodiment method is to come the relevant hardware of instruction to finish by program, described program can be stored in the computer read/write memory medium, this program is when carrying out, comprise the step such as above-mentioned embodiment of the method, described storage medium, as: magnetic disc, CD, read-only store-memory body (Read-Only Memory, ROM) or at random store-memory body (Random Access Memory, RAM) etc.
In each embodiment of the method for the present invention; the sequence number of described each step can not be used for limiting 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 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.