The present application claims the benefit of priority of Japanese Patent Application No. 2021-153006 filed on Sep. 21, 2021 and Japanese Patent Application No. 2022-98190 filed on Jun. 17, 2022, the entire contents of Japanese Patent Application No. 2021-153006 and Japanese Patent Application No. 2022-98190 are incorporated herein by reference.
The present disclosure relates to a musical sound signal generation device, a musical sound signal generation method, and a non-transitory computer-readable recording medium storing a program.
The number of delay units constituting a wave guide modeling sound source is an integer and is discrete. Therefore, a technique for achieving a delay length of a fraction finer than the integer corresponding to the number of delay units is required in order to determine a strict frequency.
As a related art for continuously achieving fractional delay lengths in a wide frequency band, for example, there is known a technique of inserting an all-pass filter before a final stage of a delay unit in JP H6-348277 A. This technique achieves a musical sound signal synthesis device including: a first all-pass filter APF1; a second all-pass filter APF2; a variable connection means for connecting the first and second all-pass filters to selected different stages of delay elements; a control means for controlling the all-pass filters and the variable connection means such that delay times become equal in outputs of the first and second all-pass filters; and a weighted addition means for performing weighted addition of the outputs of the first and second all-pass filters. In this related art, it is possible to prevent a decrease in amplitude in a high frequency band by using the all-pass filter. In addition, in this related art, a fractional delay length is generated by the weighted addition of the two all-pass filters to suppress generation of noise due to discontinuous transition of a coefficient of the all-pass filter between 0.0 and 1.0 when a tone pitch frequency changes with time and an integer delay length in a wave guide modeling sound source is switched with a lapse of time, such as at the time of pitch bend.
In the above-described related art, however, it is necessary to operate the two all-pass filters such that the delay times are always equal and to perform the weighted addition of the outputs of the two all-pass filters. Thus, an operation of constantly multiplying a filter coefficient twice is executed in each calculation of the two all-pass filters, and a multiplication operation in the weighted addition is also required, so that a total of at least six multiplication operations are required per sample. In a case where, for example, 256 polyphonic sounds are simultaneously generated using such a technique of the wave guide modeling sound source with a large number of multiplication operations (for example, in the case of a modeling sound source of a piano), it is necessary to perform multiplication operations, for example, at least 6 times×256 polyphonic sounds=1,536 times of multiplication operations in total per sample, and there is a problem that the amount of calculation for musical sound generation increases as a whole.
Therefore, one advantage of the present disclosure is to generate a musical sound with a small amount of calculation.
A musical sound signal generation device continuously connects any one of a connected zeroth delay unit and a connected second delay unit to a fractional delay block and connects at least any one of a new zeroth delay unit and a new second delay unit to at least any one of the fractional delay block other than the fractional delay block connected to a new first delay unit in response to setting any one of the connected zeroth delay unit and the connected second delay unit as the new first delay unit, setting a delay unit in a preceding stage of the new first delay unit as the new zeroth delay unit, and setting a delay unit in a subsequent stage of the new first delay unit as the new second delay unit in accordance with a change in a designated tone pitch.
Hereinafter, modes for carrying out the present disclosure will be described in detail with reference to the drawings. An electronic device includes a musical sound signal generation device 100, a performance operator (not illustrated), and a speaker. The performance operator corresponds to a key when the electronic device is a keyboard, such as an electronic piano, and corresponds to a mouthpiece when the electronic device is an electronic wind instrument.
In the present embodiment, an example of using the CPU 101 and the DSP 104 is described as an embodiment in which the present disclosure is implemented as software. However, the CPU 101 may play the role of the DSP 104. In addition, the function of the DSP 104 may be implemented by the hardware wave guide model circuit 104.
A wave guide model control unit 201, which is a control circuit, receives tone pitch information 203 (for example, a note number depending on a key in the case of the electronic piano) input from the tone pitch designation switch 111 in
Here, it is known that there is a relationship of
g=(1−1)/(1+1) (1)
between the fractional part 1 of the delay length and the filter coefficient g of the all-pass filter.
In addition, the wave guide model control unit 201 calculates a volume 207 of an excitation original sound 206 on the basis of volume information 205 input from the volume sensor 109 in
The wave guide model calculation unit 202 receives the excitation original sound 206 multiplied by the volume 207 as an input signal x(n) and the delay length (the number of delay units k and the filter coefficient g), performs calculation to be described later with reference to
In the present embodiment, the wave guide model calculation unit 202 includes three all-pass filter circuits (hereinafter referred to as “APF”) 305 including #0, #1, and #2. The APF 305 is connected to both ends of any of the delay units 302 in the delay line 301, thereby operating as the all-pass filter. The APF 305 includes: a multiplier 306 that multiplies a signal on an input side of the connected delay unit 302 by a feedforward gain g (g0, g1, or g2); an adder 309 that adds a signal on an output side of the connected delay unit 302, an output signal of the multiplier 306, and an output signal of a multiplier 308 to be described later and selectively outputs the added output signal to a switch 310; a feedback delay unit 307 that delays the added output signal by one sampling time; and the multiplier 308 that multiplies an output signal of the feedback delay unit 307 by a feedback gain −g (−g0, −g1, or −g2) and outputs the multiplied output signal to the adder 309.
Each set of connection terminals i00 and i01 of the APF 305(#0), connection terminals i10 and i11 of the APF 305(#1), and connection terminals i20 and i21 of the APF 305(#2) is connected to delay line switch terminals at both ends of the same delay unit 302 of the delay line 301.
In addition, the APF 305(#0), the APF 305(#1), and the APF 305(#2) respectively include sets of the feedforward gain and the feedback gain, that is, (g0 and −g0), (g1 and −g1), and (g2 and −g2). Hereinafter, the feedforward gain and the feedback gain are collectively referred to as a filter coefficient of the all-pass filter.
The APF 305(#0), the APF 305(#1), and the APF 305(#2) are always connected to the respective adjacent delay units 302 in the delay line 301, and the order thereof is controlled to be switched in the order of an annular ring by pitch bend control processing to be described later.
Each output destination of the APF 305(#0), the APF 305(#1), or the APF 305(#2) is connected to each output selection terminal o0, o1, or o2 of the switch 310, and one of the output selection terminals is selected to output an output signal y(n), whereby the musical sound signal 209 is output. In addition, the output signal y(n) is multiplied by an output feedback gain by the multiplier 304, and the multiplication result is added to the input signal x(n) by the adder 311.
As a result, in the wave guide model calculation unit 202 in
In addition, delay line switch terminals dk−1 and dk at both ends of a delay unit 302(#k−1), which is a zeroth delay unit in an immediately preceding stage of the delay unit 302(#k), which is the first delay unit, in the delay line 301 are respectively connected to the connection terminals i00 and i01 of the APF 305(#0).
Furthermore, delay line switch terminals dk+1 and dk+2 at both ends of a delay unit 302(#k+1), which is a second delay unit in an immediately subsequent stage of the delay unit 302(#k), which is the first delay unit, in the delay line 301 are respectively connected to the connection terminals i20 and i21 of the APF 305(#2).
The wave guide model control unit 201 in
In addition, a value of 0 that causes a delay of a value of 1 in the fractional part is set as the feedforward gain and the feedback gain of the filter coefficient in both of the multipliers 306(#0) and 308(#0) of the APF 305(#0).
Further, values of 1 and −1 that cause a delay of a value of 0 of the fractional part are respectively set as the feedforward gain and the feedback gain of the filter coefficient in the multipliers 306(#2) and 308(#2) of the APF 305(#2).
Then, the switch 310 causes conduction of the output selection terminal o1. As a result, an output signal of the APF 305(#1) is selected as the output signal y(n) via the switch 310, whereby the musical sound signal 209 is output. In addition, the output signal y(n) is multiplied by the output feedback gain by the multiplier 304, and the result is added to the input signal x(n) by the adder 311.
As a result of the above control operation, as the musical sound signal 209, the integer part k of the delay length corresponding to the designated tone pitch is generated by the delay units 302 including #0 to #k−1 in the delay line 301, and the fractional part 1 of the delay length is generated by the APF 305(#1) that operates on the basis of the filter coefficient g calculated by the calculation represented by Formula (1).
In this case, a circuit including the delay line 301 and the APF 305(#1) has flat frequency characteristics, and thus, it is possible to prevent a decrease in amplitude in a high frequency band.
On the other hand, the value of 1 and the value of −1 that cause the delay of the value of 0 of the fractional part are respectively set as the feedforward gain and the feedback gain of the filter coefficient in the multipliers 306(#2) and 308(#2) of the APF 305(#2) as described above. Therefore, it is substantially unnecessary for the multipliers 306(#2) and 308(#2) to execute a multiplication operation with a large load, and the APF 305(#2) in
As described above, the multiplication operation is substantially necessary only in the APF 305(#1) in the present embodiment, and the multiplication operation is unnecessary in the APF 305(#0) and the APF 305(#2). Therefore, the calculation load can be greatly reduced particularly in musical sound generation by the wave guide modeling with a large number of polyphonic sounds as compared with a technique of JP H6-348277 A in which two all-pass filters are used.
Next, a description will be given regarding a principle of the pitch bend control processing in a case where a player has changed a tone pitch (pitch) of a playing sound being generated by operating the pitch bend sensor 110 (
In
Here, if a value of the number of delay units k does not change, only the filter coefficient g changes. This means that a change in wavelength of the musical sound signal 209 settles within one sampling time. For example, in a case where the player performs a pitch bend operation to decrease a pitch so that the fractional part 1 of a delay length corresponding to a new designated tone pitch sequentially increases, a value of the filter coefficient g calculated by the calculation represented by Formula (1) described above is designated to be sequentially decreased.
When the value of the number of delay units k designated by the wave guide model control unit 201 has been incremented by +1 and changed in this manner, in the wave guide model calculation unit 202 illustrated in
In addition, as a result of the handover in
At this time, the value of 1 and the value of −1 that cause the delay of the value of 0 of the fractional part are respectively set as the feedforward gain and the feedback gain of the filter coefficient in the multipliers 306(#2) and 308(#2) of the APF 305(#2) for the operation as described above. Therefore, the above-described operation of switching the operation of the all-pass filter from the APF 305(#1) to the APF 305(#2) matches well with the operation of controlling the fractional part 1 designated by the wave guide model control unit 201 in
In addition, the APF 305(#2) continuously operates according to actual signals from the delay line switch terminals dk+1 and dk+2, and thus, it is possible to perform control so as not to generate noise at the time of switching the APF 305.
Here, as the value of the fractional part 1 increases in the APF 305(#1), the value of the filter coefficient g calculated by the calculation represented by Formula (1) decreases toward 0 as described above. However, when the control is switched from the APF 305(#1) to the APF 305(#2), the operation is started with the value of the fractional part 1 being reset to 0, and thus, it is necessary to cause a jump of the value of the filter coefficient g from the vicinity of 0 to the vicinity of 1 at this moment. Such a discontinuous jump of the value is not so preferable when envelope control is performed on the filter coefficient g.
Therefore, in the present embodiment, in a case where the delay unit 302 operating as the first delay unit is, for example, an even-numbered delay unit, the filter coefficient g is calculated by the calculation processing represented by Formula (1) described above.
On the other hand, in a case where the delay unit 302 operating as the first delay unit is, for example, an odd-numbered delay unit, the filter coefficient g is calculated by calculation processing represented by the following Formula (2).
In this case, coefficients (1−g) and −(1−g) calculated using the coefficient g calculated by the calculation represented by the above Formula (2) are respectively set as a feedforward gain and a feedback gain in the multipliers 306 and 308.
In the example of
As described above, in the present embodiment, the filter coefficient g can be calculated by switching between the calculation represented by Formula (1) and the calculation represented by Formula (2) depending on whether the delay unit 302 operating as the first delay unit is an even-numbered (or odd-numbered) delay unit or an odd-numbered (or even-numbered) delay unit, and the filter coefficient g designated to the wave guide model calculation unit 202 by the wave guide model control unit 201 in
As a result, the filter coefficient g changing as illustrated in
In
In addition, in
Note that an output of the feedback delay unit 307 may be cleared to 0 before the connection of each of the APFs 305 is switched as described above.
When the value of the number of delay units k designated by the wave guide model control unit 201 has been decremented by 1 and changed in this manner, in the wave guide model calculation unit 202 illustrated in
In addition, as a result of the handover in
At this time, the value of 0 that cause the delay of the value of 1 of the fractional part is set as the feedforward gain and the feedback gain of the filter coefficient in both the multipliers 306(#0) and 308(#0) of the APF 305(#0) for the operation as described above. Therefore, the above-described operation of switching the operation of the all-pass filter from the APF 305(#1) to the APF 305(#0) matches well with the operation of controlling the fractional part 1 designated by the wave guide model control unit 201 in
In addition, the APF 305(#0) continuously operates according to actual signals from the delay line switch terminals dk−1 and dk, and thus, it is possible to perform control so as not to generate noise at the time of switching the APF 305.
Here, as the value of the fractional part 1 decreases in the APF 305(#1), the value of the filter coefficient g calculated by the calculation represented by Formula (1) increases toward 1 as described above. However, when the control is switched from the APF 305(#1) to the APF 305(#0), the operation is started with the value of the fractional part 1 being set to 1, and thus, it is necessary to cause a jump of the value of the filter coefficient g from the vicinity of 1 to the vicinity of 0 at this moment. Such a non-linear jump of the value is not so preferable when envelope control is performed on the filter coefficient g even in the case where the value of the number of delay units k, which is the integer part of the delay length, decreases as in the case where the value of the number of delay units k, which is the integer part of the delay length, increases.
Therefore, in the present embodiment, control is performed to calculate the filter coefficient g by switching between the calculation represented by Formula (1) described above and the calculation represented by Formula (2) depending on whether the delay unit 302 operating as the first delay unit is an even-numbered (or odd-numbered) delay unit or an odd-numbered (or even-numbered) delay unit, and to switch between the set of g and −g and the set of (1−g) and −(1−g) to be set in the multipliers 306 and 308 in the APF 305 as in the case where the value of the number of delay units k, which is the integer part of the delay length, increases.
In the example of
For example, in
As described above, in the present embodiment, even in the case where the value of the number of delay units k, which is the integer part of the delay length, decreases, it is possible to calculate the filter coefficient g by switching between the calculation represented by Formula (1) and the calculation represented by Formula (2) depending on whether the delay unit 302 operating as the first delay unit is an even-numbered (or odd-numbered) delay unit or an odd-numbered (or even-numbered) delay unit, and to continuously change the filter coefficient g, designated to the wave guide model calculation unit 202 by the wave guide model control unit 201 in
As a result, the filter coefficient g changing as illustrated in
In
In addition, in
Note that the output of the feedback delay unit 307 may be cleared to 0 before the connection of each of the APFs 305 is switched as described above, which is similar to the case of
When pitch bend is started, the CPU 101 determines whether L2 is larger or smaller than L1, that is, whether to execute bend-down or bend-up in step S1.
When L1<L2, that is, in the case of the bend-down, the CPU 101 adds a rate r to the fractional part 1 of the delay length in step S2. Note that “+=” represents an operation of adding a variable value on the right side to a variable value on the left side.
When L which is a value of the fractional part 1 and the number of delay units k which is an integer part of a delay length, is larger than a target value in step S3, the CPU 101 causes the fractional part 1 to coincide with l2 for coincidence with the target value in step S4.
Next, the CPU 101 determines whether the number of delay units k is an even number or an odd number in step S5. Note that “%” is an operation of calculating a remainder obtained by dividing the value of the number of delay units k by 2. The number of delay units k is the even number if a result of the operation is 0, and the number of delay units k is the odd number if the result of the operation is not 0.
When k is the even number, the CPU 101 sets a coefficient calculated from the fractional part 1 by the calculation represented by Formula (1) as the filter coefficient g in step S6.
When k is the odd number, the CPU 101 sets a coefficient calculated from the fractional part 1 by the calculation represented by Formula (2) as 1−g in step S8.
Thereafter, when g<0 or 1-g<0 is not satisfied in step S7 or step S9, there is no carry in the number of delay units k, which is the integer part of the delay length, and thus, the CPU 101 directly executes the all-pass filter calculation of each of the APF 305(#0), the APF 305(#1), and the APF 305(#2) in step S10, and then, updates a sample in step S11. Updating the sample means shifting data in each of the delay units 302 of the delay line 301 one by one to advance a waveform.
The CPU 101 ends the processing when it is determined in step S12 that L has reached the target value, and repeats the processing while adding the rate r to L until L reaches the target value when it is determined that L has not reached the target value.
A case where g<0 or 1−g<0 is satisfied in step S7 or step S9 is a case where there is a carry in the number of delay units k, which is the integer part of the delay length. In this case, the CPU 101 sets g=0 in step S13.
In this state, the CPU 101 executes the all-pass filter calculation of each of the APF 305(#0), the APF 305(#1), and the APF 305(#2) in step S14. In this case, the calculation is executed in the APF 305(#1) with the number of delay units k and the filter coefficient of 0, and in the APF 305(#2) with the number of delay units k+1 and the filter coefficient of 1. Since the calculation is started with a value of the feedback delay unit being set to 0 in the APF 305(#2), a signal of i20 is directly output due to the property of the all-pass filter. On the other hand, the calculation is executed with g=0 in the APF 305(#1), and thus, a signal of i11 is directly output. The signals of i20 and i11 are the same. Therefore, at this timing, signals output to the output selection terminals o1 and o2 are equal. Thus, noise is not generated even if the switch 310 switches the output selection terminal from o1 to o2 in step S16.
Thereafter, in step S15, the CPU 101 updates the sample as in step S11.
Subsequently, the CPU 101 switches the switch 310 to the output selection terminal o2.
Thereafter, the CPU 101 clears data in the feedback delay unit 307(#0) of the APF 305(#0) to 0 in step S17.
Thereafter, the CPU 101 reconnects the connection terminals i00 and i01 of the APF 305(#0) to the delay line switch terminals dk+2 and dk+3, respectively, in step S18. In addition, the filter coefficient g0 of the APF 305(#0) is changed from 0 to 1.
A state of the wave guide model calculation unit 202 after switching of the connection of the APF 305(#0) is the same as described above with reference to
After the process of step S18, the CPU 101 returns to the process of step S2 and repeats the operation of increasing the delay length. At this time, the APF 305(#2) is an object for changing the filter coefficient. Thereafter, the APF 305(#0), the APF 305(#1), and the APF 305(#2) become objects of filter coefficient calculation one after another in the ascending order of the annular ring each time the number of delay units k is incremented.
In step S1 of
First, the CPU 101 subtracts the rate r from the fractional part 1 in step S19. In the drawing, “-=” represents an operation of subtracting a variable value on the right side from a variable value on the left side.
In addition, it is determined in step S24 or step S26 whether there is a borrow in the number of delay units k, which is the integer part of the delay length, depending on whether g>1 or 1−g>1 is satisfied.
A case where it is determined that g>1 or 1−g>1 is satisfied is a case where there is the borrow in the number of delay units k. In this case, the CPU 101 sets g=1 in step S30.
The CPU 101 further executes the calculation and sample update of each of the APF 305(#0), the APF 305(#1), and the APF 305(#2) in steps S31 and S32. In the subsequent state, the calculation is performed with the filter coefficient g=1 in the APF 305(#1), and a signal of i10 is output substantially without any change although there is some influence of feedback. The calculation is continued with the filter coefficient of 0 in the APF 305(#0), a signal of i01 is directly output. The signals of i10 and i01 are substantially the same. Therefore, noise is not generated even if the output selection terminal is switched from the output selection terminal o1 to the output selection terminal o0 by the switch 310 in step S33.
The CPU 101 switches the switch 310 to the output selection terminal o0 in step S33.
Thereafter, the CPU 101 clears data in the feedback delay unit 307(#2) of the APF 305(#2) to 0 in step S34.
Thereafter, the CPU 101 connects the connection terminals i20 and i21 of the APF 305(#2) to the delay line switch terminals dk−2 and dk−1, respectively, in step S35.
A state of the wave guide model calculation unit 202 after switching of the connection of the APF 305(#2) is the same as described above with reference to
After the process of step S35, the CPU 101 returns to the process of step S19 and repeats the operation of decreasing the delay length. At this time, the APF 305(#0) is an object for changing the filter coefficient. Thereafter, the APF 305(#0), the APF 305(#1), and the APF 305(#2) become objects of the filter coefficient calculation one after another in the descending order of the annular ring each time the number of delay units k is decremented.
In pitch change processing in which the delay length decreases, the connection is changed with the filter coefficient of the APF 305 being set to 0, and the calculation is started in a state where the filter coefficient is small when the rate r is sufficiently small as described in step S35 in
Although it has been described that the number of times of multiplication can be reduced in the APF 305(#0) and the APF 305(#2) in
As described above, since the plurality of APFs 305 are connected to the respective adjacent delay units 302 in the delay line 301 in advance to prevent undefined data from entering the delay unit 302 in the present embodiment, it is possible to suppress the noise when the number of delay units 302 changes during the sound generation of the wave guide model. In addition, it is possible to reduce the number of times of multiplication in the two APFs 305 other than the APF 305 connected to the first delay unit in the present embodiment.
Then, it is possible to eliminate the frequency dependence of the amplitude and to suppress generation of noise with a small amount of calculation when the number of connections of the delay units changes by using the fractional delay block, such as the all-pass filter, in a wave guide modeling sound source according to the present embodiment. Specifically, there is an advantage in that the number of times of multiplication is reduced by up to four times per one wave guide model. This is because there are about 230 strings in the case of a piano, for example, and the multiplication is reduced by 920 times if all the strings are modeled and operated.
In addition, the envelope control can be easily applied to the filter coefficient since the filter coefficient can be continuously changed according to the present embodiment.
The block diagrams illustrated in the respective drawings described above can be replaced with software. For example, in a case where the entire configuration of
The control program is stored in the ROM 102 in the above-described embodiment, but is not limited thereto, and may be stored in a removable storage medium, such as a USB memory, a CD, and a DVD, or may be stored in a server. The musical sound signal generation device 100 may acquire the control program from such a storage medium or may acquire the control program from the server via a network.
In addition, the number of all-pass filters described in the above embodiment is not limited to three, and four or more all-pass filters may be provided.
In addition, the present invention is not limited to the above-described embodiment, and various modifications can be made in an implementation stage within a scope not departing from a gist thereof. In addition, functions executed in the above-described embodiment may be suitably combined and implemented as much as possible. The above-described embodiment includes different stages, and various inventions can be extracted by combining suitably a plurality of disclosed structural requirements. For example, even when some structural requirements are deleted from all the structural requirements disclosed in the embodiment, a configuration from which the structural requirements have been deleted can be extracted as an invention as long as the effect can be obtained.
Number | Date | Country | Kind |
---|---|---|---|
2021-153006 | Sep 2021 | JP | national |
2022-098190 | Jun 2022 | JP | national |
Number | Name | Date | Kind |
---|---|---|---|
5157214 | Nakanishi | Oct 1992 | A |
5432296 | Takeuchi | Jul 1995 | A |
5432856 | Shioda | Jul 1995 | A |
8345887 | Betbeder | Jan 2013 | B1 |
20040213416 | Dahl | Oct 2004 | A1 |
20230103520 | Kasuga | Apr 2023 | A1 |
Number | Date | Country |
---|---|---|
H06348277 | Dec 1994 | JP |
Number | Date | Country | |
---|---|---|---|
20230103520 A1 | Apr 2023 | US |