{"id":20120401,"url":"https://github.com/asahilinux/speakersafetyd","last_synced_at":"2025-04-08T11:11:12.966Z","repository":{"id":117635155,"uuid":"573266792","full_name":"AsahiLinux/speakersafetyd","owner":"AsahiLinux","description":"Rust speaker safety daemon for Asahi Linux","archived":false,"fork":false,"pushed_at":"2025-03-29T12:08:16.000Z","size":204,"stargazers_count":163,"open_issues_count":4,"forks_count":12,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-01T10:13:57.905Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AsahiLinux.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-12-02T03:51:55.000Z","updated_at":"2025-03-30T17:58:42.000Z","dependencies_parsed_at":"2023-10-15T20:53:13.150Z","dependency_job_id":"1aebb2a6-3858-47ab-9275-0c563fdb1e4e","html_url":"https://github.com/AsahiLinux/speakersafetyd","commit_stats":null,"previous_names":["asahilinux/speakersafetyd"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AsahiLinux%2Fspeakersafetyd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AsahiLinux%2Fspeakersafetyd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AsahiLinux%2Fspeakersafetyd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AsahiLinux%2Fspeakersafetyd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AsahiLinux","download_url":"https://codeload.github.com/AsahiLinux/speakersafetyd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247713264,"owners_count":20983683,"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-11-13T19:19:54.998Z","updated_at":"2025-04-08T11:11:12.947Z","avatar_url":"https://github.com/AsahiLinux.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"## speakersafetyd - a software Smart Amp implementation\nspeakersafetyd is a userspace daemon written in Rust that implements an\nanalogue of the Texas Instruments Smart Amp speaker protection model.\n\nApple Silicon Macs mostly use the Texas Instruments TAS2764 amp chip (codec\nin ALSA parlance), which provides sense lines for the voltage and current across\nthe voice coil of the connected speaker. These codecs are designed to be used\nin embedded applications where device firmware takes this information and uses\nit to protect the speaker from damage. Apple instead implement this as machine-specific\nplugins to the userspace half of CoreAudio. An increasing number of other\nvendors in both the desktop and embedded/Android worlds are choosing to go down a similar\nroute, folding this functionality into proprietary driver/userspace blobs that usually\nalso bundle niceties like EQ (we have a solution for this too, see [asahi-audio](https://github.com/AsahiLinux/asahi-audio)).\nThis puts users at serious risk of permanently destroying their expensive devices if they choose\nto run custom software, such as Asahi Linux or an Open Source Android ROM.\n\nspeakersafetyd is the first (as far as we know) FOSS implementation of a speaker\nprotection model. It solves the problem described above by allowing parties interested\nin compatible devices to quickly and easily implement a speaker protection model for those\ndevices. Only Apple Silicon Macs under Linux are currently supported,\nhowever the model applies to all loudspeakers. The daemon itself should be easy enough to\nadapt for any device that provides V/ISENSE data in a manner similar to TAS2764.\n\n### Dependencies\n* Rust stable\n* alsa-lib\n* An Apple Silicon Mac running Asahi Linux\n* A `speakersafetyd` user in the `audio` group\n\n### Some background on Smart Amps\nThe cheap component speaker elements used in modern devices like\nBluetooth speakers, TVs, laptops, etc. are very fragile. In order\nto eke the highest possible sound quality out of them, they need to be\ndriven *hard*. This leaves us with a dilemma - how do we drive these\nspeakers hard enough to get a loud, high-quality output but not hard\nenough to destroy them?\n\nA speaker's electromechanical characteristics can be modelled\nand boiled down to a set of parameters - the Thiele/Small Parameters.\nThese can be used to predict what the speaker will do with certain\ninputs. When we add measured properties like the time constant of\nthe speaker's voice coil's and magnet's temperature curve, we can\naccurately model a speaker's temperature for any given voltage/current\nacross the coil. When the speaker is getting too hot, we just reduce the\npower going to it until it cools down.\n\nThis lets us fearlessly drive the speakers as hard as they physically can\nbe without being permanently damaged. This is extremely useful, as without it\nthe output level on these devices would have to be hard limited to a very low\nlevel that is known to be safe for the worst possible input. Instead, we can\nsimply duck the output in those cases and allow the speakers to operate at\nfull power where possible.\n\nMany integrated amplifier chips implement this functionality in hardware, as well\nas additional advanced DSP features like compressors and limiters. Texas Instruments\ncall their implementation \"Smart Amp.\" Integrators need only communicate the parameter set\nto the chip for the speaker it is connected to, and it does the rest. Many do not however,\nand instead only provide facilities for measuring the voltage and current across the speaker's\nvoice coil. It is up to the implementer to capture this data and do something with it.\n\nspeakersafetyd is (as far as we know) the first and only FOSS implementation of the\nSmart Amp protection model.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasahilinux%2Fspeakersafetyd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasahilinux%2Fspeakersafetyd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasahilinux%2Fspeakersafetyd/lists"}