Giter VIP home page Giter VIP logo

lyt's Introduction

The Lyt Library

Lyt is a C++ library and command-line tool for rapid prototyping of audio applications. It gives the programmer the ability to utilize the features and speed of C++, without having to go through the usual ceremony of setting up such a project.

Lyt comes batteries included โ€” many oft used DSP routines are included as well as utilities for reading and writing audio files. Many of these features are not implemented yet, but will in the future.

In addition to the C++ library there is the lyt command-line tool which gives you a scripting-language like experience of writing C++ code. Write your C++ program and run lyt, and it will take care of all compilation and linking for you.

Dependencies

To build use Lyt you will need the following software

  • Clang C++ compiler.
  • Make (preferably GNU Make).
  • Python 2.7 or later.

Additionally you will need the following libraries

On Linux you install the dependencies by running

$ sudo apt-get install libsndfile1-dev portaudio19-dev

On macOS you install the dependencies by installing homebrew and then running

$ brew install libsndfile portaudio

Installation

Clone the repository

$ git clone https://github.com/PelleJuul/lyt.git
$ cd lyt

And run make

$ make install

You might need to run make with sudo if you're using linux.

Installing on Windows

Installation and use on Windows is still in very early development, but the general steps should be:

  • Install MinGW including MSYS.
  • Clone this repository
  • Run make install -D PREFIX=myprefix/ with a suitable prefix in the MSYS shell.
  • Make sure that your chosen prefix is in your PATH.

The lyt tool is still not compatible with windows. Instead you can try to build the scripts with the command

$ g++ --std=c++11 -lsndfile -llyt my_lyt_file.cpp -o my_lyt_file.exe

Using Lyt

Lyt is used by writing a C++ program and then running or building it using the lyt command-line tool. After installing Lyt you can test it on one of the examples in the examples directory.

The most basic of the examples is the test_tone example.

#include <lyt/lyt.h>
#include <cmath>

int main(int argc, char **argv)
{
    auto buf = Buffer::zero(44100); 
    buf.mapt([&](float t, float v)
    {
        return std::sin(2 * M_PI * t * 440.0);
    });

    buf.writeFile("output.wav");
    return 0;
}

When run this will create a one second long wav file, called output.wav, containing a 440Hz sine tone. Lets look at each statement of the code. First

auto buf = Buffer::zero(44100); 

creates a new audio buffer of 44100 samples. The default sample rate is 44100 so this will be one second of audio. Next statement we have

buf.mapt([&](float t, float v)
{
    return std::sin(2 * M_PI * t * 440.0);
});

The mapt function is a higher order function โ€” it takes another function as its arguemnt. The given function will take the time t and value v of each sample and return a resulting sample. In this case we only use the time t to compute and return a sine wave.

Lastly we have

buf.writeFile("output.wav");

Which writes the audio contained in the buffer buf to the file output.wav.

Pretty soon there will be a complete reference for all of the functionality contained in lyt. Until then it can be useful to look throgh the header files in the library directory

Contributing

Please contribute to Lyt and help make it awesome! Some of the ways you can contribute:

  • Use Lyt for making cool audio apps and give us feedback, suggestions and bug reports using GitHub issues.
  • Try to install Lyt on new operating systems.
  • Try to use lyt combined with other software packages.
  • Add new features to the Lyt library or tool.

Some features that are todo or that could be cool to have are:

  • A fractional delay line.
  • Spectral analysis tools.
  • More oscillators and filters.
  • A fractional delay line.
  • Tools for physical modelling.
  • Real time audio.
  • Simple GUI and interactivity tools.
  • Add more filter types to the Biquad class.
  • Implement common audio effects such as echo, flanger, chorus, reverb, distortion and compression as Processors.
  • Whatever you'd like that's cool!

lyt's People

Contributors

francescobigoni avatar pellejuul avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.