{"id":24277467,"url":"https://github.com/toots/shine","last_synced_at":"2025-04-04T10:10:04.088Z","repository":{"id":65145336,"uuid":"5116893","full_name":"toots/shine","owner":"toots","description":"Super fast fixed-point MP3 encoder with JS/wasm and android native bindings.","archived":false,"fork":false,"pushed_at":"2023-12-01T07:09:13.000Z","size":1899,"stargazers_count":400,"open_issues_count":15,"forks_count":65,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-03-28T09:05:50.816Z","etag":null,"topics":["android","audio","fixed-point","mp3","wasm"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toots.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"COPYING","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":"2012-07-19T23:24:18.000Z","updated_at":"2025-02-21T10:23:49.000Z","dependencies_parsed_at":"2025-01-15T23:58:50.600Z","dependency_job_id":"d6b9745d-2bb5-4da8-bdd5-340110bff543","html_url":"https://github.com/toots/shine","commit_stats":{"total_commits":279,"total_committers":14,"mean_commits":"19.928571428571427","dds":"0.22939068100358428","last_synced_commit":"ab5e3526b64af1a2eaa43aa6f441a7312e013519"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toots%2Fshine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toots%2Fshine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toots%2Fshine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toots%2Fshine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toots","download_url":"https://codeload.github.com/toots/shine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157046,"owners_count":20893202,"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":["android","audio","fixed-point","mp3","wasm"],"created_at":"2025-01-15T23:57:29.942Z","updated_at":"2025-04-04T10:10:04.049Z","avatar_url":"https://github.com/toots.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Shine: fast fixed-point mp3 encoding\n====================================\n\n[shine](https://github.com/savonet/shine) is a blazing fast mp3 encoding library implemented in \nfixed-point arithmetic. The library can thus be used to perform super fast mp3 encoding on architectures\nwithout a FPU, such as `armel`, etc.. It is also super fast on architectures with a FPU!\n\nHow to use?\n-----------\n\nThe encoding API should be quite straight forward:\n\n```c\n#include \u003cshine/layer3.h\u003e\n  \n(...)\n\n/* See if samplerate and bitrate are valid */\nif (shine_check_config(config.wave.samplerate, config.mpeg.bitr) \u003c 0)\n  error(\"Unsupported samplerate/bitrate configuration.\");\n\n/* Initiate encoder */\ns = shine_initialise(\u0026config);\n\n/* Number of samples (per channel) to feed the encoder with. */\nint samples_per_pass = shine_samples_per_pass(s);\n\n/* All the magic happens here */\nwhile (read(buffer, infile, samples_per_pass)) {\n  data = shine_encode_buffer(s,buffer,\u0026written);\n  write(data, written);\n}\n\n/* Flush and write remaining data. */\ndata = shine_flush(s,\u0026written);\nwrite(written, data);\n\n/* Close encoder. */\nshine_close(s);\n```\n\nHow fast is it?\n---------------\n\nOn a macbook pro (`arm64`/M1 pro, `FPU`, December 30, 2022):\n\nLame, `88.7x` realtime:\n```bash\nLAME 3.100 64bits (http://lame.sf.net)\nUsing polyphase lowpass filter, transition band: 16538 Hz - 17071 Hz\nEncoding /tmp/decoded.wav to /tmp/lame.mp3\nEncoding as 44.1 kHz j-stereo MPEG-1 Layer III (11x) 128 kbps qval=3\n    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA\n 12203/12203 (100%)|    0:03/    0:03|    0:04/    0:04|   88.773x|    0:00\n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n   kbps        LR    MS  %     long switch short %\n  128.0       32.6  67.4        96.4   1.9   1.7\nWriting LAME Tag...done\nReplayGain: -9.3dB\nlame -b 128 /tmp/decoded.wav /tmp/lame.mp3  3.55s user 0.05s system 99% cpu 3.609 total\n```\n\nShine, `318.0x` realtime:\n```\nshineenc (Liquidsoap version)\nWAVE PCM Data, stereo 44100Hz 16bit, duration: 00:05:18\nMPEG-I layer III, stereo  Psychoacoustic Model: Shine\nBitrate: 128 kbps  De-emphasis: none   Original\nEncoding \"/tmp/bla.wav\" to \"/tmp/shine.mp3\"\nFinished in 00:00:01 (318.0x realtime)\n```\n\n### ⚠ The following are outdated tests ⚠\n\nOn a [Raspberry Pi](http://www.raspberrypi.org/) (`ARM`, `FPU`):\n\nLame, `1.8x` realtime:\n```bash\npi@raspberrypi ~ $ lame bla.wav bla.mp3\nLAME 3.99.5 32bits (http://lame.sf.net)\nUsing polyphase lowpass filter, transition band: 16538 Hz - 17071 Hz\nEncoding bla.wav to bla.mp3\nEncoding as 44.1 kHz j-stereo MPEG-1 Layer III (11x) 128 kbps qval=3\n    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA\n 12987/12987 (100%)|    3:06/    3:06|    3:06/    3:06|   1.8216x|    0:00\n-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n   kbps        LR    MS  %     long switch short %\n  128.0        0.1  99.9        89.1   6.1   4.9\nWriting LAME Tag...done\nReplayGain: -10.5dB\n```\n\nShine, `3.6x` realtime:\n```bash\npi@raspberrypi ~ $ shineenc bla.wav bla.mp3\nshineenc (Liquidsoap version)\nWAVE PCM Data, stereo 44100Hz 16bit, duration: 00:05:39\nMPEG-I layer III, stereo  Psychoacoustic Model: Shine\nBitrate: 128 kbps  De-emphasis: none   Original\nEncoding \"bla.wav\" to \"bla.mp3\"\nFinished in 00:01:35 (3.6x realtime)\n```\n\nOn a Google Nexus 5 (`ARM`, `FPU`):\n\nShine, `14s`, `24.2x` realtime:\n```bash\nu0_a65@hammerhead:/mnt/sdcard $ shineenc bla.wav bla.mp3\nshineenc (Liquidsoap version)\nWAVE PCM Data, stereo 44100Hz 16bit, duration: 00:05:39\nMPEG-I layer III, stereo  Psychoacoustic Model: Shine\nBitrate: 128 kbps  De-emphasis: none   Original\nEncoding \"bla.wav\" to \"bla.mp3\"\nFinished in 00:00:14 (24.2x realtime)\n```\n\nLimitations\n-----------\n\nThe code for the encoder has been written a long time ago (see below) and \nthe only work done on this fork consists of reorganizing the code and making a \nproper shared API out of it. Thus, the encoder may not be exempt of bugs.\n\nAlso, the encoding algorithm is rather simple. In particular, it does not\nhave any Psychoacoustic Model.\n\nA bit of history\n----------------\n\nThis code was dug out from the dusty crates of those times before internet \nand github. It apparently was created by Gabriel Bouvigne sometime around \nthe end of the 20th century. The encoder was converted circa 2001 by Pete \nEverett to fixed-point arithmetic for the RISC OS. Last we know, Patrick \nRoberts had worked on the code to make it multi-platform and more library\noriented. That was around 2006.\n\nYou can consult `README.old` and the various source files for more \ninformations on this code.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoots%2Fshine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoots%2Fshine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoots%2Fshine/lists"}