{"id":44392307,"url":"https://github.com/eshaz/synaudio-cli","last_synced_at":"2026-02-12T02:53:03.631Z","repository":{"id":317785013,"uuid":"1065582032","full_name":"eshaz/synaudio-cli","owner":"eshaz","description":"A command line tool for aligning and synchronizing two or more audio clips based on their content.","archived":false,"fork":false,"pushed_at":"2025-11-01T22:40:52.000Z","size":1569,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-27T11:02:12.428Z","etag":null,"topics":["analog-audio","audio","hacktoberfest","synchronization"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eshaz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"docs/CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"eshaz"}},"created_at":"2025-09-28T02:33:52.000Z","updated_at":"2025-11-20T12:39:03.000Z","dependencies_parsed_at":"2025-10-03T03:36:45.123Z","dependency_job_id":"5f79c5b6-ae2d-46e7-88a9-bcfd07d3c683","html_url":"https://github.com/eshaz/synaudio-cli","commit_stats":null,"previous_names":["eshaz/synaudio-cli"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/eshaz/synaudio-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eshaz%2Fsynaudio-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eshaz%2Fsynaudio-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eshaz%2Fsynaudio-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eshaz%2Fsynaudio-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eshaz","download_url":"https://codeload.github.com/eshaz/synaudio-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eshaz%2Fsynaudio-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29355544,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T01:03:07.613Z","status":"online","status_checked_at":"2026-02-12T02:00:06.911Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["analog-audio","audio","hacktoberfest","synchronization"],"created_at":"2026-02-12T02:53:02.964Z","updated_at":"2026-02-12T02:53:03.623Z","avatar_url":"https://github.com/eshaz.png","language":"JavaScript","funding_links":["https://github.com/sponsors/eshaz"],"categories":[],"sub_categories":[],"readme":"# `synaudio-cli`\n\nA command line tool for aligning and synchronizing two or more audio clips based on their content.\n\n_Based on [synaudio](https://eshaz.github.io/synaudio)_\n\n## How it works\n\n`synaudio-cli` accepts two files, one `base` file and one `comparison` and writes out a copy of the `comparison` file that is aligned to the start and the speed of the `base` file.\n\n* The first file supplied is the `base`. It is used as the basis of comparison.\n* The second file supplied is the `comparison`. A copy of this file that is synchronized against the `base` will be saved to disk.\n  * These two files supplied should have audio that is similar, but the audio does not need to be an exact match.\n    * _The less similar the audio data is, the less likely a successful match will happen._\n  * Examples:\n    * Two recordings of the same audio taken at different times or with different devices (analog or digital).\n    * Two recordings of the same source, but taken with different microphones, or using a slightly different audio mix.\n    * Two recordings of the same audio, one synced to a video, and another in a separate audio file that was not synced to the video.\n    * Two recordings of an analog tape, one that is synced, but has noise or low fidelity, and another newer recording that is not synced by has higher fidelity.\n    * Two digital recordings of the same audio, but the recordings don't match due to clock miss-match and/or clock drift.\n* The `comparison` file is decoded into small `comparison sample`s that are taken at regular intervals.\n* Each `comparison sample` is then synchronized against the `base` using the [Pearson correlation coefficient](https://en.wikipedia.org/wiki/Pearson_correlation_coefficient) algorithm to determine where each `comparison sample` matches up in the `base` file.\n  * See [synaudio](https://eshaz.github.io/synaudio) for details\n* The difference between each `comparison sample`'s calculated sample offset and actual sample offset is processed through a linear regression and used to synchronize the `comparison` file against the `base`\n  * The `comparison` file is trimmed or padded at the beginning based on the linear regression intercept\n  * The `comparison` file is rate adjusted based on the linear regression slope\n  * (Optional) The `comparison` file is normalized, either as a whole, or as independent channels.\n\n### Example\nThe below visual example is a screenshot from an audio editor of the `base`, `comparison`, and final output `synced` files. This example was generated from two recordings from analog tape, one mono low fidelity recording (`base`) and another stereo high fidelity recording (`comparison`). The image is cut in the middle so the beginning and end of the audio are both visible.\n\n```sh\n$ synaudio-cli --normalize-independent base.ogg comparison.flac\nDecoding files...\nSynchronizing files... 100%\nTrim start 15.36761384342938 Trim end 3530.78 Rate 0.9999550657881119\nAdjusting offset and speed...\nNormalizing each channel...\nEncoding output file... comparison.synced.flac\nDone\n```\n![Sync Example](docs/sync_example.png)\n\n## Installation\n\n### [NPM](https://www.npmjs.com/package/synaudio-cli)\n\n### Pre-requisites\n* [Node.js](https://nodejs.org/en/download) JavaScript runtime\n* [`sox`](https://sourceforge.net/projects/sox/files/sox/14.4.2/) and [`ffmpeg`](https://ffmpeg.org/download.html) audio processing tools\n  * Ensure the `sox`, `ffmpeg`, and `ffprobe` (part of ffmpeg) executables are available in your `PATH` environment variable\n\n### Installing `synaudio-cli`\n* From a terminal, run `npm i -g synaudio-cli`\n\n## Usage\n\n### `$ synaudio-cli base.ogg comparison.flac`\n* Synchronizes `comparison.flac` to align with `base.ogg`\n\n\n### `$ synaudio-cli --normalize-independent base.ogg comparison.flac`\n* Synchronizes `comparison.flac` to align with `base.ogg`, and normalizes each channel of the output file independently\n\n## Options\n\n```\n$ synaudio-cli --help\nindex.js \u003cbase-file\u003e \u003ccomparison-file\u003e\n\nsyncs the \u003ccomparison_file\u003e to the \u003cbase_file\u003e\n\nSync Options: (seconds are rounded to fit the sample rate)\n  -R, --rectify         Rectify the audio before comparing for better cross-correlation  [boolean] [default: true]\n  -T, --rate-tolerance  Duration in seconds describing how much +- the rate might differ from the base file.  [number] [default: 0.5]\n  -L, --sample-length   Duration in seconds of each comparison file sample.  [number] [default: 0.125]\n  -G, --sample-gap      Duration in seconds to skip between samples of the comparison file.  [number] [default: 10]\n  -S, --start-range     Duration in seconds to try to sync before the sample.  [number] [default: 180]\n  -E, --end-range       Duration in seconds to try to sync after the sample.  [number] [default: 60]\n\nOutput Options:\n  -d, --delete-comparison      Delete the original comparison file after successfully syncing.  [boolean] [default: false]\n  -n, --normalize              Normalize the output audio.  [boolean] [default: false]\n  -m, --normalize-independent  Normalize the output audio independently for each channel.  [boolean] [default: false]\n  -e, --encode-options         Encode options supplied to `ffmpeg` when encoding the output file.  [string]\n  -r, --rename-string          String to insert in the synced file before the extension. i.e. comparison.flac -\u003e comparison.synced.flac  [string] [default: \".synced\"]\n\nPositionals:\n  base-file        File used as the base of comparison.  [string]\n  comparison-file  File that will be synced against the base file.  [string]\n\nOptions:\n      --help     Show help  [boolean]\n      --version  Show version number  [boolean]\n  -t, --threads  Number of threads to spawn while comparing audio.  [number] [default: 16]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feshaz%2Fsynaudio-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feshaz%2Fsynaudio-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feshaz%2Fsynaudio-cli/lists"}