The present invention relates to a music player for playing music data such as musical instrument digital interface (MIDI) data. The music player of the invention is applicable to a mobile phone, a personal digital assistance (PDA), a game player, and a MIDI player.
MIDI has been known as technology for playing music using music data. Patent Reference 1 has disclosed the MIDI technology. There has been known a MIDI player capable of playing MIDI data in a plurality of channels concurrently. With a MIDI player capable of playing a plurality of channels, it is possible to play, for example, a melody and background music at the same time.
In a conventional MIDI player capable of playing a plurality of channels, an input first-in-first-out (FIFO), a sequencer, an output FIFO, and a sound source are provided in each of the channels. The sequencer analyzes and processes content of an MIDI message, and converts the content to information (sound source drive information) for driving the sound source. In general, the sequencer is formed of software with a single central processing unit (CPU) in the MIDI player.
An MIDI message typically has a different length of data depending on a type of message, and may even have a variable length of data. Accordingly, each sequencer analyzes and processes in a different sequence for a different period of time. For example, when one sequencer complete a process for a single MIDI message and moves to a next process, another sequencer may not yet complete a process of another single MIDI message.
Accordingly, in the MIDI player capable of playing a plurality of channels, it may be necessary to stop another sequencer and move the one sequencer to the next process. If the one sequencer waits until another sequencer completes the process of another MIDI message, it is necessary to stop the one sequencer in the middle, thereby making it difficult to smoothly play the MIDI data.
Therefore, when a single CPU operates several sequencers in a plurality of channels, it is necessary to properly control the sequencers to analyze and process, and to maintain a state when a sequencer stops processing in the middle. As described above, the MIDI messages contain different contents with different lengths. Accordingly, in order to properly control the sequencers, it is necessary to provide a complex program.
When sequencers are switched with an existing operating system (OS) or a scheduler through a multi-task process, it is possible to control the sequencers relatively easily. However, it is necessary to provide a large capacity memory (read only memory, ROM, or random access memory, RAM) to provide such an OS or a scheduler. In particular, it is difficult to provide an OS in a compact MIDI player such as a melody player of a mobile phone.
Patent Reference 1; Japanese Patent Publication (Kokai) No. 2001-51678
In view of the problems described above, an object of the present invention is to provide a music player capable of controlling a plurality of sequencers with a simple program without an OS or a scheduler.
Further objects and advantages of the invention will be apparent from the following description of the invention.
In order to attain the objects described above, according to the present invention, a music player is capable of properly switching a plurality of sequencers to play music in a plurality of channels. Each of the sequencers includes a reading and restoring function unit for reading music information including header information, a delta time, and a message from an input memory and restoring running status of the message; a message analyzing and processing function unit for analyzing the header information input from the reading and restoring function unit, consuming a period of time according to the delta time, and analyzing and processing the message to generate sound source drive information; a writing function unit for writing the sound source drive information generated in the message analyzing and processing function unit into an output memory; and a sequencer controlling function unit for controlling the reading and restoring function unit to read and restore the music information, controlling the message analyzing and processing function unit to analyze the header information, and controlling the message analyzing and processing function unit and the writing function unit to consume the period of time, generate the sound source drive information, and write the sound source drive information, respectively, when the header information is proper.
When the sequencers are switched to operate, a part or a whole part of an operational state of each of the function units is maintained per each of the function units while each of the function units stops an operation.
In the present invention, each of the sequencers includes the reading and restoring function unit; the message analyzing and processing function unit; the writing function unit; and the sequencer controlling function unit. Each of the function units is controlled separately. Accordingly, it is possible to control the sequencers with a simple program without an OS or a scheduler.
Hereunder, embodiments of the present invention will be explained with reference to the accompanying drawings. In the drawings, a size, a shape, and an arrangement of constituting components are schematically shown for explanation of the present invention. Numerical conditions described in the following description are just an example.
The input FIFOs 110-1 to 110-4 receive music information in corresponding channels from outside, and temporarily store the music information. The input FIFOs 110-1 to 110-4 typically have a memory capacity of, for example, 256 bites. The four-channel MIDI sequencer 120 receives MIDI data of the four channels from the input FIFOs 110-1 to 110-4, respectively, and analyzes and processes the MIDI data per channel to generate sound source drive information.
The output FIFOs 130-1 to 130-4 receive the sound source drive information of a corresponding channel from the four-channel MIDI sequencer 120, and temporarily store the sound source drive information. The output FIFOs 130-1 to 130-4 typically have a memory capacity of, for example, 32 bites. The sound source 140 includes sound sources for the four channels. The sound source 140 receives the sound source drive information from the output FIFOs 130-1 to 130-4, and generates an analog sound signal for driving a speaker (not shown) according to the sound source drive information.
In the embodiment, the function units 210 and 221 to 224 are formed as firmware with a single CPU (not shown). That is, the function units 210 and 221 to 224 are not formed on an OS as software, but are formed directly on hardware as software. The channel control function unit 210 properly switches and operates the sequencers 220-1 to 220-4. Accordingly, it is possible to play music in four channels.
The reading and restoring function unit 221 receives the MIDI data from a corresponding input FIFO (in a case of the sequencer 220-1, the input FIFO 110-1). Further, the reading and restoring function unit 221 restores running status of an MIDI message. The running status is technology for eliminating status bites of a second MIDI message and after to reduce an amount of transfer data when a plurality of continuous MIDI messages contains a same status bite (bite representing a type of MIDI message). The reading and restoring function unit 221 restores the eliminated status bites to restore the MIDI messages before the running status.
Further, the reading and restoring function unit 221 may determine whether the music information is the MIDI messages. When the music information is not the MIDI messages, the music information may be converted to the MIDI messages. Accordingly, among analyses and processes of the music information, the reading and restoring function unit 221 performs an analysis and a process regarding a data structure and a data format of the music information. Further, the reading and restoring function unit 221 controls a state of own analysis and process, and stores the state as necessary (described later with reference to
The message analyzing and processing function unit 222 analyzes header information of the MIDI data input from the reading and restoring function unit 221, and analyzes and processes a message stored in the MIDI data to generate the sound source drive information. That is, among the analyses and the processes of the music information (the MIDI data), the message analyzing and processing function unit 222 performs an analysis and a process for generating the sound source drive information according to contents of the message stored in the music information the music information. Further, the message analyzing and processing function unit 222 controls a state of own analysis and process, and stores the state as necessary (described later with reference to
The writing function unit 223 writes the sound source drive information generated in the message analyzing and processing function unit 222 into a corresponding output FIFO (in a case of the sequencer 220-1, the output FIFO 130-1). Since the writing function unit 223 simply writes data in the output buffer 226 into the output FIFO 130-1, it is not necessary to control a state of own analysis and process (described later).
The sequencer controlling function unit 224 controls the reading and restoring function unit 221 to obtain the header information, and controls the message analyzing and processing function unit 222 to analyze the header information. When the header information is normal, the sequencer controlling function unit 224 controls the message analyzing and processing function unit 222 and the writing function unit 223 to repeat consuming a period of time according to a delta time, generating the sound source drive information according to the message, and writing the sound source drive information into the output FIFO 130-1 to 130-4. Further, the sequencer controlling function unit 224 controls a state of own analysis and process, and stores the state as necessary (described later with reference to
An operation of the MIDI player 100 according to the embodiment of the present invention will be explained next in terms of a header analyzing process, a timing controlling process, and a sound source drive information generating and writing process. FIGS. 3 to 7(A)-7(C) are views showing the operation of the MIDI player 100.
In the following description, an operation of the sequencer 220-1 will be explained as an example. Operations of the sequencers 220-2 to 220-4 are the same as that of the sequencer 220-1.
Header Analyzing Process
When the four-channel MIDI sequencer 120 starts operating (
When a part or all of the bites of the header information is not stored, the reading and restoring function unit 221 is not capable of performing the reading process. In this case, the reading and restoring function unit 221 maintains a state “In reading header information” as analysis and process status, and holds the number of the bites of the header information that the reading and restoring function unit 221 has read (
In the next step, the reading and restoring function unit 221 sends a message signal to the sequencer controlling function unit 224 indicating that the reading of the header information is stopped before completion (R4 in
Upon receiving the message signal, the channel control function unit 210 stops the operation of the sequencer 220-1, and starts an operation of the sequencer 220-2. After operations of the sequencers 220-2 to 220-4 are performed, the reading and restoring function unit 221 starts the operation of the sequencer 220-1 again. At this time, the sequencer controlling function unit 224 determines that the operation of the sequencer 220-1 stops before the reading of the header information is completed based on the analysis and process status (“In reading header information”) (S304 in
When the reading is completed, the reading and restoring function unit 221 sends a message signal to the sequencer controlling function unit 224 indicating that the reading is completed (R6 in
Upon receiving the request, the message analyzing and processing function unit 222 reads the header information from the input buffer 225 and analyzes the header information (R8 in
Timing Controlling Process
In the timing controlling process, first, the sequencer controlling function unit 224 requests the reading and restoring function unit 221 to read the delta time (S306 in
When a part or all of the bites of the delta time is not stored, the reading and restoring function unit 221 is not capable of performing the reading process. In this case, the reading and restoring function unit 221 maintains a state “In reading delta time” as analysis and process status, and holds the number of the bites of the delta time that the reading and restoring function unit 221 has read (
Upon receiving the message signal, the channel control function unit 210 stops the operation of the sequencer 220-1, and starts an operation of the sequencer 220-2. After operations of the sequencers 220-2 to 220-4 are performed, the reading and restoring function unit 221 starts the operation of the sequencer 220-1 again. At this time, the sequencer controlling function unit 224 determines that the operation of the sequencer 220-1 stops before the reading of the delta time is completed based on the analysis and process status (“In reading delta time”) (S304 in
When the reading is completed, the reading and restoring function unit 221 sends a message signal to the sequencer controlling function unit 224 indicating that the reading is completed (T6 in
Upon receiving the request, the message analyzing and processing function unit 222 reads the delta time from the input buffer 225 (T8 in
In the next step, the message analyzing and processing function unit 222 sends a message signal to the sequencer controlling function unit 224 indicating that the time consumption is stopped before completion (T9 in
Upon receiving the message signal, the channel control function unit 210 stops the operation of the sequencer 220-1, and starts an operation of the sequencer 220-2. After operations of the sequencers 220-2 to 220-4 are performed, the reading and restoring function unit 221 starts the operation of the sequencer 220-1 again. At this time, the sequencer controlling function unit 224 determines that the operation of the sequencer 220-1 stops before the consumption of the delta time is completed based on the analysis and process status (“In controlling timing”) (S304 in
When the consumption of the delta time is completed, the message analyzing and processing function unit 222 sends a message signal to the sequencer controlling function unit 224 indicating that the consumption is completed (R11 in
Sound Source Drive Information Generating and Writing Process
In the sound source drive information generating and writing process, first, the sequencer controlling function unit 224 requests the reading and restoring function unit 221 to read the message (S312 in
When a part or all of the bites of the message is not stored in the input FIFO 110-1, the reading and restoring function unit 221 is not capable of performing the reading process. In this case, the reading and restoring function unit 221 maintains a state “In reading message (type not identified”, “In reading message (three bites message)”, “In reading message (meta event)”, or “In reading message (system exclusive message)” as the analysis and process status, and holds the number of the bites of the message that the reading and restoring function unit 221 has read (
Then, the reading and restoring function unit 221 sends a message signal to the sequencer controlling function unit 224 indicating that the reading of the message is stopped before completion (P4 in
Upon receiving the message signal, the channel control function unit 210 stops the operation of the sequencer 220-1, and starts an operation of the sequencer 220-2. When the operation of the sequencer 220-1 starts again, the sequencer controlling function unit 224 determines that the operation of the sequencer 220-1 stops before the reading of the message is completed based on the analysis and process status (“In reading message (type not identified)” and the like) and the type of the message (or unidentified state thereof) (S304 in
When the reading of the message is completed, the reading and restoring function unit 221 sends a message signal to the sequencer controlling function unit 224 indicating that the reading is completed (P4 in
Upon receiving the request, the message analyzing and processing function unit 222 reads the MIDI data from the input buffer 225 and analyzes the same (P7 in
When the message is normal (message compatible with the sound source 140), the message analyzing and processing function unit 222 generates the sound source drive information according to content of the message, and writes the content in the output buffer 226 (P10 in
When the output FIFO 130-1 runs out a storage space, the writing function unit 223 is not capable of performing the reading process. In this case, the writing function unit 223 sends a message signal to the sequencer controlling function unit 224 indicating that the reading is stopped before completion (P15 in
Upon receiving the message signal, the sequencer controlling function unit 224 recognizes that the reading of the sound source drive information is stopped before completion (S318 in
Upon receiving the message signal, the channel control function unit 210 stops the operation of the sequencer 220-1, and starts an operation of the sequencer 220-2. When the operation of the sequencer 220-1 starts again, the sequencer controlling function unit 224 determines that the operation of the sequencer 220-1 stops before the reading of the sound source drive information is completed based on the analysis and process status (“In writing sound source drive information”) (S304 in
When the writing is completed, the writing function unit 223 sends a message signal to the sequencer controlling function unit 224 indicating that the writing is completed (P17 in
As described above, each of the sequencers 220-1 to 220-4 includes the reading and restoring function unit 221; the message analyzing and processing function unit 222; the writing function unit 223; and the sequencer controlling function unit 224. The status of analysis and process of each of the function units is controlled and stored separately, thereby making control and storage items simple (
The disclosure of Japanese Patent Application No. 2004-367544, filed on Dec. 20, 2004, is incorporated in the application.
While the invention has been explained with reference to the specific embodiments of the invention, the explanation is illustrative and the invention is limited only by the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
2004-367544 | Dec 2004 | JP | national |
Number | Name | Date | Kind |
---|---|---|---|
4387617 | Kato et al. | Jun 1983 | A |
5602841 | Lebizay et al. | Feb 1997 | A |
5763805 | Yamabata et al. | Jun 1998 | A |
5862136 | Irwin | Jan 1999 | A |
5955691 | Suzuki et al. | Sep 1999 | A |
Number | Date | Country |
---|---|---|
2001-051678 | Feb 2001 | JP |
WO 0111603 | Feb 2001 | WO |
Number | Date | Country | |
---|---|---|---|
20060130638 A1 | Jun 2006 | US |