{"id":18330988,"url":"https://github.com/retorillo/sine-wave","last_synced_at":"2025-04-09T18:11:12.957Z","repository":{"id":143799319,"uuid":"140212397","full_name":"retorillo/sine-wave","owner":"retorillo","description":"Sine wave generation playground. Documented things are work in progress, and not guaranteed as proper solutions.","archived":false,"fork":false,"pushed_at":"2018-07-22T01:15:47.000Z","size":581,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T10:46:38.510Z","etag":null,"topics":["sine","sine-wave","sinewave"],"latest_commit_sha":null,"homepage":"","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/retorillo.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,"publiccode":null,"codemeta":null}},"created_at":"2018-07-09T00:23:34.000Z","updated_at":"2022-12-19T15:58:32.000Z","dependencies_parsed_at":"2023-05-03T14:32:02.011Z","dependency_job_id":null,"html_url":"https://github.com/retorillo/sine-wave","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/retorillo%2Fsine-wave","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retorillo%2Fsine-wave/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retorillo%2Fsine-wave/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retorillo%2Fsine-wave/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/retorillo","download_url":"https://codeload.github.com/retorillo/sine-wave/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248085277,"owners_count":21045138,"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":["sine","sine-wave","sinewave"],"created_at":"2024-11-05T19:27:35.341Z","updated_at":"2025-04-09T18:11:12.933Z","avatar_url":"https://github.com/retorillo.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sine Wave\n\nSine wave generation playground. Documented things are work in progress,\nand not guaranteed as proper solutions.\n\n![](app.png)\n\n## Generating Sine Sweep\n\n|    | Description                     | Unit   |\n| -- | ------------------------------- | ------ |\n| x  | current time (starts with 0)    | second |\n| H  | initial frequency               | hertz  |\n| n  | easing factor                   |        |\n| K  | frequency multiplier            |        |\n| D0 | initial frequency duration      | second |\n| D1 | easing duration                 | second |\n| D2 | K-fold frequency duration       | second |\n| D  | wave duration (= D0 + D1 + D2)  | second |\n\nTo change frequency of wave, at first, focus on acceleration of time `e(x)`.\n`e(x)` goes from `1`(current freq.) to `K`(K-fold freq.).\nAnd its integral `E(x)` is described as \"distored time\".\n\n![](sweep/formula_1.png)\n\n`n` provides easing function as follows:\n\n| n    | easeing function    |\n| ---- | ------------------- |\n| 1    | linear ease         |\n| 2    | quadratic ease      |\n| 3    | cubic ease          |\n| 4    | biquadratic ease    |\n| 5    | quintic ease        |\n\n![](sweep/graph_1.gif)\n\nFinally, formula is defined as follows:\n\n![](sweep/formula_2.png)\n\n![](sweep/graph_2.gif)\n\n## Appending wave\n\nPartially generated sine wave does not ends with end of cycle\nunless its last arguments is integral multiple of `2 * PI`, so must remember\nits offset value to append next partial wave,\n\nIf `x` is reset zero for each partial wave, in case that the last sine argument `A` is only provided,\noffset is described as follows:\n\n![](append/formula_1.png)\n\n![](append/graph_1.gif)\n\nOf course, if `fmod` function is avaiable: `offset = fmod(A, 2 * PI)`\n\n## Finalizing wave\n\nAs above mentioned, sine wave does not always ends with end of cycle,\nso must adjust last partial wave duration by additional duration.\nThis operation is called \"finalize\" on this document.\n\nFinalizing algoritm is similar with appending partial wave.\nIn case that the last sine argument `A` and frequency `H` are provided,\nadditional duration can be computed as follows:\n\n![](finalize/formula_1.png)\n\n![](finalize/graph_1.gif)\n\n## License\n\nAuthored by Retorillo\n\nNo Rights Reserved (CC0)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretorillo%2Fsine-wave","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fretorillo%2Fsine-wave","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretorillo%2Fsine-wave/lists"}