Method and device for musical tone generation
Abstract
[Task] Operate the software sound source stably.
Solution.A MIDI processing routine S10 that converts input MIDI events into sound source control data when a musical tone sample is calculated and generated by software, and a waveform generation processing routine (S20) that calculates and generates one frame of musical sound sample. Is provided in the virtual device driver routine in the OS. Then, the MIDI processing routine is started by the software interrupt that occurs when a MIDI event occurs from an application such as sequencer software, and the hardware interrupt that occurs when the playback of one frame of musical sound is completed causes the above. Start the waveform generation processing routine.

Term
Term ended
Projected expiry passed 21 December 2015, 10.8 years ago.
- Priority and filed
- Published
- Projected expiry
- Today
4 claims: 1 independent, 3 dependent
- 1【特許請求の範囲】 【請求項1】 所定のオペレーティングシステムが動作する演算処理装置において実行される楽音生成方法であって、次の(1)~(3)のステップを含む楽音生成方法。 (1)アプリケーションプログラムから演奏情報が出力されたときに発生される第1の割込に応じて起動され、当該演奏情報に対応した発音制御情報を生成する第1のステップ、 (2)バッファに記憶されている波形サンプル数の減少を検出したときに発生される第2の割込により起動され、前記発音制御情報に基づいて複数の波形サンプルを一括生成し、該生成された波形サンプルをバッファに記憶する第2のステップ、 (3)前記バッファに記憶された波形サンプルを各サンプリング周期毎に1サンプルずつ読み出してデジタルアナログ変換器に順次出力する第3のステップ、 【請求項2】 前記第1のステップおよび前記第2のステップは、前記所定のオペレーティングシステムにおける仮想デバイスドライバとされていることを特徴とする前記請求項1記載の楽音生成方法。
- 3【請求項3】 前記第2の割込は、前記デジタルアナログ変換器に送出された波形サンプル数が所定数に達したことを検出したときに発生されるようになされていることを特徴とする前記請求項1記載の楽音生成方法。
- 4【請求項4】 演算処理装置と、 所定のオペレーティングシステムおよびアプリケーションプログラムが格納される記憶手段と、 演算生成された波形サンプルが記憶されるバッファメモリと、 前記バッファメモリから前記波形サンプルを各サンプリング周期毎に1サンプルずつ読み出して順次出力する出力手段と、 前記アプリケーションプログラムから演奏情報が出力されたときに第1の割込を発生する第1の割込発生手段と、 前記バッファメモリに格納されている波形データが減少したことを検出したときに第2の割込を発生する第2の割込発生手段と、 前記第1の割込の発生に応じて動作し、前記アプリケーションプログラムから出力された演奏情報に対応する発音制御情報を生成する発音制御情報発生手段と、 前記第2の割込の発生に応じて動作し、前記発音制御情報に基づいて複数の波形サンプルを一括生成して、該生成された複数の波形サンプルを前記バッファメモリに記憶する楽音波形生成手段とを有することを特徴とする楽音生成装置。
- 5【請求項5】 前記発音制御情報発生手段と前記楽音波形生成手段は、前記所定のオペレーティングシステムにおける仮想デバイスドライバに含まれているであることを特徴とする前記請求項4記載の楽音生成装置。
Independent claims4
155 paragraphs in 1 section, as filed
Description: TECHNICAL FIELD [Detailed description of the invention]
【0001】
[Technical field to which the invention belongs]
The present invention relates to a musical tone generation method for calculating and generating a musical tone form by executing a musical tone generation program on an arithmetic processing unit, and a musical sound generation device using the musical tone generation method.
【0002】
[Conventional technology]
A conventional musical tone generator usually has a performance input unit for inputting performance information from a MIDI (Musical Instrument Digital Interface), a keyboard or a sequencer, a sound source unit for generating a musical sound form, and the sound source according to the input performance information. It consisted of a central processing unit (CPU) that controls the unit. Here, the CPU executes sound source driver processing such as channel assignment and parameter conversion according to the input performance information, and supplies the converted parameters and sounding start instruction (note-on) to the channel assigned by the sound source unit. .. Further, the sound source unit generates a musical tone type based on the supplied parameters, and hardware such as an electronic circuit has been adopted as the sound source unit. For this reason, the musical tone generator becomes a dedicated device for generating a musical tone, and it is necessary to prepare a dedicated musical tone generator when generating a musical tone.
【0003】
Therefore, in order to solve this, recently, a music sound generation method has been adopted in which the operation of the hardware sound source is replaced with a sound source processing (software sound source) by a computer program, and the performance processing and the sound source processing are executed by the CPU. Proposed. Here, the performance process is a process corresponding to the above-mentioned sound source driver process, and is a process of creating control information for controlling the generated musical tone based on the input performance information such as MIDI. Further, the sound source processing is a processing for generating a waveform sample data of a musical tone based on the control information created in the performance processing. According to this musical tone generation method, it is possible to generate musical tones without using a dedicated musical tone generator, simply by providing a chip for digital-to-analog conversion (DA conversion) in addition to the CPU and software. ..
【0004】
In order to generate a musical tone, it is necessary to supply a waveform sample to the DAC at each sampling period, that is, at each conversion timing in the digital-to-analog converter (DAC). Therefore, in the above-mentioned musical tone generation method, the CPU normally executes performance processing such as key press detection, interrupts sound source processing for each sampling cycle for the performance processing, and executes musical sound of a plurality of channels. After the waveform data for one sample of the above was calculated and generated, the operation of returning to the performance process was performed.
【0005】
[Problems to be Solved by the Invention]
However, in the above-mentioned conventional musical tone generation method, when the CPU performs the waveform generation calculation processing of each sounding channel for each sampling cycle, first, various data used in the previous calculation of the sounding channel are stored in the memory. It is necessary to restore the register and save the contents of the register in the memory for the next processing after the waveform generation calculation is completed. That is, since the musical sound type samples of each sounding channel are calculated and generated one by one, a lot of calculation time such as preparatory processing other than the generation of the musical sound is consumed, the calculation efficiency deteriorates, and the response and the musical sound generation processing are performed. There was a problem that it became slow. A lot of processing time was required for processing other than the original waveform generation operation.
【0006】
In addition, application programs such as MIDI sequencers and game software that supply performance information such as MIDI events to such software sound sources are designed to operate under a general OS (Operating System) . For example, when trying to drive the above-mentioned software sound source with a MIDI event created by the sequence software, the sequence software itself cannot be executed without first operating the OS. Then, it is necessary to operate the software sound source stably at the same time as the OS. Therefore, it is difficult to stably operate the software sound source as described above under a general OS in real time.
【0007】
For example, under the control of a non-complete multitasking method (non-preemptive multitasking method) OS, other tasks are not executed unless the running task returns control to the OS, so the software sound source is set every predetermined time. It may not be executed in the above, and it may not be possible to stably output the music type sample to the DAC every one sampling cycle.
【0008】
Further, the performance information (MIDI event) is generated by the performance operation of the performer or the reproduction of the event by the sequencer, and when the performance information is generated, it is processed by the performance process. That is, when the performance information is generated, the CPU must execute the performance processing in addition to the normal sound source processing, so that the amount of calculation is temporarily increased by the performance information generated irregularly. However, the conventional musical tone generation method does not correspond to this, and the sound source processing is periodically preferentially executed regardless of the presence or absence of performance information, and the performance processing may be delayed in some cases. In order to prevent such a delay in the performance processing, it is conceivable to raise the priority of the performance processing, but in this way, the number of pronunciations temporarily decreases, or the musical sound is played. There will be a problem that the sound source processing operation becomes unstable, such as the waveform being interrupted. This is especially problematic when performing real-time performances.
【0009】
Furthermore, in the conventional software sound source, it is necessary to make a setting to use the software sound source when using the software sound source, and the software using the conventional hardware sound source should be used as it is. Therefore, it was not possible to drive the software sound source.
【0010】
Therefore, an object of the present invention is to provide a musical sound generation method and an apparatus capable of efficiently and stably executing a waveform generation calculation. Further, the purpose is to perform stable sound source processing even when the processing amount increases. Furthermore, it is an object of the present invention to provide a software sound source capable of using software that uses a conventional hardware sound source as it is.
【0011】
[Means for solving problems]
In order to achieve the above object, the waveform generation method of the present invention is a waveform generation method executed in an arithmetic processing device operating a predetermined operating system, and (1) when performance information is output from an application program. When the decrease in the number of waveform samples stored in the buffer is detected, the first step of generating the sound control information corresponding to the performance information, which is activated in response to the first interrupt generated in The second step, which is activated by the second interrupt generated in, generates a plurality of waveform samples at once based on the sound control information, and stores the generated waveform samples in a buffer, and (3). This is a music sound generation method including a third step of reading out one sample of the waveform sample stored in the buffer for each sampling cycle and sequentially outputting it to a digital-analog converter.
【0012】
Further, the first step and the second step are musical tone generation methods that are used as virtual device drivers in the predetermined operating system. Furthermore, the second interrupt is a musical sound generation method that is generated when it is detected that the number of waveform samples sent to the digital-to-analog converter has reached a predetermined number.
【0013】
Furthermore, the music sound generator of the present invention includes an arithmetic processing apparatus, a storage means for storing a predetermined operating system and an application program, a buffer memory for storing an arithmetically generated waveform sample, and the buffer memory. An output means for reading out one sample of a waveform sample for each sampling cycle and sequentially outputting the waveform sample, a first interrupt generation means for generating a first interruption when performance information is output from the application program, and the above-mentioned The second interrupt generating means that generates a second interrupt when it is detected that the waveform data stored in the buffer memory has decreased, and the second interrupt generating means that operates in response to the occurrence of the first interrupt, are described above. A sound control information generating means that generates sound control information corresponding to the performance information output from the application program, and a plurality of waveform samples that operate in response to the occurrence of the second interruption and generate a plurality of waveform samples based on the sound control information. It is a music sound generation device having a music sound generation means for batch generation and storing the generated plurality of waveform samples in the buffer memory. Furthermore, the sound control information generating means and the musical sound type generating means are musical sound generating devices included in the virtual device driver in the predetermined operating system.
【0014】
BEST MODE FOR CARRYING OUT THE INVENTION
FIG. 1 shows the configuration of a musical tone generator in which the musical tone generation method of the present invention is executed. In this figure, 1 is a central processing unit (CPU) such as a microprocessor that performs various arithmetic processing such as application programs and generation of random sound samples, and 2 is a read-only memory (ROM) that stores preset tone data and the like. 3 is a random access memory (RAM) having a storage area such as a work memory area, a tone data area, a channel register area, and an output buffer area of the CPU 1, and 4 indicates the time and the timing of timer interrupt processing to the CPU 1. Timer, 5 is a MIDI interface that outputs MIDI events generated when MIDI events are input, and 6 is a so-called computer keyboard equipped with keys such as letters, kana, numbers, and symbols.
【0015】
7 is a display (monitor) device for the user to interact with the music generator, and 8 is used to store various application programs such as sequencer software and game software that generate music, and to generate a waveform sample. The hard disk (HDD), 10 in which the waveform data to be stored is stored, collects the ultrasonic sample data stored in the area (DMA buffer) specified by a part of the CPU of RAM3 in a fixed sampling period (for example,). It is a direct memory access controller (DMAC) for supplying data directly to the digital analog converter (DAC) in the sound input / output circuit (CODEC) 11 every 48kHz) without going through the CPU1.
【0016】
Reference numeral 11 denotes a sound input / output circuit called a CODEC, which contains a digital-to-analog converter (DAC), an analog-to-digital converter (ADC), a first-in first-out buffer (FIFO) for input connected to the ADC, and the above. An output FIFO connected to the DAC is provided. The sound input / output circuit (CODEC) 11 transmits the audio input signal from the external audio signal input terminal 13 A / D converted by the ADC according to the sampling clock of the frequency Fs input from the sampling clock generator 12. The waveform sample data taken into the input FIFO and written from the DMAC 10 to the output FIFO is read out according to the sampling clock and output to the DAC one sample at a time. Then, when data exists in the input FIFO and when the output FIFO is empty, it operates to output a signal requesting data processing to the DMAC 10.
【0017】
Reference numeral 12 denotes a sampling clock generation circuit that generates a sampling clock having a frequency of Fs in the sound input / output circuit 11, and reference numeral 13 denotes an external audio signal input circuit, the output of which is connected to the ADC in the sound input / output circuit 11. Further, reference numeral 14 denotes a sound system connected to the output from the DAC in the sound input / output circuit 11, and emits a music signal converted into an analog signal output from the DAC every one sampling cycle. Further, 15 is a floppy disk device for driving a floppy disk, and 16 is a bus for transferring data between the components. An external storage device other than the above, such as a CD-ROM drive device or an MO drive device, may be connected. The above configuration is equivalent to that of a personal computer, workstation, etc., and the musical sound generation method of the present invention can be implemented on them.
【0018】
FIG. 2 shows the software module configuration in the musical tone generator shown in FIG. In this figure, it is assumed that Windows 95 (Windows is a registered trademark of Microsoft Corporation in the United States) is used as the operating system. According to this operating system, each application program runs under the virtual machine (VM: Virtual Machine environment) corresponding to the OS. This Windows virtual machine (hereinafter referred to as Windows VM) is in the context of executing the application. The VM context contains a memory map that the application can address, the contents of hardware registers, and the Windows resources allocated to the application. This Windows VM includes the MS-D0S VM. There are two types, system VM.
【0019】
In this figure, 20 is the system VM described above, 30 is the MS-DOS VM, and these are the components of Ring3. As shown, application programs 21, 23 and 24 are arranged on the system VM20. Here, 21 is an application program (Win32 application) for Windows 95 that operates in 32-bit code. For example, in this example, the spreadsheet program 23 is installed. Further, a sequencer program 23 and a word processor software 24, which are application programs for Windows, are arranged on the address space 22. In addition, a system service component 25 for Windows is located on the system VM20, which includes various driver software 26 and hard I / O registers 27.
【0020】
In addition, application programs for MS-DOS such as game program 31 for MS-DOS are installed in MS-DOS VM30, and driver software 32 and hardware I for MS-DOS are installed. An MS-DOS environment such as / O33 is prepared. It is assumed that this game program 31 is designed to generate musical sounds such as sound effects via MIDI.
【0021】
In addition, as shown in the figure, the basic system part 40 of Windows 95 including the file management system is arranged in Ring0, and the kernel part 41 of the OS, the virtual device driver (VxD) part 42, and the management software are arranged in it. 47 is included. The virtual device driver unit 42 includes a plurality of virtual device driver (VxD) routines such as n support routines 1 to n indicated by 43 to 45 and software sound source support routine 46. These VxD routines are 32-bit protected mode program modules that provide various services corresponding to various software interrupts and hardware interrupts, and operate at the privilege level Ring 0 of the processor. Further, the kernel unit 41 operates the corresponding virtual device driver routine in response to various software interrupts from each virtual machine VM and various hardware interrupts from the hardware.
【0022】
Reference numeral 50 denotes various hardware such as the sound input / output unit (CODEC) 11 and MIDI interface 5 described above, and interrupts from these hardware are accepted by the kernel unit 41 and the corresponding support routines 43 to 45 are received. Alternatively, the process is executed by VxD such as the software sound source support routine 46.
【0023】
A virtual device driver (VxD) is usually provided to share the hardware resources of a personal computer with multiple virtual machines (VMs), and any (one or more) VMs. Manage whether to use the hardware resource. To do this, VxD is inserted between each VM and the actual hardware, detecting that the device driver in the VM is accessing the address of the hardware under its control, and mediating access to the hardware. If there is output from the hardware, it will be transmitted to the device driver of the corresponding VM.
【0024】
As described above, in the present invention, the software sound source support routine 46 is arranged in the virtual device driver unit 42, and the software sound source support routine 46 includes a MIDI processing routine and a waveform generation processing routine described later. ing. The VxD routine (software sound source support routine) 46 in the present invention is designed to perform simulation processing of sound source hardware that does not actually exist, instead of the above-mentioned mediation processing. By doing so, it is possible to make it indistinguishable from the viewpoint of the VM whether or not the personal computer is actually equipped with a hardware sound source. That is, in each VM, the software sound source can be used in exactly the same state as when operating the hardware sound source, including the device driver.
【0025】
FIG. 3 is a diagram for explaining processing in a software sound source using the musical tone generation method of the present invention. When this software sound source is started, first, in step S1, various buffer areas on RAM3 are secured, and the software sound source support routine 46 including the MIDI processing routine and the waveform generation processing routine is loaded into the virtual device driver section 42. Various initial setting processes such as MIDI transfer processing settings and hardware interrupt settings from CODEC11 are performed, and a display screen for this software sound source is prepared in step S2. Next, the process proceeds to step S3, and it is checked whether or not any activation factor has occurred. In step S4, the presence or absence of the activation factor is determined. If not, the process returns to step S3 and waits for the occurrence of the activation factor.
【0026】
When an activation factor occurs, it is determined in step S5 what the activation factor is, and the corresponding processing is executed according to the activation factor. Various activation factors include (1) the occurrence of MIDI events from sequencer software, (2) the completion of playback of waveform samples for one frame (output to DAC), and (3) panel input and command input. There is a request and (4) an end request by inputting an end command.
【0027】
As will be described later, the occurrence of a MIDI event from the sequencer software in (1) above is generated as a software interrupt, and the completion of playback for one frame in (2) above is generated by the sound input / output circuit 11 or DMAC 10. Notified as a hardware interrupt. On the other hand, the various requests in (3) and the end command input in (4) are input by user operations from the keyboard 6, the operation panel, the window screen of the display 7, etc., and are the system services for Windows described above. It receives the services of the programs in component 25. Therefore, each process corresponding to the above (1) and (2), which is started in response to a deeper level interrupt, is executed in preference to each process corresponding to the above (3) and (4). Will be done.
【0028】
As a result of the determination in step S5, (1) when a MIDI event occurs, the MIDI processing (MIDI Interpreter processing) of S10 is executed. This MIDI process is executed as a virtual device driver, and in this process, note-on, note-off, and program change are performed in response to MIDI events generated by application programs that generate music such as sequencer software and game software. , Control change, system exclusive, etc. are performed.
【0029】
For example, when the MIDI event is a note-on event, a new sound is assigned to the sound channel of the waveform generation process as a sound source, and musical tone control data and note-on for setting to the assigned channel are prepared. That is, the note number NN and velocity VEL are taken in, and the sounding channel (ch) of the note number NN is assigned. In the channel register corresponding to the assigned pronunciation channel, the pronunciation data obtained by processing the tone color data corresponding to the MIDI channel that received the note-on event according to the value of the note number NN and velocity VEL is set. Will be done.
【0030】
If the input MIDI event is a note-off event, the sound channel (ch) pronounced by the note number NN of that note-off event is searched, and the note-on flag of the corresponding sound channel is reset. To. After the MIDI processing (S10) is executed as described above, the process proceeds to step S11, the display processing indicating that the MIDI event has been received by the display device 7 is executed, the process returns to step S3 again, and the next activation factor is Wait for the outbreak.
【0031】
When the activation factor is (2) the reproduction of the waveform sample for one frame is completed, the waveform generation process of S20 is executed. This waveform generation process is also executed as a virtual device driver in the same manner as the MIDI process. This process simulates the function of the hardware sound source, and based on the sound control information generated in the MIDI process, the musical sound waveform samples for one frame period are collectively generated by calculation and stored in the output buffer.
【0032】
When this waveform generation process (S20) is activated, first, the calculation preparation of the first musical tone sample of the first sounding channel (ch) in the calculation order is performed. The calculation preparation process is to prepare access to data such as the previous read address, various EG values, various EG states (states such as attack and release), and LFO (Low Frequency Oscillator) values so that they can be used immediately for calculation. It is a process of loading into the internal register of CPU1. Next, the waveforms of the LFO, filter EG (FEG), and volume EG (AEG) are calculated, and samples of the LFO waveform, FEG waveform, and AEG waveform required for the calculation for one frame time are generated. The LFO waveform is added to the F number, FEG waveform, and AEG waveform and used to modulate each data.
【0033】
Next, the F number is repeatedly added with the previous read address as the initial value to generate the read address of each waveform sample within one frame time. A waveform sample is read from the waveform storage area in the tone color data based on the integer part of this read address, and interpolation is performed between the read waveform samples based on the decimal part of this read address, and the entire waveform within one frame time is entered. Calculate the interpolation sample. If one frame time corresponds to, for example, 64 samples, 64 samples are processed together. Here, in the processing for a plurality of samples corresponding to the one frame time, the processing from the reading based on the reading address to the interpolation processing is regarded as a unit processing, and this unit processing is repeated. Therefore, the reading address. It only needs to be read once to the CPU register as a whole, and the processing speed is increased.
【0034】
Subsequently, a timbre filter process is performed on the interpolated sample for the one frame time to control the timbre based on the FEG waveform, and then the amplitude control based on the AEG and the volume data is performed on each filtered sample. The processing is performed, and further, the cumulative writing processing is executed in which the amplitude-controlled processed musical sound type samples for one frame time are added to the corresponding samples in the output buffer. In this process, for each waveform sample for the one frame time, the amplitude control process and the addition process to the corresponding sample in the output buffer are continuously performed, so that the number of times the sample is taken into the CPU register is performed. The processing speed is improved.
【0035】
The calculation preparation to the calculation process of the musical tone type sample for 1 channel shown above are sequentially executed for the sounding channels of the second and subsequent calculation sequences. When the sound waveform calculation is completed in this way, the output buffer contains the cumulative value of the generated musical sound samples of all the sound channels to be calculated, which is the number of samples corresponding to one frame time (for example, 64). Sample) minutes are stored.
【0036】
Further, in step S5, when it is determined that the activation factor is other processing, the process proceeds to step S30, and the corresponding processing is executed. Other processes include, for example, the number of sounding channels of this software sound source, the selection of sampling frequency, and the capacity of the output buffer (this is one frame time) in response to a panel request or command input made by the operator. Various setting processes such as (corresponding to the length) are executed. Then, the result and the like are displayed on the screen in step S31, and the process returns to step S3 again.
【0037】
Further, if the determination result in step S5 is the input of the end request, the process proceeds to step S40, the end process is performed, the display screen corresponding to this soft sound source is deleted in step S41, and step S3 is performed again. Return to.
【0038】
The flow of signal data when generating a musical tone using such a software sound source will be described with reference to FIG. In this figure, it is assumed that the software for generating musical tones is the sequencer software 23 in FIG. 2 described above, and a case where real-time performance is performed using the sequencer software will be described as an example. This sequencer software inputs performance information from the keyboard, MIDI interface, etc., and outputs the corresponding MIDI event when there is a performance input.
【0039】
First, the sequencer software 23 sends a MIDI event corresponding to the generated musical tone to the MIDI driver in the driver software group 26. This is the sound source API (Application Programming Interface) of the VM. ) Is called to generate a software interrupt. The MIDI driver then transfers the MIDI message to the virtual device driver via the X sound source API. As a result, the MIDI processing routine (S10) loaded as a virtual device driver is started, and as described above, the musical tone control data corresponding to the MIDI message is generated and set in the sound source register corresponding to the sound source channel. To do. On the other hand, when a hardware interrupt is generated from CODEC11 when the musical tone reproduction for one frame is completed, the waveform generation routine (S20) is activated as described above, and the waveform sample data generation calculation for one frame is executed. Then, the generated musical sound type sample is stored in the output buffer. One frame of waveform sample data stored in this output buffer is transferred to the DMA buffer. The waveform sample data stored in the DMA buffer is read out one waveform sample at each sampling cycle under the control of DMAC10, supplied to the DAC, converted into an analog signal, and output as a musical tone from the sound system 14. The Rukoto.
【0040】
Further, a case where the game software 31 in the MS-DOS VM 30 is a program having a function of generating a musical sound by using a MIDI compatible sound source will be described. First, the game software 31 sends a MIDI event corresponding to the generated musical tone to the MIDI driver 32 in the VM30, and the MIDI driver 32 writes the MIDI event to the corresponding hard register 33. Since a trap is set for direct access to the hardware register from the Ring3 program, software interrupt occurs when a write access to this hardware register 33 is detected, and control is Ring0. The virtual device driver corresponding to the trap cause is started.
【0041】
If the personal computer being used is equipped with a normal hardware sound source, the virtual device driver corresponding to that hardware sound source is installed, and the virtual device driver for that hardware sound source is started. To. Since the hardware sound source is driven via the virtual device driver in this way, the hardware sound source can be shared by a plurality of VMs.
【0042】
When the corresponding hardware sound source is not equipped, the software sound source support routine 46 of the present invention, which is a virtual device driver, is activated, and the MIDI event is passed to the MIDI processing routine (S10). After that, the musical tone generation processing is performed in the same manner as in the above-mentioned case. Therefore, from the viewpoint of the application program, the processing is performed in exactly the same manner as when the hardware sound source is implemented, and it is possible to execute the processing by the software sound source without changing the program or the like.
【0043】
With reference to FIGS. 5 and 6, how the musical sound type sample calculated and generated in the waveform generation unit of step S20 is output from the DAC at each sampling period and emitted as a musical sound will be described. In FIG. 5, reference numeral 10 denotes the DMAC described above, and a pointer register 101 for designating the data read address p of the DMA buffer 60 is provided inside the DMAC. Reference numeral 11 denotes a sound input / output circuit (CODEC) described above, and inside the above-mentioned sound input / output circuit (CODEC), there are free areas in the output FIFO buffer 111, DAC 12, and the FIFO buffer 111 in which the music sound sample data read from the DMA buffer is stored. Empty detection means 113 that detects the presence of data, detects that the number of waveform sample data transferred from the FIFO buffer 111 to the DAC 112 has reached a predetermined number, and outputs a hardware interrupt to CPU1. Means 114 are provided. In addition to this, although not shown, an input FIFO to which an audio signal from the external audio input terminal 13 is input, an ADC that converts the output of the input FIFO into analog-to-digital, and the like are also provided.
【0044】
Reference numeral 12 denotes a sampling pulse generator that generates a sampling pulse of the frequency Fs described above, and its output is supplied to the FIFO buffer 111 and the transfer number detecting means 114. Further, reference numeral 60 denotes a DMA buffer (DMAB) for storing the musical tone type sample calculated and generated by the waveform generation unit step S20, and as shown in the figure, it is composed of, for example, two buffers, DMAB1 and DMAB2. Each buffer DMAB1 and DMAB2 both have a capacity capable of storing a number of musical sound samples corresponding to one frame time, and a waveform sample is read from one DMAB (for example, DMAB1). Occasionally, the other DMAB (for example, DMAB2) is configured to store the waveform sample calculated and generated by the waveform generation unit S20. The number of DMABs is not limited to two as in this example, but can be three or more.
【0045】
Reference numeral 46 denotes a software sound source support routine arranged as a virtual device driver, which includes a MIDI processing unit (S10) and a waveform generation unit (S20) as described above, and waveform generation in the waveform generation unit. The calculation is performed using the waveform data stored in the waveform data memory (waveform table) 70.
【0046】
As described above, when a MIDI event is generated from an application program that executes performance processing, software interruption occurs as described above, and the MIDI processing unit in the software sound source support routine 46, which is a virtual device driver. (S10) is activated, and the music control parameters corresponding to the MIDI event are stored in the sound source register. On the other hand, the waveform generator (S20) is activated by a hardware interrupt from CODEC11, and has a plurality of sound channels (for example, up to 32 channels) based on the musical tone control parameters stored in the sound source registers corresponding to each sound channel. ), A number of waveform sample data (for example, 64 samples) corresponding to each frame time are collectively generated by calculation, and the waveform sample data for one frame time is generated in the output buffer by accumulating them. When this waveform generation operation is completed, the waveform sample data generated in the output buffer is transferred to the DMAB60 which is not currently read, and to the DMAB2 in the state shown in FIG.
【0047】
The FIFO buffer 111 in the sound input / output circuit (CODEC) 11 stores the musical sound waveform data transferred from the DMAB60. Each time a sampling signal with a frequency of Fs (for example, 48 kHz) is generated from the sampling signal generator 12, the waveform sample stored in the FIFO buffer 111 is read out one by one, and a DAC (digital-to-analog converter) is read. Transferred to 112. The transferred musical sound sample data is converted into an analog voltage signal by the DAC 112, sent to the sound system 14, passed through a low-pass filter, amplified by an amplifier, and emitted from a speaker or the like.
【0048】
Further, the output of the sampling signal generator 12 is also input to the data transfer number detecting means 114, where the number of waveform samples transferred from the FIFO buffer 111 to the DAC 112 is counted. Then, when it is detected that the number of the transferred waveform sample data corresponds to one frame time, the hardware interruption is output to the CPU 1 from the data transfer number detecting means 114. As described above, this interrupt is received by the kernel part 41 of Ring0, and the waveform generation part (S20) in the soft sound source support routine 46 is started.
【0049】
Further, when it is detected by the free space detecting means 113 connected to the FIFO buffer 111 that a free space capable of storing data is generated in the FIFO buffer 111, the free space detecting means 113 detects the DMAC10. The DMA request signal DMAreq is generated in.
【0050】
FIG. 6A is a flowchart for explaining the operation of DMAC10. As described above, when the DMAreq is output from the free space detection means 113 in the CODEC11, the DMAC10 proceeds to step S100 and reads out the musical tone sample data stored at the address pointed to by the content p of the pointer register 101 of the DMAB60. , Transfer to FIFO buffer 111. Then, the process proceeds to step S110, the content p of the pointer register 101 is incremented, and the process corresponding to this DMAreq ends. In this way, every time the FIFO buffer 111 becomes empty, the musical sound type sample data is transferred from the DMAB 60 to the FIFO buffer 111.
【0051】
FIG. 6 (b) shows a configuration example of the DMAB60 described above. In this example, the area of n words from address b to address b + n-1 in RAM3 is used as DMAB60. Then, the area of this DMAB60 is divided into n / 2 words each and used as the DMAB1 and the DMAB2. For example, the DMAB region is divided into two parts, the part shown by the diagonal line in the figure and the other part, and when the DMAC10 reads the musical sound waveform data from the shaded part (DMAB1) in the figure, the address a is set as the head. The generated music waveform data is stored in the n / 2 word area (DMAB2). When the write address a or the read address p reaches the final address b + n-1 in the DMAB60 area, the write address a returns to the start address b again.
【0052】
The timing of the processing by the MIDI processing (S10) and the waveform generation processing (S20) described above will be described with reference to FIG. 7A. In this figure, the horizontal axis is the time axis. As described above, in the present invention, the waveform generation operation is executed in units of one frame. In this figure, the period Ta from the time ta to tb, the period Tb from tb to tc, and the period Tc from tc to td are any of them. Is also one frame time. The top row of the figure shows the timing of software interrupts caused by MIDI events generated by application programs such as sequence software. Times t1 and t2 during period Ta and period Tb An example is shown in which software interrupts due to MIDI events occur at mid-time t3.
【0053】
The next row of the figure shows the timing when MIDI processing (S10) is executed. As shown in this figure, this MIDI processing is performed every time software interrupt is generated by a MIDI event. It is running. The downward arrow shown in the middle of the figure indicates the timing of the hardware interrupt generated by CODEC11 described above, and the waveform from DMAB60 executed by DMAC10 shown in the bottom of the figure. Sample data is read and generated at time ta, tb, tc, and td in synchronization with the playback cycle (1 frame). When this hardware interrupt occurs, the execution of the waveform generation process (S10) is started as shown in the figure. The musical sound type sample calculated and generated in each of the waveform generation processes is transferred to the DMAB described above at the end of the waveform generation calculation. Further, in the figure, the portion painted in black immediately after the start of the waveform generation calculation indicates the interrupt prohibition period immediately after the hardware interrupt.
【0054】
Since the software interrupt due to the occurrence of the MIDI event and the hardware interrupt from the CODEC11 are interrupts of the same priority, the processing corresponding to one of the interrupts (MIDI processing or waveform generation processing). If the next interrupt occurs during execution of), the processing being executed will be interrupted and the processing corresponding to the interrupt that occurred later will be executed. For example, in this figure, a software interrupt occurs at time t1 during execution of the waveform generation process corresponding to the hardware interrupt that occurred at time ta, and the MIDI process corresponding to the MIDI event is executed. After the MIDI processing is completed, the continuation of the waveform generation processing is executed. In addition, a hardware interrupt from CODEC11 occurs at time tc during execution of MIDI processing corresponding to the software interrupt that occurred at time t3, the MIDI processing is interrupted, and the waveform generation processing is executed. After the waveform generation process is completed, the interrupted MIDI process is resumed.
【0055】
Then, the waveform generation operation corresponding to the MIDI event input in the period Ta is executed in the period Tb, and the waveform-generated musical sound sample is read and reproduced in the period Tc. In this way, the generated MIDI event will be emitted with a delay of approximately 2 frames. Therefore, when performing in real time, it is desirable to reduce the size of the DMAB and shorten the length of one frame time. For example, in this embodiment, 64 samples per frame are used. In addition, when performing an automatic performance or the like, it is desirable to increase the DMAB to increase the length of one frame time in order to prevent interruption of musical tones as described later.
【0056】
As described above, the corresponding waveform generation calculation is executed every frame time, but in some cases, the waveform generation calculation may not be completed within that frame time. For example, when processing that requires real-time performance such as multimedia software is being executed in parallel, the CPU power may be allocated for that purpose and the time for executing software sound source processing may not be allocated. is there. In the present invention, in such a case, the waveform generation is canceled for the frame time in which the calculation is not completed. This makes it possible to generate a waveform corresponding to the next frame time in a stable state. Note that the musical sound is not generated temporarily, but the time is short (for example, when the sampling frequency is 48 kHz and one frame is 64 samples, one frame time is about 1.3 milliseconds). , The effect is small.
【0057】
Figure 7 (b) shows an example of canceling the waveform generation in this way. This example shows the case where the waveform generation operation corresponding to the MIDI performance input input in the period T4 is performed halfway from the period T5 to T7 for the reason described above (in the figure, the waveform). Although it is described as if the generation operations are performed continuously, in reality, control is taken away by other processing, and the waveform generation operations are executed intermittently). Therefore, in this example, the waveform data from the period T5 to T7 in which the waveform generation operation corresponding to the MIDI event input in the period T4 is performed is canceled, and the DMA output during the corresponding period T6 to T8 is performed. Absent. Therefore, the waveform generation operation corresponding to the MIDI event input in the periods T5 and T6 is not executed, and the waveform generation operation corresponding to the MIDI event input in the next period T7 is stably generated as usual. Will be done.
【0058】
Next, FIG. 8 shows a modified example of the present invention. (A) of FIG. 8 shows the first modification. In this example, the hardware interruption generated from CODEC11 is generated Ti time earlier than the timing at which the playback of one frame ends. In this way, when the waveform generation operation is started, first, the waveform sample data already generated in the previous waveform generation operation is transferred to the DMAB, and then the waveform sample data to be transferred in the next waveform generation operation. Is to be generated. Since the time required for the waveform generation operation varies depending on the number of MIDI events, the hardware interrupt is generated at such an early timing, and the waveform sample generated by the previous waveform generation operation at the start of the waveform generation operation. Is transferred to the DMAB, so that the data can be stably transferred to the DMAB. It should be noted that advancing the hardware interrupt by the Ti time means that the number of transferred waveform samples in the transfer number detecting means 114 described above corresponds to the Ti time as compared with the case of FIG. 7 (a). This can be done by making interrupts occur when the number is as small as possible.
【0059】
(B) in FIG. 8 shows another example of modification. In this example, the priority of the software interrupt is set to be higher than that of the hardware interrupt. Due to the high priority of software interrupts, as shown in the figure, hardware interrupts occur from CODEC11 at the time tc when MIDI processing corresponding to the software interrupts that occurred at time t3 is being executed. However, the corresponding waveform generation operation is executed after the MIDI processing is completed.
【0060】
In the above-described embodiment, in CODEC11, the transfer number detecting means counts the number of data transfers to generate hardware interrupt, but the present invention is not limited to this, and CPU1 or DMAC10 is connected to the DAC. The number of data transfers may be detected.
【0061】
Further, in the above-described embodiment, the DMAC 10 is provided to transfer the waveform sample data to the FIFO buffer 111 in the sound input / output circuit (CODEC) 11 and eventually to the DAC 112, but the present invention is not limited to this. , If the bus connected to the board on which the CODEC11 is mounted is a high-speed one and the data transfer to the CODEC11 can be performed at high speed, the data transfer to the CODEC11 may be performed by the CPU1. In this case, the CPU transfers the waveform sample data stored in the buffer one by one to the DAC by the hardware interruption generated in each sampling cycle, and counts the number of samples that have been transferred at the same time. Then, when the counting result indicates the completion of the transfer for one frame, the software interrupt for executing the waveform generation operation is configured to be generated.
【0062】
Furthermore, in the above-described embodiment, the case where Windows 95 is used as the operating system has been described as an example, but the present invention is not limited to this, and the present invention is also applicable to other OS such as Windows NT, MacOS, and UNIX. It is possible to apply a musical tone generation method. Similarly, the CPU used is not limited to x86 CPUs, but PowerPC (PowerPC is a trademark of IBM) and other RISC processors can be used.
【0063】
Furthermore, the musical sound generation method is not limited to the waveform memory method as in the above-described embodiment, and may be any method such as an FM method, a physical model method, and an ADPCM method.
【0064】
[Effect of the invention]
According to the present invention, since the musical sound type samples are calculated and generated for each frame, the calculation efficiency can be improved, the quality of the generated musical sound can be improved, and the number of simultaneous sounding channels can be increased. Will be. In addition, since the virtual device driver is closer to the hardware, there is less interruption delay, and since it is executed with 32-bit code, MIDI processing and waveform generation processing are executed at high speed, and waveform generation calculation is stable. Further, it is possible to use the software sound source of the present invention in common from a plurality of VMs. Furthermore, from the VM side, the same device driver as when using a hardware sound source can be used, and a software sound source compatible with the hardware sound source can be provided.
【0065】
Furthermore, since the size of the DMAB can be set arbitrarily, it is possible to use a buffer having a small size, and it is possible to reduce the delay in pronunciation in the case of real-time performance. Furthermore, since the waveform generation is canceled for the time frame in which the calculation is not in time, even if the operation is disturbed due to some kind of failure, it is possible to immediately return to the stable operation state.
[Simple explanation of drawings]
[Figure 1]
It is a block which shows the structure of the musical tone generator of this invention.
[Figure 2]
It is a figure which shows the structure of the software module of this invention.
[Fig. 3]
It is a figure which shows the process in the musical tone generation method of this invention.
[Fig. 4]
It is a figure which shows the flow of the process in this invention.
[Fig. 5]
It is a figure which shows the flow of the generated musical tone type data.
[Fig. 6]
It is a figure which shows the processing in DMAC, and the configuration example of the DMA buffer.
[Fig. 7]
It is a figure for demonstrating the timing of processing in this invention.
[Fig. 8]
It is a timing diagram which shows the modification of the process in this invention.
[Explanation of symbols]
1 CPU, 2 ROM, 3 RAM, 4 timers, 5 MIDI interfaces, 6 keyboards, 7 displays, 8 hard disk devices, 10DMAC, 11 sound input / output circuits, 12 sampling frequency generators, 13 external audio input terminals, 14 sound systems, 15 floppy disk unit, 16 buses, 60 DMA buffer, 101 pointer register, 111 FIFO buffer, 112 DAC, 113 empty detection means, 114 transfer number detection means
9 sheets
Sheet 1 Sheet 2 Sheet 3 Sheet 4 Sheet 5 Sheet 6 Sheet 7 Sheet 8 Sheet 9
Every citation, both ways
| Document | Relation | Office | Cited during |
|---|---|---|---|
| US6553436B2 | Cited by | United States of America | Applicant |
| JP2009175199A | Cited by | Japan | Search report |
| US6343738B1 | Cited by | United States of America | Search report |
| JP2015165306A | Cited by | Japan | Search report |
| US6366971B1 | Cited by | United States of America | Applicant |
| US6547134B2 | Cited by | United States of America | Search report |
11 members in 6 offices
Priority claims2
| Document | Office | Kind | Date |
|---|---|---|---|
| 34904695 | Japan | A | |
| JP19950349046 | – | – | – |
Members11
| Document | Office | Kind | |
|---|---|---|---|
| TW282538B | Taiwan Province of China | B | |
| EP0780827A1 | European Patent Office (EPO) | A1 | |
| JPH09179556AThis record | Japan | A | |
| CN1159637A | China | A | |
| JP2904088B2 | Japan | B2 | |
| US5973251A | United States of America | A | |
| US6040515A | United States of America | A | |
| EP0780827B1 | European Patent Office (EPO) | B1 | |
| DE69613950D1 | Germany | D1 | |
| DE69613950T2 | Germany | T2 | |
| CN1141695C | China | C |
12 legal events, as the office reported them to INPADOC
Over the term
Point at a mark for the eventEvents
| Event | Code | |
|---|---|---|
| Cancellation because of completion of termEXPY | EXPY | |
| Renewal fee payment (event date is renewal date of database)FPAY | FPAY | |
| Renewal fee payment (event date is renewal date of database)FPAY | FPAY | |
| Renewal fee payment (event date is renewal date of database)FPAY | FPAY | |
| Renewal fee payment (event date is renewal date of database)FPAY | FPAY | |
| Renewal fee payment (event date is renewal date of database)FPAY | FPAY | |
| Renewal fee payment (event date is renewal date of database)FPAY | FPAY | |
| Renewal fee payment (event date is renewal date of database)FPAY | FPAY | |
| Renewal fee payment (event date is renewal date of database)FPAY | FPAY | |
| Written notification of registration of transferJAPANESE INTERMEDIATE CODE: R350R350 | R350 | |
| Written request for registration of change of domicileJAPANESE INTERMEDIATE CODE: R313532S531 | S531 | |
| Written decision to grant a patent or to grant a registration (utility model)JAPANESE INTERMEDIATE CODE: A01A01 | A01 |
Numbers
- Publication
- 9-179556
- Publication, DOCDB
- H09179556
- Publication, EPODOC
- JPH09179556
- Application
- 7349046
- Application, DOCDB
- 34904695
- Application, EPODOC
- JP19950349046
Titles2
- Japanese
- 【発明の名称】楽音生成方法および装置
- English
- [Title of Invention] Musical tone generation method and apparatus
Classification
- CPC, 3
- G10H1/0066
- G10H7/002
- G10H2230/041
- IPC, 4
- G10H1 00
- G10H1 02
- G10H7 00
- G10H7 02