Abstract:
A key code generator for electronic musical instruments which has a group of memories respectively corresponding to blocks of key switches and temporarily storing their closed state, a block detector for detecting the memories corresponding to the blocks that even one key switch is in its closed state, a priority selector for sequentially designating the detected blocks in the order of priority, a block designating gate means for supplying clock pulses to the memories corresponding to the designated blocks to serially derive therefrom their information in accordance with the output from the priority selector, an encoder for encoding the output from the priority selector into a binary code, a counter for counting the clock pulses outputted from the block designating gate means, means for gating the count value of the counter and the binary code designating each block with the serial output read out of each memory, means for detecting a change in the binary code, and means for resetting the counter with the output from the detecting means, and in which the binary code gated with the serial output from the memory and outputted is used as key code information.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     This invention relates to a key code generator for electronic musical instruments. 
     2. Description of the Prior Art 
     Conventional key code generators have usually employed, as a method for detecting closed key switches, the key code multiplex method that information of the closed state of the key switches is rendered by time-division scanning of the respective key switches into a TDM (Time-Division Modulation) signal or a PCM (Pulse Code Modulation) signal synchronized therewith. With the key code multiplex method, however, one scanning period is needed for obtaining information necessary for time-division scanning of the respective key switches for detecting the open and closed states of the key switches. In the case of an ordinary electronic organ, if the key switches are divided into blocks and if the player uses each of his arms for two blocks and his feet for one block, five blocks are needed at most. For example, if the key switches are divided into groups every octave, they are divided into seventeen blocks including 61 upper keys, 61 lower keys and 25 foot keys. It is apparent that at least twelve blocks do not take part in playing. Therefore, it is sufficient to scan only five blocks. Further, sending of time-division clock pulses to the key switches is subject to a restriction by the characteristics of the switches, that is, their chattering and time constants, with the result that an erroneous operation is liable to occur due to a waveform distortion and that the limit of high-speed operation by the circuit integration is suppressed low. Moreover, in the case of flowing a high-frequency clock pulse between the switch and the circuit, it may become a noise source with respect to other circuits. 
     SUMMARY OF THE INVENTION 
     This invention has for its object to provide a key code generator for electronic musical instruments which overcomes the abovesaid defects of the prior art and which is designed to apply time-division clock pulses to key switches to provide a time slot only for a changed one of the key switches without scanning, and which is adapted for a high-speed operation resulting from integration by speeding up a response to closing of the changed key switch. 
     According to this invention, there is provided a key code generator which comprises a group of memories respectively corresponding to blocks of key switches and temporarily storing their closed state, a block detector for detecting the memories corresponding to the blocks that even one key switch is in its closed state, a priority selector for sequentially designating the detected blocks in the order of priority, a block designating gate means for supplying clock pulses to the memories corresponding to the designated blocks to serially derive therefrom their information in accordance with the output from the priority selector, an encoder for encoding the output from the priority selector into a binary code, a counter for counting the clock pulses outputted from the block designating gate means, means for gating the count value of the counter and the binary code designating each block with the serial output read out of each memory, and means for resetting the counter with the output from the detecting means, and in which the binary code gated with the serial output from the memory and outputted is used as key code information. 
     Other objects, features and advantages of this invention will become more fully apparent from the following description taken in conjunction with the accompanying drawings. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram illustrating an embodiment of this invention; 
     FIGS. 2 and 3 show in detail the principal parts of the embodiment depicted in FIG. 1; and 
     FIGS. 4A-4K show logic-time charts indicating the operation of the embodiment illustrated in FIGS. 2 and 3. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     With reference to the drawings, the present invention will hereinafter be described with regard to its embodiments. 
     FIG. 1 illustrates in block form an embodiment of this invention. In FIG. 1, a key switch 2 is divided into blocks, which are respectively connected to parallel input terminals of a group of shift registers provided corresponding to the blocks. These shift registers are capable of parallel inputting and outputting and serial outputting. The output from the key switch 2 is read in the shift registers 3 by output clock pulses 4 from a master oscillator 1. Then, this parallel output is applied to a block detector circuit 4 to detect those of the blocks in which even one key switch is closed, and then the detecting outputs are applied to a priority circuit 5. The priority circuit 5 outputs the block which has been designated earlier than any other blocks. Further, when even one block has been detected to be &#34;1&#34;, the operation of parallel reading of the abovesaid key switch outputs is inhibited. The output of the block selected with first priority is applied to a block designating gate 6, through which the clock pulses φ are supplied to the designated one of the blocks of the shift registers 3, performing serial reading of the block. At the same time, the clock pulses φ are applied to a counter 8 to start counting of them. The count value is supplied to a gate circuit 9, and becomes a key code IKC in the block. On the other hand, the output from the priority circuit 5 is applied to an encoder 7 to derive therefrom a block code BKC, which is supplied to the gate circuit 9. The serial output from the shift register group 3 is applied to the gate circuit 9 to open and close it. That is, the serial output and the counter output are synchronized with each other and the data derived from the gate circuit 9 is a key code data KCD. Then, serial reading of the block of first priority takes place and when the content of the block becomes &#34;0&#34; and when the block detector circuit 4 detects &#34;0&#34;, the priority circuit 5 outputs the block of second priority and the clock pulses φ are applied to the next block of the shift register group 3 through the block designating gate circuit 6. At this time, a change detector circuit 10 detects the change of the block, and resets the counter 8 to retain the synchronizing relationship between the serial output from the shift register and the count value of the counter 8. Thus, the same operation is repeatedly achieved and, upon completion of outputting of required blocks, the shift register group is shifted from the serial reading to the parallel reading operation. 
     Thus, one frame is related to the number of blocks in which the key switches are closed and the positions of the closed key switches in the blocks, and is not always constant but largely dependent upon the number of blocks. 
     FIG. 2 is a detailed diagram explanatory of the key switch 2, the shift register 3, the block detector 4, the priority circuit 5 and the block detecting gate 6, in the embodiment shown in FIG. 1. In FIG. 2, shift register groups SR 1  to SR n  are respectively connected to key switch groups SW 1-1  to SW 1-m , SW 2-1  to SW 2-m , . . . SW n-1  to SW n-m , each consisting of m key switches, so that the key switches are divided into n blocks. In this case, the number of lines connected to the individual blocks is selected to be m in common to them, but need not always be the same. The number of lines connected in parallel to one shift register, that is, the number of bits of the shift register is defined by the count value of the counter 8. In the present embodiment, the number of bits of each of the shift registers is selected to be m. The output from an inverter I 1  is given as a P.S (parallel.serial) signal which controls parallel read-in and serial read-out of the shift registers SR 1  to SR n . Now, let it be assumed that the P.S signal is &#34;1&#34; to designate parallel read-in operation of the shift register group 3, that the clock pulses φ are applied to the shift registers SR 1  to SR n  through OR circuits OR 6-1  to OR 6-n  and that the key switches SW 2-1 , SW 2-4  and SW 3-2  are closed. The information of these closed key switches is written by the clock pulses φ in the shift registers SR 2  and SR 3 . The information written in the abovesaid shift registers is applied to OR circuits OR 4-1  to OR 4-n  respectively connected to the individual blocks corresponding to the parallel outputs from the shift register group 3, so that the OR circuits OR 4-2  and OR 4-3  derive therefrom outputs &#34;1&#34;, respectively. Then, these outputs are respectively supplied to D type flip-flops DF 1  to DF n , each corresponding to one of the blocks. The outputs from the OR circuits OR 4-2  and OR 4-3  are written by clock pulses φ in the D type flipflops DF 2  and DF 3 . The outputs from the D type flip-flops DF 1   to DF n  are applied to the priority circuit composed of OR circuits and AND circuits, thereby selecting one block which is designated with first priority. Now, since the D type flip-flops DF 2  and DF 3  are both providing the outputs &#34;1&#34;, the output &#34;1&#34; from the D type flip-flop DF 2  is applied to an OR circuit OR 5-2 , causing the OR circuits OR 5-3  to OR 5-n  to produce outputs &#34;1&#34;. As a result of this, AND circuits A 5-3  to A 5-n  are each supplied with an inverted input &#34;0&#34; and inhibited thereby from outputting. On the other hand, an AND circuit A 5-2  is supplied with an inverted input &#34;1&#34; to provide an output &#34;1&#34;. The outputs from the D type flip-flop DF 1  and the AND circuits A 5-2  to A 5-n  are applied as block data BD to the encoder 7 shown in detail in FIG. 3. Then, a P.S. signal derived from the OR circuit OR 5-n  is inverted by the inverter I 1  to provide the P.S signal &#34;0&#34;, by which the shift register group 3 is designated to be serially read out. Further, the output BD 2  from the AND circuit A 5-2  is applied to the AND circuits A 6-2  and A 3-2  and the clock pulses φ are supplied to the shift register SR 2  to be serially read out. Moreover, serial information is applied from the AND circuit A 3-2  to an OR circuit OR 30 , whose output is applied as key data KD to the D type flip-flop DF 2  shown in FIG. 3. The information in the shift register SR 2  is sequentially shifted and, at the same time, the OR circuit OR 4-2  is also supplied with a parallel output and detects &#34;0&#34; when the last data is shifted. This state is written by the next clock pulse φ in the D type flip-flops DF 1  to DF n . In this case, the D type flip-flop DF 2  derives therefrom an output &#34;0&#34; and the output from the D type flip-flop DF 3  based on the next priority level is derived from an AND ciruit A 5-3  to apply &#34;1&#34; to AND circuits A 6-3  and A 3-3 , thus sequentially shifting the information of the shift register SR 3 . When shifting of the information of all the blocks has thus been completed, the OR circuits OR 4-1  to OR 4-n  of the block detector circuit 4 all produce &#34;0&#34; and all the D type flip-flops DF 1  to DF n  also produce &#34;0&#34;. As a result of this, the P.S signal derived from the inverter I 1  becomes &#34;1&#34;, performing the parallel read-in operation again. The operations described above cover one frame and, by the clock pulse φ, the same operations are repeated. 
     FIG. 3 is a detailed diagram explanatory of the operations associated with the encoder 7, the counter 8, the gate circuit 9 and the change detector circuit 10 employed in the FIG. 1 embodiment. In FIG. 3, the block information BD derived from the priority circuit 5 is applied to the encoder 7 and rendered into a binary code as a block code BKC. This output is applied to a latch circuit 11, and always latched by the clock pulse φ. The block code BKC is applied to the gate circuit 9. Further, in an AND circuit A 50 , the clock pulse φ is gated with the P.S signal, and applied to the m-scale counter 8. The output from the counter 8 is latched by the clock pulse φ in a latch circuit 12, and supplied as an intra-block key code IKC to the gate circuit 9. Further, the key data signal KD is applied to a D terminal of the D type flip-flop DF 2 , and temporarily latched by the clock pulse φ. The output from the D type flip-flop DF 2  is supplied to the gate circuit 9 to control its opening and closing. The latch circuits 11 and 12 and the D type flip-flop DF 2  are to provide timing and perform waveform shaping. Next, the change detector circuit 10 for detecting a change in the block data BD detects non-coincidence between the input and output codes of the latch circuit 11 to reset the counter 8, by which when the block has changed, counting is caused to start with &#34;0&#34;. The signals of the key data KD and the block data BD shown in FIG. 2 are both rendered into binary codes in synchronism with each other, and derived as key code data KCD from the gate circuit 9. 
     FIG. 4 shows a series of waveform diagrams, illustrating timings of the respective signals in FIGS. 2 and 3. In FIG. 4, a block detecting waveform of FIG. 4B is shown as the outputs from the OR circuits OR 4-1  to OR 4-n  respectively connected to the individual blocks of the shift registers SR 1  to SR n  shown in FIG. 2, relative to the clock pulses φ of FIG. 4 A. The P.S signal of FIG. 4C is shown as the output from the inverter I 1  for controlling the parallel read-in and serial read-out of the shift registers SR 1  to SR n . The block data BD of FIG. 4D show, as the output waveform of the priority circuit 5, the outputs from the D type flip-flop DF 1  and the AND circuits A 5-2  A 5-n  that the waveform of FIG. 4B is latched with the clock pulse φ. For example, the block data BD 2  and BD 3  and are shown as the priority levels. FIG. 4E shows the key data KD of each block, and shows the outputs from the switches, for instance, SW 2-1 , SW 2-4  and SW 3-2 , as the output from the OR circuit OR 30 . The counter output of FIG. 4F is derived from the counter when the clock pulse φ is gated by the P.S signal of FIG. 4C in the AND circuit A 50  and then applied to the counter, as shown in FIG. 3. When the counter output is latched by the clock pulse φ, the waveform of the intrablock key code IKC shown in FIG. 4G is obtained. The block code BKC of FIG. 4H is obtained by coding the block data of FIG. 4D into a binary code and then latching it with the clock pulse φ. Further, the output from the D type flip-flop DF 2 , shown in FIG. 4I, is obtained by latching the key data KD of FIG. 4E with the clock pulse φ. By applying the intra-block key code IKC of FIG. 4G and the block code BKC of FIG. 4H to gate 9 and by controlling it with the output from the D type flip-flop DF 2 , there is obtained the key code data KCD of FIG. 4J. The reset signal of FIG. 4K shows one frame period. As is seen from the above description, even if the block data BD and the counter output are gated by the key data KD, the key code data are obtained, but since the block data BD and the counter output have different pulse widths, they are once applied to the latch circuits, respectively, to obtain the block code BKC and the intra-block key code IKC, which are gated by the output from the D type flip-flop DF 2  to obtain the same pulse width. Further, the key code to be outputted may be made to be a different binary code by freely determining the value of the counter. 
     As has been described in the foregoing, according to this invention, a waveform distortion resulting from scanning of the key switch and an erroneous operation can be prevented by temporarily storing the closed state of the key switch, and the time for sending information of unnecessary block can be eliminated by outputting key information every plural blocks. Further, also in the case of that block, as soon as the final data is outputted therefrom, the operation is shifted to the next block, by which a required time slot can be remarkedly reduced and, moreover, the time for the generation of the key code corresponding to closing of the key switch can be greatly shortened so as to adapt for high-speed operation resulting from integration. Thus, a highly responsive key code generator circuit can be realized. 
     It will be apparent that many modifications and variations may be effected without departing from the scope of novel concepts of this invention.