Git Product home page Git Product logo

nas's Introduction

Not Another Synthesizer!

This is a notebook tracking my ideas and progress in developing a specific kind of synthesizer.

Why another synthesizer?

I have an OP-1. I love it. It is beautiful in its simplicity and sounds amazing. I want to make something that also sounds amazing and is also extreme in its simplicity (and its okay if its ugly as can be). For me, simplicity also means inexpensive, so I'm going to see if I can design something out of simple components.

I have a list of things I want to exclude which helps guide what I'd like to include.

  • No sampling! I want realtime synthesis. I want to generate sounds in as realtime as possible so that I can take advantage of analog inputs that modulate the waveforms.
  • Not just a keyboard! I want variable analog inputs. Basically, I want to utilize potentiometers to modulate the waveforms in realtime.
  • Not just sin() and cos()! I want extremely customizable synthesizer algorithms. I want to find very simple and beautiful sounding synth algorithms and see if I can tweak them to produce neat variations.
  • No ADSR! Just simple continous waves. The volume knob can be used to manually make a ADSR effect (or maybe a theremin style sensor).

1. POS-1: grain synthesizer (Arduino based)

My first attempt which yielded something neat is the grain synth built from an Arduino. It sounds pretty good and uses only an Arduino, pots, and a speaker. The sound is good, but sort of low quality.

2. POS-2: mozzi synthesizer (Arduino based)

Another Arduino option is to use the Mozzi synthesizer. I'm not too impressed with the sounds on this and the extensibility. I think I'd like to try with Raspberry Pi audio.

3. POS-3: padsynth in C (Linux based)

Moving to a Linux based synth opens a lot of doors in terms of quality.

I've found that the PADsynth algorithm by Nasca Paul is quite beautiful. It can be made polyphonic, and can be made continuous (each is a repeatable unit). Still I'm trying to figure out:

  • What kind of sounds can I get?

There are a lot of things that can be done, especially in generating formants. For example, the simple chord uses the following formant distribution.

  • Can samples be swapped in the middle?
  • Should I pre-generate samples?
  • How should the sound the outputted in realtime?

For the last question there are a number of possibilities:

  • Use JACK realtime server (I tried this and it was painful to switch between pulseaudio and JACK and I also don't find JACK intuitive at all).
  • Use ALSA (API seems to be pretty good)
  • Use a Raspberry Pi with a MCP4725 (sampling rate may be too low)

ALSA route

nas's People

Contributors

schollz avatar

Stargazers

 avatar rchk avatar Matthias Sturm avatar

Watchers

James Cloos avatar  avatar  avatar

nas's Issues

Use threads

Example:

#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define NUM_THREADS     2

long a[5] = {0};
pthread_mutex_t lock;

int msleep(long msec)
{
    struct timespec ts;
    int res;


    ts.tv_sec = msec / 1000;
    ts.tv_nsec = (msec % 1000) * 1000000;

    do
    {
        res = nanosleep(&ts, &ts);
    }
    while (res);

    return res;
}

void *PrintHello(void *threadid)
{
    long tid;
    tid = (long)threadid;
    if (tid == 0)
    {
        printf("Hello World! It's me, thread #%ld!\n", tid);
        for (;;)
        {
            for (int i = 0; i < 5; i++)
            {
                pthread_mutex_lock(&lock);
                printf("a[%d]=%ld\n", i, a[i]);
                pthread_mutex_unlock(&lock);
                msleep(1);

            }
        }

    }
    else
    {
        printf("Hello World! It's me, thread #%ld!\n", tid);
        long j = 0;
        for (;;)
        {
            for (int i = 0; i < 5; i++)
            {
                pthread_mutex_lock(&lock);
                a[i] = j;
                pthread_mutex_unlock(&lock);
                j++;
                msleep(1);
            }
        }
    }
    pthread_exit(NULL);
}

int main (int argc, char *argv[])
{
    pthread_t threads[NUM_THREADS];
    int rc;
    long t;

    if (pthread_mutex_init(&lock, NULL) != 0)
    {
        printf("\n mutex init has failed\n");
        return 1;
    }


    for(t = 0; t < NUM_THREADS; t++)
    {
        printf("In main: creating thread %ld\n", t);
        rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t);
        if (rc)
        {
            printf("ERROR; return code from pthread_create() is %d\n", rc);
            exit(-1);
        }
    }

    /* Last thing that main() should do */
    pthread_exit(NULL);
    pthread_mutex_destroy(&lock);
}

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.