Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork22
Generate music from the entropy of Linux 🐧🎵
License
orhun/linuxwave
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Click here to watch the demo!
Listen to "linuxwave" on Spotify!
Table of Contents
- Zig (
0.14)
- Clone the repository.
git clone https://github.com/orhun/linuxwave&&cd linuxwave/
- Build.
zig build --release=safe
Binary will be located atzig-out/bin/linuxwave. You can also run the binary directly viazig build run.
If you want to uselinuxwave in your Zig project as a package, the API documentation is availablehere.
See the available binaries for different targets from thereleases page. They are automated viaContinuous Deployment workflow.
Release tarballs are signed with the following PGP key:0xC0701E98290D90B8
linuxwave can be installed from thecommunity repository usingpacman:
pacman -S linuxwave
linuxwave can be installed from official Void Linux package repository:
xbps-install linuxwave
Docker builds areautomated and images are available in the following registries:
The following command can be used to generateoutput.wav in the current working directory:
docker run --rm -v"$(pwd)":/app"orhunp/linuxwave:${TAG:-latest}"
Custom Docker images can be built from theDockerfile:
docker build -t linuxwave.Default: Read random data from/dev/urandom to generate a 20-second music composition in the A4 scale and save it tooutput.wav:
linuxwave
Or play it directly withmpv without saving:
linuxwave -o -| mpv -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.wavGenerate acalming 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 achiptune 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 aboss stage music with the volume of 65:
linuxwave -s 0,7,1 -n 60 -v 65 -o boss.wav
Generate aspooky 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 tosubmit a pull request to show off your preset here!
Also, seethis discussion for browsing the music generated by our community.
Options: -s, --scale <SCALE> Sets the musical scale [default: 0,2,3,5,7,8,10,12] -n, --note <HZ> Sets the frequency of the note [default: 440 (A4)] -r, --rate <HZ> Sets the sample rate [default: 24000] -c, --channels <NUM> Sets the number of channels [default: 1] -f, --format <FORMAT> Sets the sample format [default: S16_LE] -v, --volume <VOL> Sets the volume (0-100) [default: 50] -d, --duration <SECS> Sets the duration [default: 20] -i, --input <FILE> Sets the input file [default: /dev/urandom] -o, --output <FILE> Sets the output file [default: output.wav] -V, --version Display version information. -h, --help Display this help and exit.Sets the musical scale for the output. It takes a list ofsemitones separated by commas as its argument.
The default value is0,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
Thenote option sets the frequency of the note played. It takes a frequency in Hz as its argument.
The default value is440, which represents A4. You can see the frequencies of musical noteshere.
Other examples would be:
- A3 (220 Hz)
- C4 (261.63 Hz)
- G4 (392 Hz)
- A4 (440 Hz) (default)
- E5 (659.26 Hz)
Sets the sample rate for the output in Hertz (Hz).
The default value is24000.
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 is1, indicating mono audio.
For stereo audio, set the value to2. 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.
Sets the sample format for the output file. It takes a string representation of the format as its argument.
The default value isS16_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.
Sets the volume of the output file as a percentage from 0 to 100.
The default value is50.
Sets the duration of the output file in seconds. It takes a float as its argument.
The default value is20 seconds.
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 provideany type of file for this argument and it will generate music based on the contents of that file.
Sets the output file. It takes a filename as its argument.
The default value isoutput.wav.
- linuxwavegui – A graphical interface for linuxwave with tempo shifting, pitch control, flawed (but still cool-sounding) MIDI generation, and an interactive piano for scale selection.
If you findlinuxwave and/or other projects on myGitHub profile useful, consider supporting me onGitHub Sponsors orbecoming a patron!
See ourContribution Guide and please follow theCode of Conduct in all your interactions with the project.
Licensed underThe MIT License.
Copyright © 2023-2024,Orhun Parmaksız
About
Generate music from the entropy of Linux 🐧🎵
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
