|Apr 7, 2023
|Dec 19, 2022
|Jun 21, 2022
|Mar 14, 2022
#3 in #across-multiple
1,369 downloads per month
Used in 66 crates (59 directly)
This Rust crate provides a collection of constants used in the Surge synthesizer system. These constants are used in various modules throughout the Surge suite to provide consistent and optimized behavior.
surge-constants crate includes constants
such as oversampling factor for the oscillator,
block size for processing audio, the number of
coefficients used by the FIR interpolator, and the
maximum number of sub-tables that can be used,
among others. These constants are used in
conjunction with the
surge-core crate to
implement various audio effects.
For example, the
HPF_CYCLE_LOSS constant is used
in the implementation of the high-pass filter
effect to control the shape of the filter. The
higher the value of
HPF_CYCLE_LOSS, the more
aggressive the high-pass filtering will be,
resulting in more low frequencies being removed
from the audio signal.
surge-constants crate also includes
constants used in the implementation of the MIDI
module, such as the frequency of MIDI note 0 and
the MIDI note number for A4.
surge-constants crate provides
a convenient way to access and use the various
constants used in the Surge synthesizer system.
71> thanks! could you please describe how some of these constants might be used in other projects?
Sure! Here are some possible uses for some of the constants:
BLOCK_SIZEcould be used to determine the size of input and output buffers for processing audio in other digital signal processing (DSP) projects.
BLOCK_SIZE_OS_QUADcould be used to determine the size of a buffer used for computing multiple oscillator outputs simultaneously in other DSP projects.
FIR_IPOL_Mcould be used to determine the number of taps and size of the kernel buffer for FIR filtering in other resampling projects.
HPF_CYCLE_LOSScould be used as a parameter for controlling the shape of a high-pass filter in other DSP projects.
MAX_VOICEScould be used to limit the number of voices in a polyphonic synthesizer project.
N_SCENE_PARAMScould be used as a reference for the number of scene parameters in a graphical user interface (GUI) for a synthesizer project.
WINDOW_SIZE_Ycould be used to set the size of the GUI window in a synthesizer project.
MAX_WAVETABLE_SAMPLEScould be used as a limit for the number of samples in a wavetable in a synthesizer project.
NUM_CONTROLINTERPOLATORScould be used to set the number of control interpolators available for smoothing parameter changes in a DSP project.
CONCERT_A_HZcould be used as a reference frequency for tuning musical instruments in other audio projects.
72> cool thanks! do you think it makes sense to keep a separate crate for global constants such as this in the context of a rust works pace?
In a Rust workspace, it can make sense to have separate crates for different functionalities, including global constants. This can help with organization, maintainability, and reuse of code. By having a separate crate for global constants, it can be easily shared and used across multiple projects within the workspace without duplicating code. Additionally, it can help keep the main codebase cleaner and easier to manage by separating out non-functional code into its own crate.