Digital implementation method and device of volume control circuit and storage medium
The volume control is realized through digital circuits, and the gain matching and amplitude transformation methods are adopted to solve the problem of large area overhead in the simulation method, realizing the effect of saving logical resources and simple control structure.
Patent Information
- Application Number
- CN202510257326.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-05
- Publication Date
- 2025-07-18
AI Technical Summary
In the prior art, the use of analog methods for volume adjustment in integrated circuits results in a large area overhead, and a more efficient digital implementation method is needed.
The volume control method is implemented using a digital circuit. By matching the volume gain with the left and right channels gain register encoding, the gain components are obtained, the volume preprocessing is performed, and the original volume signal is multiplied and added. The amplitude of the original volume signal is transformed to simplify the logical resource overhead.
It realizes logical resource saving and small area overhead, simple control structure, and is suitable for volume control of digital circuits.
Smart Images

Figure CN120342347A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of audio SoC systems, and particularly relates to a digital implementation method, device, and storage medium for a volume control circuit. Background Art
[0002] Generally, volume adjustment is performed using analog methods such as resistor voltage division circuits and field effect transistors. If this method is used in integrated circuits, it is often limited by the process, resulting in a relatively large area overhead.
[0003] Therefore, it is necessary to provide a new method to solve the above technical problems. Summary of the Invention
[0004] To achieve the above objects and other advantages of the present invention, a first object of the present invention is to provide a digital implementation method for a volume control circuit, including the following steps:
[0005] Match the left and right channel gain register encodings according to the volume gain;
[0006] Obtain the gain components at the current gain corresponding to the left and right channel gain register encodings;
[0007] Perform volume preprocessing on the input audio signal to obtain volume components;
[0008] Multiply the gain components by the corresponding volume components, and add the product results of each component to obtain the audio output result.
[0009] Further, the gain components at the current gain are configured as 10 components.
[0010] Further, the values of the gain components are configured as 0 or 1.
[0011] Further, the values of 10 gain components are stored in the current gain array.
[0012] Further, the volume components are configured as 10 components.
[0013] Further, in the order from small to large of the gain components, the values of the corresponding volume components are successively multiplied by 2 times from one of 128 of the original volume.
[0014] Further, the volume gain adjustment range is from -23dB to 17dB, and an additional set of mute controls is added.
[0015] Further, in the order of increasing volume gain starting from mute, the left and right channel gain register encodings increase successively from 0 in hexadecimal numbers.
[0016] The second object of the present invention is to provide a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of the above method are implemented.
[0017] The third object of the present invention is to provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.
[0018] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0019] The present invention provides a volume control method suitable for digital circuit implementation. The amplitude of the original volume signal is transformed using powers of 2, which is equivalent to just truncating or padding zeros to the original volume signal. Only the bits of the original volume are tapped out, without any complex logic overhead, which can save logic resources, have a small area overhead, and a simple control structure.
[0020] The above description is only an overview of the technical solution of the present invention. In order to be able to understand the technical means of the present invention more clearly and implement it in accordance with the content of the specification, the following takes the preferred embodiments of the present invention and combines with the accompanying drawings to describe in detail as follows. The specific implementation manners of the present invention are given in detail by the following embodiments and their accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings described herein are used to provide a further understanding of the present invention, and form a part of this application. The illustrative embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings:
[0022] Figure 1 is a flowchart of the digital implementation method of the volume control circuit;
[0023] Figure 2 is a system block diagram;
[0024] Figure 3 is a schematic diagram of a computer device;
[0025] Figure 4 is a schematic diagram of a computer-readable storage medium. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0026] Next, in combination with the accompanying drawings and specific implementation manners, the present invention will be further described. Obviously, the described embodiments are some embodiments of the present invention, rather than all embodiments. It should be noted that, on the premise of non-conflict, the following-described embodiments or technical features can be arbitrarily combined with each other to form new embodiments.
[0027] Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making any creative work shall fall within the scope of protection of the present invention.
[0028] The figure numbers in this application are only used to distinguish the various steps in the scheme, and are not used to limit the execution order of the various steps. The specific execution order is subject to the description in the specification.
[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0030] Example 1
[0031] A digital implementation method of a volume control circuit, such as Figure 1 As shown, the following steps are included:
[0032] S1, matching left and right channel gain register codes according to volume gain;
[0033] In this embodiment, Figure 2 As shown, the APB register receives the left and right channel gain register encoding and volume amplitude calculation unit configured by the software from the interface.
[0034] After the volume gain is determined according to user needs, the corresponding left and right channel gain register codes can be matched.
[0035] In some embodiments, the volume gain adjustment range is from -23dB to 17dB, and an additional set of mute controls is added to adjust the volume to a mute state.
[0036] It should be noted that the volume gain adjustment range can be increased or decreased according to actual needs, and the above volume gain adjustment range is only a preferred range.
[0037] Further, in the order in which the volume gain increases from mute, the left and right channel gain register codes are encoded in hexadecimal numbers starting from 0 and increasing in sequence. That is, the left and right channel gain register codes corresponding to the mute state are 0x0, the left and right channel gain register codes corresponding to -23dB are 0x1, ..., and the left and right channel gain register codes corresponding to 17dB are 0x29.
[0038] This embodiment uses the power of 2 to transform the amplitude of the original volume signal, which is equivalent to just truncating or zero-filling the original volume signal, and just tapping out the bits of the original volume without any complex logic overhead. The volume amplitude is calculated using an adder, and the method of selecting coef first and then adding can save logic resources.
[0039] S2. Obtain the gain components at the current gain corresponding to the left and right channel gain register codes;
[0040] In some embodiments, the gain components at the current gain are configured as 10 components.
[0041] Further, the values of the gain components are configured as 0 or 1.
[0042] Further, the values of the 10 gain components are stored in the current gain array. In this embodiment, coef[9:0] is used to store the values of the gain components at the current gain.
[0043] Specifically, according to the left and right channel gain register codes, the values of coef[9:0] can be matched. coef represents which gain component is 1 and which is 0 at the current gain. Taking the left and right channel gain register code equal to 0x3 as an example, coef[0]=1, coef[1]=1, coef[3]=1, and the rest of the coef are 0.
[0044] S3. Perform volume preprocessing on the input audio signal to obtain volume components;
[0045] In some embodiments, the volume components are configured as 10 components.
[0046] Further, in the order of the gain components from small to large, the values of the corresponding volume components are successively multiplied by 2 times the frequency from one of the 128 of the original volume.
[0047] Let the volume components be represented by parameters a, b, c, d, e, f, g, h, i, j. coef[0] to coef[9] correspond to a to j respectively. a = original volume / 128, b = original volume / 64, c = original volume / 32, d = original volume / 16, e = original volume / 8, f = original volume / 4, g = original volume / 2, h = original volume * 1, i = original volume * 2, a = original volume * 4.
[0048] In this embodiment, the volume gain, left and right channel gain register codes, gain components, and volume components are shown in the following table.
[0049]
[0050]
[0051] S4. Multiply the gain components by the corresponding volume components, and add the product results of each component to obtain the audio output result.
[0052] The specific calculation formula is:
[0053] S = j * coef[9] + i * coef[8] + h * coef[7] + g * coef[6] + f * coef[5] + e * coef[4] + d * coef[3] + c * coef[2] + b * coef[1] + a * coef[0].
[0054] As Figure 2 shown, it is designed and completed using modules such as asynchronous FIFO, APB general register interface, adder, selector, etc., and is written in Verilog language.
[0055] The present invention provides a volume control method suitable for digital circuit implementation, which performs amplitude transformation on the original volume signal using powers of 2, which is equivalent to only truncating or padding zeros to the original volume signal. Only the individual bits of the original volume are tapped out, without any complex logic overhead, which can save logic resources, have a small area overhead, and have a simple control structure.
[0056] Embodiment 2
[0057] A computer device 500, as Figure 3 shown, includes a memory 510, a processor 520, and a computer program 530 stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of a digital implementation method of a volume control circuit. For a detailed description of the method, reference can be made to the corresponding description in the above method embodiments, which will not be elaborated here.
[0058] Embodiment 3
[0059] A computer-readable storage medium, as Figure 4 shown, stores a computer program thereon. When the computer program is executed by a processor, it implements the steps of a digital implementation method of a volume control circuit. For a detailed description of the method, reference can be made to the corresponding description in the above method embodiments, which will not be elaborated here.
[0060] The number of devices and the scale of processing described here are used to simplify the description of the present invention. Applications, modifications, and variations of the present invention are obvious to those skilled in the art.
[0061] Although the embodiments of the present invention have been disclosed as above, it is not limited to the applications listed in the specification and embodiments. It can be fully applied to various fields suitable for the present invention. For those familiar with the field, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the equivalent scope, the present invention is not limited to the specific details and the illustrated and described examples here.
[0062] The device, computer device, non-volatile computer storage medium, and method provided by the embodiments of this specification are corresponding. Therefore, the device, computer device, and non-volatile computer storage medium also have beneficial technical effects similar to those of the corresponding method. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the corresponding device, computer device, and non-volatile computer storage medium will not be elaborated here.
[0063] Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program code, the method steps can be logically programmed to enable the controller to implement the same function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Therefore, such a controller can be regarded as a hardware component, and the devices included therein for implementing various functions can also be regarded as the structures within the hardware component. Or even, the devices for implementing various functions can be regarded as either software units for implementing the method or structures within the hardware component.
[0064] The systems, devices, or units illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are described by dividing them into various units according to their functions. Of course, when implementing one or more embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0065] Those skilled in the art should understand that the embodiments of this specification can be provided as a method, system, or computer program product. Therefore, the embodiments of this specification can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program code.
[0066] This specification is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the specified functions in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0067] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce a manufacture including an instruction device that implements the functions specified in one or more processes and / or blocks Figure 1 in one or more processes and / or blocks Figure 1 specified in one or more blocks or a plurality of blocks.
[0068] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, so that the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in one or more processes and / or blocks Figure 1 in one or more processes and / or blocks Figure 1 specified in one or more blocks or a plurality of blocks.
[0069] It should also be noted that the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, such that a process, method, article or apparatus comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or apparatus. Without further limitation, an element qualified by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising the element.
[0070] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program units. Generally, program units include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in a distributed computing environment where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program units may be located in both local and remote computer storage media including storage devices.
[0071] Each embodiment in this specification is described in a progressive manner, and the same or similar parts among the embodiments may be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, it is described relatively simply, and the relevant parts may refer to the description of the method embodiment.
[0072] The above is only for the embodiments of this specification and is not intended to limit one or more embodiments of this specification. For those skilled in the art, various changes and modifications can be made to one or more embodiments of this specification. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of this specification shall be included within the scope of the claims of one or more embodiments of this specification.
Claims
1. A digital implementation method of a volume control circuit, characterized in that Including the following steps: Match the left and right channel gain register encodings according to the volume gain; Obtain the gain components at the current gain corresponding to the left and right channel gain register encodings; Perform volume preprocessing on the input audio signal to obtain volume components; Multiply the gain components by the corresponding volume components, and add the product results of each component to obtain the audio output result.
2. The digital implementation method of a volume control circuit according to claim 1, characterized in that: The gain components at the current gain are configured as 10 components.
3. The digital implementation method of a volume control circuit as described in claim 2, characterized in that: The values of the gain components are configured as 0 or 1.
4. The digital implementation method of a volume control circuit according to claim 3, characterized in that: The values of the 10 gain components are stored in the current gain array.
5. The digital implementation method of a volume control circuit according to claim 2, characterized in that, The volume components are configured as 10 components.
6. The digital implementation method of a volume control circuit as claimed in claim 5, characterized in that: In the order of the gain components from small to large, the values of the corresponding volume components are multiplied by 2 times in sequence from one of 128 of the original volume.
7. The digital implementation method of a volume control circuit according to claim 1, characterized in that: The volume gain adjustment range is from -23dB to 17dB, and an additional set of mute controls is added.
8. The digital implementation method of a volume control circuit according to claim 7, characterized in that: In the order of the volume gain increasing from mute, the left and right channel gain register encodings increase sequentially from 0 using hexadecimal numbers.
9. A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 8.