{"id":16002941,"url":"https://github.com/soreing/audio-adpcm-cpp","last_synced_at":"2025-03-27T11:32:15.411Z","repository":{"id":110409715,"uuid":"399517556","full_name":"Soreing/audio-adpcm-cpp","owner":"Soreing","description":"A simple lossy compression library for WAV files written in C++. ","archived":false,"fork":false,"pushed_at":"2021-08-25T17:31:47.000Z","size":122,"stargazers_count":13,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T17:45:35.805Z","etag":null,"topics":["adpcm","audio","compression","cpp"],"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/Soreing.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":"2021-08-24T15:31:41.000Z","updated_at":"2025-03-23T14:49:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"d612b1a2-0560-4605-8f73-ba3007a4534a","html_url":"https://github.com/Soreing/audio-adpcm-cpp","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/Soreing%2Faudio-adpcm-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soreing%2Faudio-adpcm-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soreing%2Faudio-adpcm-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soreing%2Faudio-adpcm-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Soreing","download_url":"https://codeload.github.com/Soreing/audio-adpcm-cpp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245836334,"owners_count":20680357,"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":["adpcm","audio","compression","cpp"],"created_at":"2024-10-08T10:05:10.718Z","updated_at":"2025-03-27T11:32:15.404Z","avatar_url":"https://github.com/Soreing.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# audio-adpcm-cpp\n\n# Description\naudio-adpcm-cpp is a lossy audio compression c++ library for WAVE files. The compression uses ADPCM algorithm outlined by the Interactive Multimedia Association (IMA). The algorithm compresses WAVE files to 25% of their size.  \n\n# Installation\nAdd the folder `adpcm-lib` from `/include` in your include path. If you want to compile the library from source, include `wave.cpp` and `adpcm.cpp` from the `/src` folder. Alternatively, you can compile the source code to a static library and include it that way.\n\n`Source.cpp` is an implementation to use the library as a command in the command line terminal with arguments.\n\n# Basic Usage\n## Compression\nThe library can compress WAVE files that have at most 2 channels (Mono and Stereo), and 16-bit sample size. Once you opened and read a WAVE file, you need the WAVE header and a pointer to the samples located in the data subchunk.\n```c++\nWAVEHeader wav;\nifstream in(fileName, ios::binary);\n\nin.read((char*)\u0026wav, sizeof(WAVEHeader));\n\nchar* samples = new char[wav.subchunk2Size];\nin.read(samples, wav.subchunk2Size);\n```\nYou will also need an array to store the compressed samples in, and an ADPCM header structure that will be filled during the compression. You can use the WAVE header to get how many bytes of space the compressed data will take\n```c++\nADPCMHeader adp;\nchar* data = new char[ADPCMDataSize(wav)];\n```\nFinally, you can compress the samples.\n```c++\ncompress(samples, data, wave, adpcm);\n```\n\n\n## Decompression\nYou can decompress data with the ADPCM header created during compression and the compressed samples. It is recommended to also store the WAVE header with the compressed data for reconstruction.\n```c++\nWAVEHeader  wave;\nADPCMHeader adpcm;\n\nifstream in(input, ios::binary);\n\nin.read((char*)\u0026adpcm, sizeof(ADPCMHeader));\nin.read((char*)\u0026wave, sizeof(WAVEHeader));\n\nchar* samples = new char[wave.subchunk2Size];\nchar* data = new char[adpcm.dataSize];\nin.read((char*)data, adpcm.dataSize);\n\ndecompress(data, samples, adpcm);\n```\n\n# Command Line Usage\nYou can compile the program or use the released binary in the `/bin` folder to compress and decompress WAVE files through the terminal.\n```\n// Compresstion from origin.wav to compressed.adp\nadpcm -c origin.wav compressed.adp\n\n// Decompress from compressed.adp to origin.wav\nadpcm -d compressed.adp origin.wav\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoreing%2Faudio-adpcm-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoreing%2Faudio-adpcm-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoreing%2Faudio-adpcm-cpp/lists"}