Introduction to polyphonic ringtone design and MIDI music file playback process

Publisher:NatureLoverLatest update time:2024-09-23 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Polyphonic Ringtones Overview

Chords are a concept in music theory, which refers to the combination of three or more tones stacked in a third relationship. In the field of industrial design of audio equipment, chords refer to the simultaneous sounding of multiple sound sources, also known as polyphony. Polyphonic ringtones have been widely used in mobile phones. They have a full and mellow tone and a strong sense of three-dimensionality, and have completely replaced the previous single-tone ringtones. There are currently many polyphonic ringtone file formats, such as MIDI, MMF, AMR, MP3, IMY, etc. Among them, MIDI is the most supported ringtone file format. Its file occupies a small space and has strong expressiveness. It has almost become the standard configuration of polyphonic ringtone mobile phones.


MIDI chord music in mobile phones is achieved by playing MIDI music files through a built-in highly integrated chord chip. The sound synthesis and timbre calling method used by the chord chip determines the playing effect of the ringtone. The early FM (Frequency Modulation) synthesis method combines single tones of multiple frequencies into composite tones to simulate the sounds of various musical instruments, resulting in less timbre and poor sound quality. Another method is the wavetable synthesis method. This method first records the music of various real instruments and then synthesizes it, with good timbre and a wide range of sounds. According to the different wavetable generation methods, it is divided into software chords and hardware chords. Software chords save system overhead compared to hardware chords and are easier to integrate into mobile devices.


There are many chord control chips in the mobile phone market, and the most popular ones are Japan's Yamaha, my country's largest Winbond and Macronix, and mainland China's Vimicro and Zhiduowei. Each company's chord chip has its own characteristics. Among them, Zhiduowei's C520 can support the playback of national musical instruments, so C520 is selected for chord music control.

2 C520 chord chip

C520 is a polyphonic chip from Shanghai Zhiduo Microelectronics Co., Ltd., which is specially used to provide crisp and realistic music ringtones and rich game sound effects for mobile phones. The chip integrates 64 polyphonic, 16-tone wavetable and 21 Chinese folk music, and has MIDI synthesizer with 3D stereo surround enhancement, MIDI GM preset ROM, 16-bit high-performance audio digital-to-analog converter and 2/4-bit ADPCM decoder and other functions.

2.1 Chip Features

Compared with other mobile phone chord chips on the market, C520 has the following features:

① It can synthesize the input MIDI signal through the on-chip music synthesizer, or demodulate the input ADPCM signal through the ADPCM demodulator, and then output the waveform through the built-in DAC.

② It integrates high-quality MIDI GM sound library with a capacity of up to 3 Mb; it provides a sound library of national musical instruments other than the GM sound library, supporting more than 20 national musical instruments such as erhu, guzheng, pipa, etc.; it supports multiple timbres and polyphony - supporting up to 16 timbres and 64 polyphony at the same time.

③ It has multiple function ports, can support mobile phone vibration drive and LCD backlight drive, and can be used to play music synchronized PWM to control colorful lights.

④ The interface with the host can be a parallel interface or a serial interface; the chip is allowed to work in DAC input mode and accept input data compatible with the universal serial DAC data format; the chip integrates FIFOs for different input data; the typical operating current in standby mode is less than 50 μA.

2.2 Functional Unit

The entire chip consists of IOU (I/O interface unit), SG (music synthesizer), ADEC (ADPCM demodulator), TG (clock module) and ANALOG (logic) modules.

IOU completes the interface with the external CPU, controls the internal FIFO and other functional interfaces of the chip; the MIDI data that forms the music and the control commands of the external CPU to the chip are also sent through the registers in the IOU. The SG module takes the MIDI data from the FIFO of the IOU and synthesizes the music by wavetable synthesis. ADEC receives the compressed PCM data, decodes it according to the corresponding control signal, and outputs the decoded 16-bit PCM code to the DSP unit of SG. TG multiplies the input clock and generates the internal clock. ANALOG includes a DAC and an AMP.C520 chip that performs low-pass filtering and power amplification on the output signal of the DAC. The internal structure is shown in Figure 1.


3 Applications

3.1 Typical Circuit

The control CPU uses Samsung's 32-bit RISC chip S3C4510B. This chip is specially developed for embedded Ethernet applications. The core is arm7TDMI, supports the high-code density THUMB instruction set, and is suitable for applications that are sensitive to price and power consumption.

Introduction to polyphonic ringtone design and MIDI music file playback process

Figure 1C520 internal structure diagram

Introduction to polyphonic ringtone design and MIDI music file playback process

Figure 2 Typical application circuit

C520 and S3C4510B can be parallel interface or serial interface, but the parallel interface has faster data transmission speed than the serial interface, so the parallel interface is used in this design. The chip application circuit is shown in Figure 2.

In this circuit, CS_N of C520 is controlled by I/O P0 of S3C4510B. In fact, if the chip select signal line is sufficient, any signal line of ROM/SRAM/Flash chip select signal Nrcs[5∶0] in S3C4510B can be selected, which can save one GPIO; similarly, if you do not want to control the reset of C520, you can connect its reset signal to the reset line nRESET of S3C4510B, so that S3C4510B and C520 will be reset at the same time when powered on; C520 PD pin is the low power state control pin, "1" is the normal working state, "0" is to enter the low power state; C520 IRQ pin is the interrupt output pin, which can be connected to the external interrupt request signal pin XINTREQ[0] of S3C4510B.

3.2 Chip Initialization

The initialization of C520 is very simple, including:

① Set the PLL division ratio according to the external clock. The PLL division ratio is determined by the register CLOCK (read: 10h/write: 11h) and the register Master Clock (read: 18h/write: 19h). The internal clock frequency fsys = fclock (DN+1)/(DM+1). DM is the register CLOCK [4:0], DN is the register Master clock tuning [5:0], fclock is the external input clock, and the internal system clock frequency fsys must be set between 48 MHz and 50 MHz.

② Turn on the analog module and write 0 to bit 3 of the register Analog Power Down (read: 66h/write: 67h).

③ Set Analog Select and select the analog function according to the register Analog Select (read:60h/write:61h).

3.3 Play MIDI music files

C520 can play MIDI files in MIDI FORMAT 0 and MMD formats.

The ASCII value of the first 4 bytes of data in a MIDI FORMAT 0 file is "MThd", and the ASCII value of the first 4 bytes of data in an MMD file is "MMhd". The process of arm sending these two formats of MIDI data is different, and they are distinguished based on the first 4 bytes of data in the file before sending.

Send a MIDI file in MIDI FORMAT 0 format. All data in the file will be sent.

The MMD format file can be divided into four blocks, each of which has an 8-byte header data section at the beginning. The ASCII code value of the first 4 bytes of the first block of header data is "MMhd", the ASCII code value of the first 4 bytes of the second block of header data is "MMly", and the ASCII code value of the first 4 bytes of the third block of header data is "MMdd". The ASCII code value of the first 4 bytes of the fourth block of header data is "MMex". The 5th, 6th, 7th, and 8th bytes of each block of header data are the length of this block of data (excluding the header data). The 5th byte is the low byte, and the 8th byte is the high byte. The hexadecimal data composed of these 4 bytes plus the header data length 8 is the length of this block of data. The header data of the MMdd block of data is followed by compressed MIDI data; the MMly block of data is special data for karaoke, and it is not necessary to send this block when playing MIDI; Mmex is an extended block.

Introduction to polyphonic ringtone design and MIDI music file playback process

Figure 3 MIDI file playback process

When sending MIDI data in MMD format to C520, the MMhd block is sent first, followed by the MIDI data portion of the MMdd block (i.e. the portion of the block excluding the block name and block length), while the MMly block does not need to be sent.

Figure 3 shows the process of playing MIDI files.


Conclusion

This article introduces Zhiduowei's mobile phone polyphonic chip C520, and gives its principle and internal structure diagram. Samsung's RISC chip S3C4510B is used as the controller to achieve the playback of polyphonic music. The article gives a detailed circuit schematic diagram and the process of playing MIDI music files, which can be used as a reference for the application of polyphonic chips in mobile products.


Reference address:Introduction to polyphonic ringtone design and MIDI music file playback process

Previous article:A Brief Discussion on the Types and Structures of Audio Amplifiers
Next article:What is video structuring and what can it do?

Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号