This application claims the priority benefit of Taiwan application serial no. 94128160, filed on Aug. 18, 2005. All disclosure of the Taiwan application is incorporated herein by reference.
1. Field of Invention
The present invention relates to a structure for multi-media. More particularly, the present invention relates to a structure for playing musical instrument digital interface (MIDI thereinafter) messages.
2. Description of Related Art
MIDI is the acronym of Musical Instrument Digital Interface, which is a protocol used for exchanging musical information among music synthesizers, musical instruments, and computers. Since the beginning of 80s, MIDI has been widely accepted and adopted by musicians and composers. MIDI is a standard language used by musical instruments and computers. It is a set of commands which instructs what musical instruments (i.e. MIDI equipments) should do and how to do it, for example, playing musical notes, raising volume, and producing sound effects, etc. MIDI is neither audio signal nor sound that is transmitted over MIDI cable, but a command sent to MIDI equipments or other apparatuses for playing a sound or executing certain action.
MIDI standard is popular mostly because of the following advantages:
1. The files generated are smaller, because MIDI files are commands rather than audio waveforms.
2. Editing is easier because editing commands is easier than editing audio waveforms.
3. It may be used as background music because MIDI music may be played along with other media such as digital video, graphics, animation, audio etc, to enhance the effect of the performance.
Since the tone colors of wavetables are directly loaded into the buffer memory for synthesis in the conventional structure, the capacity of the buffer memory is a very important for the conventional technology. A large capacity buffer memory is required if the MIDI messages played by a conventional structure with many tone colors. It is not only increases the manufacturing cost, but also limits the hardware extendibility of the conventional structure. The buffer memory needs to be replaced if the volume of tone colors required by the play MIDI messages is greater than the storage capacity of the buffer memory.
Accordingly, the present invention is directed to provide a structure which has better hardware flexibility and is applicable to different MIDI messages.
According to another aspect of the present invention, a multi-media apparatus that may play any MIDI messages without a large buffer memory is provided.
According to yet another aspect of the present invention, a method for playing MIDI messages that may play MIDI messages according to the capacity of the buffer memory is provided.
The structure for playing MIDI messages provided by the present invention includes a main-control element, a buffer memory, a MIDI synthesizer and a pre-processor. Wherein, the main-control element receives a plurality of tone colors and at least a MIDI message. The pre-processor is coupled to the main-control element and the buffer memory to analyze the MIDI messages and to determine how to load the tone colors into the buffer memory according to the capacity of the buffer memory. The MIDI synthesizer may synthesize the data stored in the buffer memory into audio signals according to the MIDI messages.
According to another aspect of the present invention, a multi-media apparatus including a storage apparatus, a main-control element, a buffer memory, a MIDI synthesizer, and a pre-processor is provided. Wherein, the storage apparatus is used for storing at least a MIDI message and a plurality of tone colors. The main-control element reads the tone colors and the MIDI messages from the storage apparatus and transmits them to the pre-processor. The pre-processor, coupled to the main-control element and the buffer memory, is used for analyzing the MIDI messages and determining how to load the tone colors into the buffer memory according to the capacity of the buffer memory. The MIDI synthesizer may synthesize the data stored in the buffer memory into audio signals according to the MIDI messages.
In the embodiments of the present invention, the aforementioned storage apparatus may further store video data, and the multi-media apparatus provided by the present invention may further include a demultiplexer and a decoder. Wherein the input of the demultiplexer is coupled to the main-control element, and the first output thereof is coupled to the pre-processor to transmit the MIDI messages to the pre-processor, and the second output thereof is coupled to the decoder so that the decoder may receive video data for decoding through the demultiplexer.
According to another aspect of the present invention, a MIDI message playing method adapted to the capacity of the buffer memory is provided for generating audio signals according to the MIDI messages, and the steps of the present invention are described below. First, receive a MIDI file, which contains MIDI messages, and analyze the MIDI messages to produce an analysis result. Load all the tone colors of wavetables into a storage area if the size of the storage area is large enough to store all the wavetables. Load the tone colors required for processing the MIDI messages into the storage area according to the analysis result, if the size of the storage area is not large enough for storing all the wavetables but enough for storing all the required tone colors for processing the MIDI messages. And load the tone colors required currently for processing the MIDI messages into the storage area in real time according to the analysis result, if the capacity of the storage area is not large enough to store all the wavetables or to store all the required tone colors. After that, generate audio signals according to the MIDI messages and using the wavetables (or tone colors) in the storage area.
According to an exemplary embodiment of the present invention, if the capacity of the storage area is not large enough to store all the wavetables or to store all the required tone colors for processing the MIDI messages, the storage area is divided into several sub-areas according to the maximum volume of the tone colors required for synthesizing the MIDI messages. Next, the tone colors required currently are loaded for processing the MIDI messages into these sub-areas respectively. Those tone colors without current need are removed from the storage area when there is no more sub-area to store other tone colors that will be used next.
According to another aspect of the present invention, a MIDI message playing method applicable to processing sequence data is provided, which includes dividing a storage area into a first sub-area and a second sub-area first, then dividing the content of the sequence data into several sub-sets in order in advance, and the total size of the required tone colors of each sub-set is not greater than the capacity of the first sub-area or the capacity of the second sub-area. First, load the tone colors required for a sub-set of sequence data into the first sub-area, then read the required tone colors from the first sub-area and synthesize them into audio signals according to the sub-set of sequence data corresponding to the tone colors in the first sub-area. Load the required tone colors of the next sub-set into the second sub-area in advance while using the tone colors in the first sub-area to synthesize into audio signals, so that audio signals are synthesized according to the tone colors of the subset in the second sub-area after the process of tone colors in the first sub-area is completed.
Similarly, load the required tone colors of the other next sub-set of data sequence into the first sub-area in advance when synthesizing the audio signals by using the tone colors in the second sub-area, so that audio signals are synthesized according to the tone colors of the subset in the first sub-area after the process of tone colors in the second sub-area is completed. Repeating the step of loading the tone colors of each of the sub-sets into the first sub-area and the second sub-area until the tone colors of the sub-sets are complete.
In summary, the present invention includes at least the following advantages:
1. The present invention is not restricted by the capacity of the buffer memory because the pre-processor analyzes the MIDI messages before loading tone colors of wavetables into the buffer memory in the structure provided by the present invention.
2. The present invention has better hardware flexibility and can reduce hardware cost with buffer memory of lower capacity by the aforementioned structure is used in the multi-media apparatus.
3. The present invention is applicable to different MIDI messages because the tone colors are loaded according to the capacity of the storage area in the MIDI message playing method provided by the present invention.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, a preferred embodiment accompanied with figures is described in detail below.
It is to be understood that both the foregoing general description and the following detailed description are exemplary, and are intended to provide further explanation of the invention as claimed.
The accompanying drawings are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.
MIDI data is the definition of a set of musical notes rather than actual musical audio. The content of a MIDI file consists of MIDI messages. An MIDI message consists of 1 to 8 status bits and generally followed by 2 data bytes. In the status bits, the most significant bit is set to “1”, and the following 3 bits are used for indicating which type of message this MIDI message is. The remaining 4 bits may be used for indicating which channel this MIDI message belongs to, and 4 bits can indicate 16 possible channels. MIDI messages may be categorized into 2 types, i.e. channel messages and system messages.
There are many ways to generate MIDI sound, and the most common methods are: Frequency Modulation (FM) Synthesis and Wavetable Synthesis. It's very difficult to produce various sound effects using the Frequency Modulation Synthesis because it's almost impossible to generate some sound effects. Thus, the Wavetable Synthesis has become the preferred option. Wavetable Synthesis records real sounds in digital format and change the playing speed and then change the tone periods to generate musical notes of various musical scales when Wavetable Synthesis are being played. Generally, there are various tone colors in the wavetable.
The main-control element 201 sends the sequence data (MIDI messages) 203 to the pre-processor 205 after receiving the sequence data (MIDI messages) 203. The pre-processor 205 analyzes the sequence data (MIDI messages) 203 and transmits at least part of the tone colors to the buffer memory 209 to be registered according to the capacity of the buffer memory 209. In the present embodiment, the buffer memory 209 is, for example, dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), or flash memory etc. The pre-processor 205 transmits the sequence data (MIDI message) 203 to the MIDI synthesizer 211 after transmitting the wavetables to the buffer memory 209 to be registered, and the MIDI synthesizer 211 generates synthesized sound effects according to the data in the buffer memory 209.
On the other hand, if the pre-processor 205 determines that the capacity of the storage area in the buffer memory 209 cannot store all the wavetables (i.e. “no” in step S305), then the pre-processor 205 performs step S309, which is, determining again whether the capacity of the storage area in the buffer memory 209 can store the tone colors required for processing the MIDI message. Assuming that the MIDI message processed by the present invention needs ten tone colors among all the wavetables, the pre-processor 205 would determine whether the storage capacity of the buffer memory 209 could store these ten tone colors.
If the capacity of the buffer memory 209 is determined to be enough for storing all the tone colors required for processing the sequence data (MIDI message) 203 (i.e. “yes” in step S309), then the pre-processor 205 loads the tone colors required for processing the sequence data (MIDI message) 203 into the storage area of the buffer memory 209 according to the aforementioned analysis result in step S311. On the other hand, if the capacity of the buffer memory 209 is not enough for storing all the wavetables required for processing the sequence data (MIDI message) 203 (i.e. “no” in step S309), then the pre-processor 205 executes step S313, which is, loading the tone colors required for synthesizing according to the sequence data (MIDI messages) 203 into the storage area of the buffer memory 209 in real time according to the aforementioned analysis result. The MIDI synthesizer 211 would generate an audio signal according to the sequence data (MIDI message) 203 and the wavetables stored in the buffer memory 209 in step S315, after the pre-processor 205 loads the wavetables into the buffer memory 209.
Next, the pre-processor 205 loads the tone colors required currently for processing the sequence data (MIDI message) 203 into the sub-areas of the buffer memory 209 respectively in the order used, in step S403. After that the pre-processor 205 transmits this part of the sequence data (MIDI message) 203 to the MIDI synthesizer 211, the MIDI synthesizer 211 may obtain the required tone colors from the buffer memory 209 to synthesize into audio signals. The tone colors in the buffer memory 209 may be deleted after usage. While synthesizing into audio signals, the pre-processor 205 checks constantly whether there is any empty sub-area in the buffer memory 209 for storing another tone color(s), in step S405. If there is still empty sub-area in the buffer memory 209 for storing tone colors (i.e. “yes” in step S405), the step S403 is repeated. And if there is no more empty sub-area in the buffer memory for storing tone colors (i.e. “no” in step S405), then the pre-processor 205 removes those tone colors without current need for processing the sequence data (MIDI messages) 203 from the buffer memory 209 in step S407.
In some other embodiments of the present invention, those unimportant wavetables may be removed from the buffer memory by controlling the Maximum Polyphony.
Next, analyze the received sequence data in advance, and divide the sequence data into N sub-sets D(t) in order, wherein N is a positive integer and t=0˜(N−1). In step S502, the total of the tone colors required by the sequence data of each sub-set D(t) is not greater than M. The present invention goes to step S503, which is, loading the tone colors required by the sequence data of a sub-set D(t) into area A in advance. Then proceed to step S504, when the MIDI synthesizer obtains the required tone colors from area A to synthesize an audio signal according to the sequence data of the sub-set D(t). Meanwhile, the present invention loads the tone colors required by the sequence data of the next sub-set D(t+1) into area B in advance.
Similarly, in step S505, obtain the required tone colors from area B to synthesize an audio signal according to the sequence data of the sub-set D(t+1). Meanwhile, load the tone colors required by the sequence data of the next sub-set D(t+2) into area A. Finally, in step S506, repeat steps S504 and S503 until all the sub-sets of sequence data are processed. Thus, the audio synthesis can be accomplished by loading the tone colors of wavetables dynamically when the memory space is not large enough.
According to the playing structure in
Referring to
When the pre-processor 609 receives the MIDI message, it loads at least part of the tone colors into the buffer memory 613 and controls the MIDI synthesizer 615 to synthesize an audio using the tone colors stored in the buffer memory 613 according to the method described in
Moreover, the MPEG decoder 611 decodes the video data VIDEO when receiving the video data VIDEO through the demultiplexer 607, then the MPEG decoder 611 transmits the decoded video data VIDEO to the display apparatus 631 to output it. In the present invention, the display apparatus 631 is, for example, a liquid crystal display or a conventional TV set.
In summary, in the present invention, a pre-processor is disposed to process the MIDI messages in advance, and by using the playing method of the present invention, the volume of the tone colors of wavetables to be loaded is determined according to the capacity of the storage area of the buffer memory. Thus, the present invention has better hardware flexibility and can be applied to process different kinds of MIDI messages.
It will be apparent to those skilled in the art that various modifications and variations can be made to the structure of the present invention without departing from the scope or spirit of the invention. In view of the foregoing, it is intended that the present invention cover modifications and variations of this invention provided they fall within the scope of the following claims and their equivalents.
Number | Date | Country | Kind |
---|---|---|---|
94128160 | Aug 2005 | TW | national |