{"id":13732088,"url":"https://github.com/themattrosen/cute_dsp","last_synced_at":"2025-05-08T06:31:19.014Z","repository":{"id":147182243,"uuid":"186084476","full_name":"themattrosen/cute_dsp","owner":"themattrosen","description":"Utility library for cute_sound.","archived":false,"fork":false,"pushed_at":"2021-05-29T21:14:06.000Z","size":4383,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-02T19:21:30.472Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/themattrosen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-05-11T03:46:57.000Z","updated_at":"2024-03-14T03:26:13.000Z","dependencies_parsed_at":"2024-01-31T04:13:15.335Z","dependency_job_id":"ebfa3608-6871-4db6-9b9a-e617ab20959c","html_url":"https://github.com/themattrosen/cute_dsp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themattrosen%2Fcute_dsp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themattrosen%2Fcute_dsp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themattrosen%2Fcute_dsp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themattrosen%2Fcute_dsp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/themattrosen","download_url":"https://codeload.github.com/themattrosen/cute_dsp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213757415,"owners_count":15634168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T02:01:46.002Z","updated_at":"2024-11-14T23:31:06.871Z","avatar_url":"https://github.com/themattrosen.png","language":"C","funding_links":[],"categories":["Multimedia"],"sub_categories":[],"readme":"# cute_dsp\n\ncute_dsp is a C API for various DSP effects suitable for video games and\nmeant to interface directly with the cute_sound library created by Randy Gaul.\nThe scope of cute_dsp will eventually include:\n\n* Lowpass filter\n* Highpass filter\n* White noise injection\n* Lowpass filtering with resonances\n* Wind noise presets for resonant filters\n* Realtime reverb\n* Echo filter\n* Randomization settings\n* Filter presets\n\n## Implemented Features\n\n### Lowpass Filtering\nUses a second order Butterworth filter with a 6dB per octave rolloff, with added resonance. \n\n### Highpass Filtering\nUses a second order Butterworth filter with a 6dB per octave rolloff, converted from the lowpass filter equation, without resonance.\n\n### Echo Filtering\nUses two ring buffers for delay of input and output samples. There are three designable parameters:\n \n* Delay time\n* Mix factor (echo loudness)\n* Feedback factor (amount that echoes feedback into themselves)\n\n### Noise Generator\nGenerates white noise and adds to a signal. The signal path of cute_dsp allows this white noise to be fed into other filters in the signal chain. The white noise is generated using a xorshift128 PRNG. \n\n## Usage\ncute_dsp must be used concurrently with cute_sound. \n  \nTo set up cute_dsp, `#include \"cute_dsp.h\"` somewhere below your include for cute_sound.h.\nAbove the include to cute_dsp, there must be one place where you `#define CUTE_DSP_IMPLEMENTATION`.\n  \n### cd_context_t\nAfter creating your `cs_context_t` cute sound context, you will need to create a cute_dsp context.\n\n```cpp\ncs_context_t* sound_context = cs_make_context(...);\n\ncd_context_def_t dsp_context_definition; // statically create dsp context\n\n// set the max number of mixers\ndsp_context_definition.playing_pool_count = num_elements_in_playing_pool;\n\n// set dsp sampling rate\ndsp_context_definition.sampling_rate = (float)frequency;\n\n// set which filters you would like to use and some optional parameters\ndsp_context_definition.use_highpass = 1;\ndsp_context_definition.use_lowpass = 1;\ndsp_context_definition.use_echo = 0;\ndsp_context_definition.use_noise = 1;\ndsp_context_definition.echo_max_delay_s = 0.f;\ndsp_context_definition.rand_seed = 2;\n\n// allocate the context\ncd_context_t* dsp_context = cd_make_context(dsp_context_definition);\n\n//...\n\n// at the end of the application, after shutting down the sound context, release the dsp context\ncs_shutdown_context(sound_context);\ncd_release_context(\u0026dsp_context);\n```\nFor each sound played using cute_sound, there will be a copy of each filter you've enabled added as a cute_sound plugin. However, the filter will by default set its internal values such that the effect of the filter is not audible. I.e. if you've enabled lowpass filters in `cd_context_def_t`, then each sound played using cute_sound will have an instance of a lowpass filter. That lowpass filter will have its cutoff frequency at 20kHz, therefore negating its effect.\n  \n### cd_lowpass_t/cd_highpass_t\nTo modify the cutoff frequencies of the lowpass/highpass filters:\n```cpp\nvoid cd_set_lowpass_cutoff(cs_playing_sound_t* playing_sound, float cutoff_in_hz);\nvoid cd_set_lowpass_resonance(cs_playing_sound_t* playing_sound, float resonance);\nvoid cd_set_highpass_cutoff(cs_playing_sound_t* playing_sound, float cutoff_in_hz);\n\nfloat cd_get_lowpass_cutoff(const cs_playing_sound_t* playing_sound);\nfloat cd_get_lowpass_resonance(const cs_playing_sound_t* playing_sound);\nfloat cd_get_highpass_cutoff(const cs_playing_sound_t* playing_sound);\n```\nCutoff frequency is limited to the range of frequencies able to be heard by humans, [20, 20,000] Hz.\nResonance is limited to the range of [0, 1].\n\n### cd_echo_t\nTo modify the parameters of the echo filter:\n```cpp\nvoid cd_set_echo_delay(cs_playing_sound_t* playing_sound, float t);\nvoid cd_set_echo_mix(cs_playing_sound_t* playing_sound, float a);\nvoid cd_set_echo_feedback(cs_playing_sound_t* playing_sound, float b);\n\nfloat cd_get_echo_delay(const cs_playing_sound_t* playing_sound);\nfloat cd_get_echo_mix(const cs_playing_sound_t* playing_sound);\nfloat cd_get_echo_feedback(const cs_playing_sound_t* playing_sound);\nfloat cd_get_echo_max_delay(const cs_playing_sound_t* playing_sound);\n```\n\n### cd_noise_t\nTo modify the parameters of the noise generator:\n```cpp\nvoid cd_set_noise_amplitude_db(cs_playing_sound_t* playing_sound, float db);\nvoid cd_set_noise_amplitude_gain(cs_playing_sound_t* playing_sound, float gain);\n\nfloat cd_get_noise_amplitude_db(const cs_playing_sound_t* playing_sound);\nfloat cd_get_noise_amplitude_gain(const cs_playing_sound_t* playing_sound);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemattrosen%2Fcute_dsp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthemattrosen%2Fcute_dsp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemattrosen%2Fcute_dsp/lists"}