Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jstrait/nanosynth
A miniature Ruby tone generator
https://github.com/jstrait/nanosynth
audio ruby sound synth tone tutorial
Last synced: 4 months ago
JSON representation
A miniature Ruby tone generator
- Host: GitHub
- URL: https://github.com/jstrait/nanosynth
- Owner: jstrait
- License: mit
- Created: 2014-06-08T04:43:32.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-12-30T05:16:19.000Z (about 5 years ago)
- Last Synced: 2024-10-13T15:27:06.920Z (4 months ago)
- Topics: audio, ruby, sound, synth, tone, tutorial
- Language: Ruby
- Homepage: https://www.joelstrait.com/nanosynth/
- Size: 16.6 KB
- Stars: 39
- Watchers: 5
- Forks: 15
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NanoSynth
A miniature tone generator written in Ruby, intended to show how to create a minimal Ruby program that generates sound.
For a detailed description of how it works, check out this blog post:
# Installation
* Download `nanosynth.rb`
* Install the [WaveFile gem](http://wavefilegem.com): `gem install wavefile --version 1.1.1`# Example Usage
NanoSynth expects 3 arguments: the waveform, frequency, and amplitude. It will then generate 1 second of sound and write it to a file called `mysound.wav` in the current directory.
ruby nanosynth.rb
For example:
ruby nanosynth.rb square 440.0 0.2
The command above will generate a square wave of 440Hz, at 20% full volume, and write it to `mysound.wav` in the current directory.
The waveform can be one of `sine`, `square`, `saw`, `triangle`, or `noise`.
The amplitude should be between 0.0 (silence) and 1.0 (full volume). Amplitudes above 1.0 will result in clipping distortion.