{"id":17928592,"url":"https://github.com/alifeee/audio-experiments","last_synced_at":"2026-05-01T13:32:43.878Z","repository":{"id":220561803,"uuid":"751967490","full_name":"alifeee/audio-experiments","owner":"alifeee","description":"alifeee screws with audio","archived":false,"fork":false,"pushed_at":"2026-03-11T00:11:40.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-11T05:43:09.340Z","etag":null,"topics":["ffmpeg","lame","lua","mp3","pcm"],"latest_commit_sha":null,"homepage":"","language":"Lua","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/alifeee.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-02T18:10:19.000Z","updated_at":"2026-03-11T00:11:43.000Z","dependencies_parsed_at":"2024-02-02T19:29:40.507Z","dependency_job_id":"701ce379-932b-41f6-9acd-90b2911a5b3b","html_url":"https://github.com/alifeee/audio-experiments","commit_stats":null,"previous_names":["alifeee/audio-experiments"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alifeee/audio-experiments","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alifeee%2Faudio-experiments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alifeee%2Faudio-experiments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alifeee%2Faudio-experiments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alifeee%2Faudio-experiments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alifeee","download_url":"https://codeload.github.com/alifeee/audio-experiments/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alifeee%2Faudio-experiments/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32499681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"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":["ffmpeg","lame","lua","mp3","pcm"],"created_at":"2024-10-28T21:04:13.819Z","updated_at":"2026-05-01T13:32:43.869Z","avatar_url":"https://github.com/alifeee.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!CAUTION]\n\u003e MOVED! see \u003chttps://git.alifeee.net/audio-experiments/about/\u003e\n# alifeee screws with audio\n\nPlaying around with audio files. Mainly [PCM](https://en.wikipedia.org/wiki/Pulse-code_modulation) (Pulse Code Modulation) files, which are just raw audio bytes (samples).\n\nIn my simple imagination, they are just a list of bytes, representing samples (for mono audio).\n\n![Screenshot of audio samples from Audacity](images/pcm_file_visualised.png)\n\nPCM files need metadata to be useful, i.e., Encoding (signed/unsigned, 8/16/etc bits), byte order (big/little endian), channels, sample rate (e.g., 44 kHz).\n\n![Raw file import dialogue in Audacity](images/audacity_raw_file_import.png)\n\n## `MP3` → `PCM`\n\nYou can use FFmpeg with the format/encoding \"s16le\" (signed-16bit-littleendian):\n\n```bash\nffmpeg -i in.mp3 -y -f s16le -c:a:1 pcm_s16le out.pcm\n```\n\nTo list format/codecs, use\n\n```bash\nffmpeg -formats | grep \"PCM\"\nffmpeg -codecs | grep \"PCM\"\n```\n\n## `PCM` → `MP3`\n\nUsing [lame](https://linux.die.net/man/1/lame),\n\nThe following command writes an `mp3` file with:\n\n- 44.1khz sampling\n- 2 bytes (16 bit) per sample\n- little endian bit order\n- mono audio mode\n\n```bash\nlame -r -s 44.1 --bitwidth 16 --little-endian -m m out.pcm\n```\n\n## Screwing with audio\n\nHere begin the experiments. I mainly use Lua to screw with the raw audio data. Here are some examples. See the rest in the filesystem\n\n| file | what it does |\n| --- | --- |\n| [`bitrate_halfer.lua`](./bitrate_halfer.lua) | This halves the audio bitrate. The way I do it is reading the file, and only writing every other byte to the output. |\n| [`volume_doubler.lua`](./bitrate_halfer.lua) | This doubles the audio volume. The way I do it is reading the file, and writing each byte with value * 2. They will be truncated if they start too loud (i.e., half max volume). |\n| [`signal_averager.lua`](./signal_averager.lua) | This takes a rolling median of the audio signal. It mainly makes things sound super muffled |\n\nTo do the whole process at once (screw with audio and turn into mp3), you can use a command similar to this:\n\n```bash\ncat out.pcm | lua signal_averager.lua │ lame -r -s 44.1 --bitwidth 16 --little-endian -m m \"-\" out_modified.mp3\n```\n\n## Converting files to audio\n\nThere is no reason the file has to *start* life as an audio file. For example, what does this GitHub page sound like?\n\n```bash\ncurl https://github.com/alifeee/audio-experiments | lua signal_averager.lua 50 | lame -r -s 44.1 --bitwidth 16 --little-endian -m m \"-\" github.mp3\n```\n\nWe can play with the sample rate and bit width to make it sounds more \"underwater-y\":\n\n```bash\ncurl https://github.com/alifeee/audio-experiments | lua signal_averager.lua 50 | lame -r -s 1 --bitwidth 8 --little-endian -m m \"-\" github.mp3\n```\n\nor \"machine-gun-y\":\n\n```bash\ncurl https://github.com/alifeee/audio-experiments | lame -r -s 15 --bitwidth 8 --little-endian -m m \"-\" github.mp3\n```\n\nWhat does this README sound like?\n\n```bash\ncurl https://raw.githubusercontent.com/alifeee/audio-experiments/main/README.md | lua signal_averager.lua 50 | lame -r -s 1 --bitwidth 8 --little-endian -m m \"-\" readme.mp3\n```\n\nTruly the possibilities are endless.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falifeee%2Faudio-experiments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falifeee%2Faudio-experiments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falifeee%2Faudio-experiments/lists"}