https://github.com/orhun/linuxwave Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} orhun / linuxwave Public * * Notifications * Fork 4 * Star 130 Generate music from the entropy of Linux orhun.dev/linuxwave/ License MIT license 130 stars 4 forks Star Notifications * Code * Issues 2 * Pull requests 0 * Discussions * Actions * Security * Insights More * Code * Issues * Pull requests * Discussions * Actions * Security * Insights orhun/linuxwave This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 2 branches 7 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/o] Use Git or checkout with SVN using the web URL. [gh repo clone orhun/] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @orhun orhun chore(release): prepare for v0.1.2 ... d74c445 Apr 17, 2023 chore(release): prepare for v0.1.2 d74c445 Git stats * 115 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github chore(pull): merge #5 April 17, 2023 21:44 assets docs(website): add demo link to website April 17, 2023 12:06 libs feat(args): add CLI argument parser March 14, 2023 15:24 man feat(docs): add a man page April 17, 2023 04:39 src refactor(lib): extract reusable modules as packages April 15, 2023 17:30 .dockerignore feat(docs): add a man page April 17, 2023 04:39 .gitignore docs(lib): support auto-generation of documentation with a build flag April 15, 2023 20:22 .gitmodules feat(args): add CLI argument parser March 14, 2023 15:24 CHANGELOG.md chore(release): prepare for v0.1.2 April 18, 2023 01:30 CODE_OF_CONDUCT.md style(docs): add emojis April 4, 2023 15:26 CONTRIBUTING.md docs(github): add contributing guide April 4, 2023 15:21 Dockerfile feat(docker): add Dockerfile March 24, 2023 23:15 LICENSE docs(license): add MIT license March 24, 2023 23:33 README.md docs(preset): add the "spooky_manor" preset April 18, 2023 00:14 RELEASE.md style(docs): add emojis April 4, 2023 15:26 SECURITY.md style(docs): add emojis April 4, 2023 15:26 build.zig chore(release): prepare for v0.1.2 April 18, 2023 01:30 cliff.toml chore(changelog): remove author names from changelog April 15, 2023 16:35 release.sh feat(release): set up release workflow April 3, 2023 23:57 View code [ ] linuxwave Motivation Installation Build from source Prerequisites Instructions Binary releases Arch Linux Docker Images Usage Building Examples Presets Usage scale note rate channels format volume duration input output Funding Contributing License [?][?] Copyright [?][?] README.md linuxwave demo GitHub Release Coverage Continuous Integration Continuous Deployment Docker Builds Documentation Click here to watch the demo! Table of Contents * Motivation * Installation + Build from source o Prerequisites o Instructions + Binary releases + Arch Linux + Docker o Images o Usage o Building * Examples * Presets * Usage + scale + note + rate + channels + format + volume + duration + input + output * Funding * Contributing * License [?][?] * Copyright [?][?] Motivation * Bash One Liner - Compose Music From Entropy in /dev/urandom + 'Music' from /dev/urandom Installation Build from source Prerequisites * Zig (0.10.1) Instructions 1. Clone the repository. git clone https://github.com/orhun/linuxwave && cd linuxwave/ 2. Update git submodules. git submodule update --init --recursive 3. Build. zig build -Drelease-safe Binary will be located at zig-out/bin/linuxwave. You can also run the binary directly via zig build run. If you want to use linuxwave in your Zig project as a package, the API documentation is available here. Binary releases See the available binaries for different targets from the releases page. They are automated via Continuous Deployment workflow. Release tarballs are signed with the following PGP key: 0xC0701E98290D90B8 Arch Linux linuxwave can be installed from the community repository using pacman : pacman -S linuxwave Docker Images Docker builds are automated and images are available in the following registries: * Docker Hub * GitHub Container Registry Usage The following command can be used to generate output.wav in the current working directory: docker run --rm -it -v "$(pwd)":/app "orhunp/linuxwave:${TAG:-latest}" Building Custom Docker images can be built from the Dockerfile: docker build -t linuxwave . Examples Default: Read random data from /dev/urandom to generate a 20-second music composition in the A4 scale and save it to output.wav: linuxwave To use the A minor blues scale: linuxwave -s 0,3,5,6,7,10 -n 220 -o blues.wav Read from an arbitrary file and turn it into a 10-second music composition in the C major scale: linuxwave -i build.zig -n 261.63 -d 10 -o music.wav Read from stdin via giving - as input: cat README.md | linuxwave -i - Write to stdout via giving - as output: linuxwave -o - > output.wav Presets Generate a calming music with a sample rate of 2000 Hz and a 32-bit little-endian signed integer format: linuxwave -r 2000 -f S32_LE -o calm.wav Generate a chiptune music with a sample rate of 44100 Hz, stereo (2-channel) output and 8-bit unsigned integer format: linuxwave -r 44100 -f U8 -c 2 -o chiptune.wav Generate a boss stage music with the volume of 65: linuxwave -s 0,7,1 -n 60 -v 65 -o boss.wav Generate a spooky low-fidelity music with a sample rate of 1000 Hz, 4-channel output: linuxwave -s 0,1,5,3 -n 100 -r 1000 -v 55 -c 4 -o spooky_manor.wav Feel free to submit a pull request to show off your preset here! Also, see this discussion for browsing the music generated by our community. Usage Options: -s, --scale Sets the musical scale [default: 0,2,3,5,7,8,10,12] -n, --note Sets the frequency of the note [default: 440 (A4)] -r, --rate Sets the sample rate [default: 24000] -c, --channels Sets the number of channels [default: 1] -f, --format Sets the sample format [default: S16_LE] -v, --volume Sets the volume (0-100) [default: 50] -d, --duration Sets the duration [default: 20] -i, --input Sets the input file [default: /dev/urandom] -o, --output Sets the output file [default: output.wav] -V, --version Display version information. -h, --help Display this help and exit. scale Sets the musical scale for the output. It takes a list of semitones separated by commas as its argument. The default value is 0,2,3,5,7,8,10,12, which represents a major scale starting from C. Here are other examples: * A natural minor scale: 0,2,3,5,7,8,10 * A pentatonic scale starting from G: 7,9,10,12,14 * A blues scale starting from D: 2,3,4,6,7,10 * An octatonic scale starting from F#: 6,7,9,10,12,13,15,16 * Ryukyuan (Okinawa) Japanese scale: 4,5,7,11 note The note option sets the frequency of the note played. It takes a frequency in Hz as its argument. The default value is 440, which represents A4. You can see the frequencies of musical notes here. Other examples would be: * A3 (220 Hz) * C4 (261.63 Hz) * G4 (392 Hz) * A4 (440 Hz) (default) * E5 (659.26 Hz) rate Sets the sample rate for the output in Hertz (Hz). The default value is 24000. channels Sets the number of audio channels in the output file. It takes an integer as its argument, representing the number of audio channels to generate. The default value is 1, indicating mono audio. For stereo audio, set the value to 2. For multi-channel audio, specify the desired number of channels. Note that the more audio channels you use, the larger the resulting file size will be. format Sets the sample format for the output file. It takes a string representation of the format as its argument. The default value is S16_LE, which represents 16-bit little-endian signed integer. Possible values are: * U8: Unsigned 8-bit. * S16_LE: Signed 16-bit little-endian. * S24_LE: Signed 24-bit little-endian. * S32_LE: Signed 32-bit little-endian. volume Sets the volume of the output file as a percentage from 0 to 100. The default value is 50. duration Sets the duration of the output file in seconds. It takes a float as its argument. The default value is 20 seconds. input Sets the input file for the music generation. It takes a filename as its argument. The default value is /dev/urandom, which generates random data. You can provide any type of file for this argument and it will generate music based on the contents of that file. output Sets the output file. It takes a filename as its argument. The default value is output.wav. Funding If you find linuxwave and/or other projects on my GitHub profile useful, consider supporting me on GitHub Sponsors or becoming a patron! Support me on GitHub Sponsors Support me on Patreon Support me on Patreon Contributing See our Contribution Guide and please follow the Code of Conduct in all your interactions with the project. License [?][?] Licensed under The MIT License. Copyright [?][?] Copyright (c) 2023, Orhun Parmaksiz About Generate music from the entropy of Linux orhun.dev/linuxwave/ Topics music linux entropy zig random waveform vaporwave wav music-generation random-music synthwave music-generator waveform-generator retrowave ziglang tune-generator zig-package linuxwave Resources Readme License MIT license Code of conduct Code of conduct Security policy Security policy Stars 130 stars Watchers 2 watching Forks 4 forks Report repository Releases 7 Release v0.1.2 Latest Apr 17, 2023 + 6 releases Sponsor this project * * patreon patreon.com/orhunp * https://www.buymeacoffee.com/orhun Learn more about GitHub Sponsors Packages 1 Contributors 4 * * * * Languages * Zig 83.2% * HTML 11.4% * Shell 3.9% * Dockerfile 1.5% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.