A very simple synth with 3 waveforms and configurable oscillators.

Overview

simple-synth

This is an experimental project that implements a basic software synthesizer in Rust using the CPAL library. The synthesizer can generate three types of waveforms (sine, square, and sawtooth) and allows you to configure the frequency, amplitude, speed, and phase of each oscillator.


Usage

To use the synthesizer, you'll need to install Rust and Cargo. You can then clone the repository and run the following command to build and run the project:

cargo run

This will start the synthesizer and play a basic chord using three oscillators with different frequencies, amplitudes, waveforms, speeds, and phases.

let mut oscillators = vec![
    Oscillator::new(24.0, 0.01, Waveform::Square, 1.0, 0.0),
    Oscillator::new(5.0, 0.02, Waveform::Sawtooth, 1.0, 0.0),
    Oscillator::new(40.0, 0.01, Waveform::Sine, 1.0, 0.0),
];

You can modify the parameters of the oscillators in real time by entering values separated by spaces with the format "index frequency amplitude waveform speed phase"

index frequency amplitude waveform speed phase
   |      |        |        |        |     |
   1      46     0.025    square    1.8    0

To add a new oscillator just write the line with a non-existing index

3 10 0.05 saw 1.6 0

Stop the first oscillator (at index 0)

0 0 0 sine 0 0

Warning This synthesizer starts playing sound immediately after being executed. Make sure the volume of your speakers or headphones is not too loud

You might also like...
A simple GUI rust application that keeps track of how much time you spend on each application.
A simple GUI rust application that keeps track of how much time you spend on each application.

TimeSpent A simple GUI rust application that keeps track of how much time you spend on each application. Installation Click here to download the Setup

🎹 Simple MIDI note repeater plugin (VST3/CLAP).

⏱️ Clockwork A simple MIDI note repeater plugin, written in Rust. 🎬 Showcase: (turn on audio) clockwork-showcase.mp4 📖 Manual: The user manual can b

Drumsthesia is a simple software that helps you to learn how to play the drums (or midi controllers).
Drumsthesia is a simple software that helps you to learn how to play the drums (or midi controllers).

Drumsthesia A shameless copy of Neothesia adapted for e-Drums. Youtube Video Binaries for MacOS, Linux (untested) and Windows (untested). Download Scr

Symphonia is a pure Rust audio decoding and media demuxing library supporting AAC, FLAC, MP3, MP4, OGG, Vorbis, and WAV.

Pure Rust multimedia format demuxing, tag reading, and audio decoding library

A library and application for lossless, format-preserving, two-pass optimization and repair of Vorbis data, reducing its size without altering any audio information.
A library and application for lossless, format-preserving, two-pass optimization and repair of Vorbis data, reducing its size without altering any audio information.

OptiVorbis A library and application for lossless, format-preserving, two-pass optimization and repair of Vorbis data, reducing its size without alter

A CLI and library to convert data to sound, and vice versa (dependency-free)

Data to sound A simple crate to convert data to sound, and sound to data. The sound file format is wave (.wav). You can use it as a library or as a co

Program to check if stereo wav files have identical channels (faux-stereo) and convert them to mono.

zrtstr Command line application for checking WAV-files for identical channels, detecting faux-stereo files generated by some audio-editing software an

Idiomatic Rust bindings for OpenAL 1.1 and extensions (including EFX).

alto alto provides idiomatic Rust bindings for OpenAL 1.1 and extensions (including EFX). WARNING Because Alto interacts with global C state via dynam

High-level PortMidi bindings and wrappers for Rust

portmidi-rs High-level PortMidi bindings for Rust. PortMidi website: http://portmedia.sourceforge.net/portmidi/ Installation Add this to your Cargo.to

Comments
  • Add .wasm requirements

    Add .wasm requirements

    To build a WebAssembly file from the Rust project first this needs to be converted in a library (lib.rs for example). This pull request adds the needed refactor and the public function to be invoked when WebAssembly binary is compiled.

    opened by Juanmalopezg 0
Owner
Juanma López G
I'm a broccoli that builds things.
Juanma López G
Very simple, efficient, task oriented, low cognitive, Midi player and jukebox for midi instruments

Midi and Virtual Book jukebox Player A cross-platform MIDI and virtual book jukebox player. It only includes the necessary functionalities to play MID

Barrel Organ Discovery 4 Jun 29, 2023
A very simple audio synthesizer with a tuix gui

In this tutorial we'll create a very simple audio synthesiser application from scratch with a ui using tuix. The finished code for this tutorial can b

George Atkinson 24 Jan 6, 2023
simple-eq is a crate that implements a simple audio equalizer in Rust.

simple-eq A Simple Audio Equalizer simple-eq is a crate that implements a simple audio equalizer in Rust. It supports a maximum of 32 filter bands. Us

Mike Hilgendorf 11 Sep 17, 2022
Simple examples to demonstrate full-stack Rust audio plugin dev with baseplug and iced_audio

iced baseplug examples Simple examples to demonstrate full-stack Rust audio plugin dev with baseplug and iced_audio WIP (The GUI knobs do nothing curr

Billy Messenger 10 Sep 12, 2022
ears is a simple library to play Sounds and Musics in Rust

ears ears is a simple library to play Sounds and Musics in Rust. ears is build on the top of OpenAL and libsndfile. Provides an access to the OpenAL s

Jeremy Letang 56 Dec 1, 2022
Simple personal server to serve audiofiles files from folders.

Simple personal server to serve audio files from directories. Intended primarily for audio books, but anything with decent directories structure will do. Focus here is on simplicity and minimalistic design.

Ivan Zderadicka 571 Dec 29, 2022
musify is a simple discord bot to play music within a voice channel, written in the rust programming language.

musify-rs musify is a simple discord bot to play music within a voice channel, written in the rust programming language. Features A simple song queue

NV6 5 Aug 14, 2022
A simple CLI audio player with strange features.

legacylisten legacylisten is a simple CLI audio player I wrote because no existing one fulfilled my needs. The main feature is that you can change how

Matthias Kaak 3 Jun 8, 2022
🎵 A super simple VST written in Rust

DigiDist This is a simple little VST plugin, developed in Rust using the vst2 crate. It doesn't sound particularly great, but it demonstrates just how

Joe Clay 34 May 29, 2022
A simple GUI audio player written in Rust with egui. Inspired by foobar2000.

Music Player A simple GUI music player inspired by foobar2000 written in Rust using egui. The goal of this project is to learn about making gui/ nativ

Ryan Blecher 5 Sep 16, 2022