Abstract:
A device for computing interpolated values of a waveform generated in an electronic device, includes a memory for storing waveform data of a periodic sinusoidal wave, and an address signal generator for generating an address signal. The waveform data consists of sine wave data and cosine wave data. An address signal from the generator or a signal obtained by inverting the address signal (i.e., inverted address signal) is supplied to the memory. Upon receipt of the address signal, the memory reads out the sine wave data or the cosine wave data. Upon receipt of the inverted address signal, it reads out the remaining wave data. The wave data read from the memory is multiplied by a multiplier, which produced an interpolated value. An adder adds this value to the sine or consine wave data read out from the memory when the inverted address signal is supplied to the memory, and computes amplitude value data corresponding to the address signal.

Description:
BACKGROUND OF THE INVENTION 
     The present invention relates to a device for computing interpolated values for a waveform, digitally generated in an electronic device, by using only amplitude values of the waveform. 
     A variety of devices for digitally generating waveforms have been developed. Particularly in the field of electronic musical instruments, it is frequently required to generate a sine wave or a cosine wave. In such a case, the wave data are initially stored in a ROM (read only memory). The ROM is addressed to read out the waveform data therefrom. In a waveform generating device as disclosed in Kokai No. 57/142698, the amplitude value of a sine wave or a cosine wave at a predetermined sampling point, and the difference between this amplitude value and the amplitude value at a sampling point adjacent to the former point, are stored in a ROM. The difference of the amplitude values is subjected to a linear approximation in a multiplier to obtain interpolated values. The interpolated value thus obtained is used for gaining an amplitude value at a mid point between the sampling points. In storing the sine waveform data or the cosine waveform data in the ROM, the lesser amount of the data to be stored, the better. Nevertheless, in the conventional device, two types of data, i.e., the amplitude value data and the difference data, must be stored; therefore, the memory capacity of the ROM is increased. 
     SUMMARY OF THE INVENTION 
     Accordingly, an object of the present invention is to provide a device for computing interpolated values of a waveform, generated in an electronic device, by using only an amplitude value of a sine wave or a cosine wave as already stored in a ROM. 
     According to the present invention, there is provided a device for computing interpolated values of a waveform, generated in an electronic device. The device comprises: means for generating an address signal containing upper bits and lower bits; memory means for outputting at least 1/4 period of one of two periodic sinusoidal waves including a sine wave and a cosine wave upon receipt of the upper bit signal of said address signal from said address signal generating means, and for outputting at least 1/4 period of the other periodic sinusoidal wave upon receipt of a bit signal with an inverse logic level of said upper bit signal; computing means, connected to said address signal generating means and said memory means, for computing interpolated data by multiplying the lower bit signal from said address signal generating means and said other wave data outputted from said memory means; and computing means, connected to said memory means and said interpolated data computing means, for computing an amplitude value of the sinusoidal wave corresponding to an address signal from said address signal generating means, upon receipt of said one of periodic sinusoidal waves outputted from said memory means and the interpolated data computed by said interpolated data computing means. 
     In the interpolating value computing apparatus thus arranged, the waveform data stored in the memory may be only the amplitude value of a periodic sinusoidal wave. A memory capacity of the memory may be lessened. An interpolated data is computed using the data read out from the memory, thus to obtain an amplitude value of the sinusoidal wave at a predetermined address point. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 shows a graph illustrating a relationship between amplitude values at predetermined address points of a sine wave and an interpolated value, which is useful in explaining an embodiment of the present invention; 
     FIG. 2 shows a block diagram of a device for computing an interpolated value of a waveform for illustrating an embodiment of the present invention; 
     FIG. 3 shows a relationship between a sine wave and address signals corresponding to phases of the sine wave; 
     FIGS. 4(A) to 4(D) show timing charts useful in explaining the operation of the circuit of FIG. 2; 
     FIG. 5 shows a relationship between amplitude values at address points of a cosine wave and an interpolated value, for explaining another embodiment of the present invention; 
     FIG. 6 shows a block circuit diagram of a device for computing interpolated values of a waveform, in another embodiment of the present invention; and 
     FIG. 7 shows a relationship between a cosine wave and address signals corresponding to phases of the cosine wave. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     The principle of an embodiment of the present invention will be described referring to FIG. 1. FIG. 1 illustrates a quarter of a sine wave in the phase range from 0 to π/2. Let us consider a case where the sine wave is specified at address points of 2 N  (N is a natural number). In this case, it is assumed that the amplitude values of sine waves of only 2 n  (N&gt;n) are stored in a memory (a sine ROM to be given later). 
     An amplitude value of a sine wave in an address (designated as Xo+ΔX) is the sum of an amplitude value of a sine wave at a sampling point (address Xo) of the memory and an interpolated value obtained at an address (ΔX) at a mid point between the sampling point and another sampling point (address Xo+1) adjacent to the former in the memory. 
     The phase (radian) of the address Xo+ΔX is: ##EQU1## The amplitude value of a sine wave at this address is: ##EQU2## If the following condition in equation (2) is met ##EQU3## hence, the equation (2) is rewritten into: ##EQU4## 
     Equation (6) shows that the amplitude value at the address Xo+ΔX is the sum of the amplitude value ##EQU5## of the sine wave at that time, and an interpolated value ##EQU6## As will be described later, ##EQU7## can be obtained by logically inverting the address signal input to the memory to obtain an output of ##EQU8## from a ROM. Accordingly, the operation of equation (6) can be realized by using an appropriate arithmetic/logic circuit. 
     Let us consider an error caused when a sine wave is interpolated using equation (6). As seen from equations (4) and (5), ΔX satisfies the following relation: ##EQU9## Then, the calculation errors are given by equations (8) and (9): ##EQU10## 
     Therefore, a relationship between the number of memory steps 2 n  of the sine wave ROM and the calculation errors of the equations (8) and (9) is as shown in Table 1. 
     
                       TABLE 1______________________________________ Number ofn     Memory Steps ε max (cos)                           ε max (sin)______________________________________5     2.sup.5 = 32 1.204 × 10.sup.-3                           1.971 × 10.sup.-56     2.sup.6 = 64 3.011 × 10.sup.-4                           2.464 × 10.sup.-67      2.sup.7 = 128              7.529 × 10.sup.-5                           3.080 × 10.sup.-7              13 bits              (= 0.0 . . . 010).sub.2______________________________________ 
    
     As seen from Table 1, as the number of memory steps is increased, the calculation errors become smaller. In the case of n=7, for example, if the amplitude value of the memory is represented by 13 bits or less, the errors are less than the quantitizing noise and are negligible from a practical viewpoint. 
     FIG. 2 shows a circuit arrangement of an embodiment of an interpolated value computing apparatus according to the present invention, which is constructed on the basis of the above-mentioned principle. In the figure, a sine wave ROM 1 stores sine wave data ranging from 0 to π/2 in the form of 2 7  (=128) points (i.e., n=7). The address input terminals N0-N6 of the sine wave ROM 1 are connected to an address signal, generated by an address signal generating circuit 20, through exclusive OR gates 2-0 to 2-6. The address signals ADu of the upper 7 bits or the inverted ones are connected to the exclusive OR gates 2-0 to 2-6 through exclusive OR gates 3-4 to 3-10, which are located at the preceeding stage of the exclusive OR gates 2-0 to 2-6. A signal MUL is applied to one of the input terminals of each of the exclusive OR gates 2-0 to 2-6. By the signal MUL, the exclusive OR gates 2-0 to 2-6 are controlled so as to invert the output signals of the exclusive OR gates 3-4 to 3-10. The output of these exclusive OR gates 3-4 to 3-10 is supplied to the exclusive OR gates 2-0 to 2-6. 
     Of the signals AD Mu  of the two bits of the upper address signal ADu, the lower one bit is connected to the exclusive OR gates 3-4 to 3-10, and further to exclusive OR gates 3-0 to 3-3 supplied with the lower address signal AD L . 
     The outputs of the exclusive OR gates 3-0 to 3-3 are respectively connected to input terminals A (A0 to A3) of a multiplier 4. The input terminals B (B0 to B8) of the multiplier 4 are coupled with the outputs of the sine wave ROM 1, respectively. 
     The multiplier 4 thus receives the data at the input terminals A and the input terminals B, and multiplies the data by 25/2 15 . In other words, the multiplier 4 performs the second term ##EQU11## in equation (6) with N=11. That is: ##EQU12## 
     The output signal from the sine wave ROM 1 is latched in a latch circuit 5 at the leading edge of the signal MUL. The contents of the latch circuit 5 are sin (π/2 12 )Xo, which is the first term in equation (6) when N=11. 
     The outputs of the latch circuit 5 and the multiplier 4 are applied to input terminals A (A0 to A8) and the input terminals B (B0 to B8) of the adder 6. The adder 6 adds those outputs together and applies the result of the addition to the input terminals A0 to A8 of an adder 8 through exclusive OR gates 7-0 to 7-8. The upper bit of the upper address signal AD Mu , i.e., the most significant bit of the address signal, is connected to one of the input terminals of each of the exclusive OR gates 7-0 to 7-8. The most significant bit is further connected to the input terminal A9 and the carry input terminal CIN of the adder 8. The exclusive OR gates 7-0 and 7-8 and the adder 8 cooperate to invert all of the bits of the amplitude value, and add 1 to the inverted ones, that is, the output signals of the adder 6 with a minus sign, and output such signals at the output terminals O (O0 to O9) to a latch circuit 9. 
     Applied to the latch circuit 9 is the signal MUL as inverted by an inverter 10. At the leading edge of the inverted signal MUL, the latch circuit 9 latches the input data and holds it until it latches another data. 
     As described above, the upper address signal ADu is used for addressing the sine wave ROM 1, while the lower address signal AD L  is for addressing and for making the interpolation. The most significant address signal AD Mu  designates, with its two bits, each of the phase ranges 0 to π/2, π/2 to π to 3π/2, and 3π/2 to 2π of a sine wave, as shown in FIG. 3. 
     When the most significant address signal AD Mu  is (0, 0), the exclusive OR gates 3-0 to 3-10 and 7-0 to 7-8 permit the signals applied thereto to pass through as they are. When the signal MUL is &#34;0&#34;, the sine wave ROM 1 produces the sine wave data at that time, as shown in FIG. 4. That is, it produces ##EQU13## with the upper address signal ADu of Xo. When the signal MUL changes its logical level to &#34;1&#34;, the latch circuit 5 latches that value. 
     Upon receipt of the signal MUL of &#34;1&#34;, the exclusive OR gates 2-0 to 2-6 are logically inverted, and the sine wave ROM 1 produces a signal of ##EQU14## Then, the multiplier 4 multiplies the lower address signal AD L  (i.e., ΔX) coming through the input terminals A (A0 to A3) by the cosine wave data, further multiplies the product by the constant 25/2 15 , and produces the product thus obtained, i.e., ##EQU15## The output of the latch circuit 5 and the output of the multiplier 4 are supplied to the adder 6. The output signal of the adder 6, ##EQU16## is applied to the latch circuit 9 while not logically inverted. As the signal MUL changes its logical state to &#34;0&#34;, the latch circuit 9 latches the output data from the adder 6. 
     The amplitude value thus obtained is: ##EQU17## 
     When the most significant address signal AD Mu  is (0, 1), viz., the phase of the sine wave ranges π/2 to π, the input signal is inverted by the exclusive OR gates 3-0 to 3-10. The sine wave ROM 1 is read out in the reverse direction to that when the most significant address signal ADMu is (0, 0). Accordingly, the data finally stored in the latch circuit 9 is the amplitude value in the phase range from π/2 to π. 
     When the most significant address signal AD Mu  is (1, 0), viz., the phase ranges from π to 3π/2, the exclusive OR gates 7-0 to 7-8 logically invert the output signal of the adder 8. A signal of &#34;1&#34; is applied to the most significant bit input and the carry input of the adder 8. The amplitude value stored in the latch circuit 9 is the inverted amplitude value for the 0 to π/2 phase range, i.e., a negative value. 
     When the most significant address signal AD Mu  is (1, 1), or when the most significant address signal AD Mu  is (1, 0), a &#34;1&#34; signal is applied to the exclusive OR gates 3-0 to 3-10. As a result, the address signals ADu and AD L  are logically inverted, and the sign of the amplitude value of the sine wave whose phase ranges from π/2 to π is inverted. Therefore, the amplitude value obtained takes a negative value. 
     While in the example sine wave data of 1/4 period is stored in the sine wave ROM 1, sine wave data with 1/2 period or one period may be stored into the sine wave ROM 1. In the latter case, if the upper address signal is properly modified, for example, it is phase-shifted by π/2, a cosine wave is obtained. Additionally, individual ROMs may be provided for reading out the sine and cosine waves, respectively. However, the least memory capacity of the ROM is required in the above-mentioned embodiment where a sine wave of 1/4 period is stored in the single ROM, and the ROM is used for both the sine and cosine wave readings. 
     A second embodiment of an interpolated value compensating apparatus according to the present invention will be described. In the second embodiment, a cosine wave of 1/4 period, i.e., with a phase range from 0 to π/2, as shown in FIG. 5, is stored in the memory. Also in this embodiment, the cosine wave is specified at address points of 2 N  (N is a natural number). The amplitude values of 2 n  (n is a natural number and N&gt;n) are stored in a memory (a cosine ROM to be described later). 
     The amplitude value at an address point (Xo+ΔX) is obtained on the basis of the amplitude value at a sampling point (address Xo) of the memory and an interpolated value obtained at the address ΔX. Also in this case, the sine wave and the cosine wave are read out from the cosine ROM for calculating an amplitude value, as will be described later. 
     The phase (radian) of the address Xo+ΔX is: ##EQU18## 
     The amplitude value at the phase is: ##EQU19## and the equation (12) is rewritten as: ##EQU20## 
     Equation (16) shows that the amplitude value at the address Xo+ΔX is obtained if the amplitude value ##EQU21## of the cosine wave and an interpolated value ##EQU22## are known. 
     FIG. 6 shows a circuit arrangement when N=11 and n=7. In the figure, like reference numerals are used for simplicity to designate like portions in FIG. 2. 
     A cosine wave ROM 11 stores a cosine wave data with a phase range from 0 to π/2. Exclusive OR gates 2-0 to 2-6 apply an address signal to the cosine wave ROM 11. A signal MUL is applied to those exclusive OR gates. The signal MUL is also supplied to exclusive OR gates 12-0 to 12-3 located prior to the input terminals A (Ao to A3) of the multiplier 4. The exclusive OR gates 12-0 to 12-3 are connected to the lower address signal AD L  through the exclusive OR gates 3-0 to 3-3. 
     In the present embodiment, the two bits of the most significant address signal AD Mu  are supplied to an exclusive OR gate 13, and then applied to the exclusive OR gates 7-0 to 7-8, and further, as the least significant bit and a carry input, to the adder 8. By the two bits of the most significant address signal AD Mu , one of the phases shown in FIG. 7 is specified. A combination (0, 0) of the two bits specifies 0 to π/2. (0, 1) specifies π/2 to π; (1, 0), π to 3π/2; (1, 1), 3π/2 to 2π. In the present embodiment, when the address signal AD Mu  is (0, 1), the address signals ADu and AD L  are logically inverted to read out the cosine wave. Then, its sign is inverted to have a negative amplitude value. At this time, a &#34;1&#34; signal is applied to the exclusive OR gates 3-0 to 3-10. The output signal from the exclusive OR gate 13 is &#34;1&#34;. 
     When the most significant address signal AD Mu  is (1, 0), the output signal of the exclusive OR gate 13 is set at &#34;1&#34; to obtain a negative amplitude value. When the most significant address signal AD Mu  is (1, 1), the address signals ADu and AD L  are inverted to read out a cosine wave. 
     In the present embodiment, during the phase range 0 to π/2, a signal of ##EQU23## is stored in the latch circuit 5 at the leading edge of the signal MUL. The output signal from the multiplier 4, when the signal MUL is &#34;1&#34; in level, is: ##EQU24## where ΔX is an inversion of the level of the lower address signal AD L  (ΔX), as shown in FIG. 5, and then is given as, ##EQU25## In the above example, the lower address signal AD L  is inverted and applied to the multiplier 4. However, the lower address signal AD L  may be directly applied to the multiplier 4, and in the adder 6, the subtraction may be carried out on the interpolated value input to the input terminal B. 
     Accordingly, in this embodiment, by operating the following equation: ##EQU26## an amplitude value as given below is obtained, ##EQU27## 
     Also in the present embodiment, the cosine data of 1/4 period is stored in the cosine ROM 11. It is evident that the cosine data of 1/2 period or one period may be stored in the memory. Different memories may also be provided for reading out the cosine wave data and the sine wave data. However, the arrangement of the above mentioned embodiment requires the least amount of memory capacity of the ROM. 
     In the above-embodiment, an amplitude value is obtained at a specific address point in the sine or cosine wave. The interpolated value computing apparatus of the present invention is also applicable for an electronic musical instrument of the so called sine wave synthesizing type. In this type of musical instrument, a pitch frequency or the waveform data of higher harmonics are read out by successively changing the address, the data read out are mixed at a proportional rate, and finally an amplitude value is obtained. Furthermore, the present invention is applicable for various types of sound source systems based on a sine wave or a new waveform generating system as proposed by the assignee of the present patent application and disclosed in Kokai No. 59-111515. 
     Additionally, the present invention is applicable to electronic devices for generating various types of sound effects or rhythm sounds, or electronic devices for producing waveform signals for special purposes.