Giter Club home page Giter Club logo

synthpathy's Introduction

Synthpathy

From Synthesizer and Sympathy, you get Synthpathy

Description

Synthpathy is a small and versatile audio synthesizer on a microcontroler. It uses a Raspberry Pico microcontroler. Additional information will be added here during the development process.

Synthpathy is a 4-notes polyphonic synthetizer featuring two types of waveforms (square and saw), an envelope generator (ADSR) with adjustable attack and sustain and a low-pass filter with an adjustable cutoff frequency. The raspberry pico only features 3 ADC channels and a choice had to be made about what parameters could be controlled through potentiometers, but theoretically all ADSR parameters could be handled alongside with filter cutoff and resonnance.

Synthpathy generates sound at 46875 Hertz using raw samples, in floating-point representation, but it would be way more efficient to use 32 or 16 bits fixed-point representation, this issue will be adressed in the future.

How to build

First of all, if not already done, you have to clone the repository of the pico sdk, available at https://github.com/raspberrypi/pico-sdk.git .

git clone https://github.com/raspberrypi/pico-sdk.git

The pico sdk repository also provides a README.txt file with everything necessary in order to compile a raspberry pico project, but in short simply run :

sudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib

You are now able to compile this project by running the following lines (change /your/sdk/path for your actual sdk path) :

mkdir build
cd build
cmake -DPICO_SDK_PATH=/your/sdk/path ..
make

If you have a standard Ubuntu distribution (this is probably also true for other distributions), the pico should mount under /media/user/RPI-RP2 (replace user by your actual login). So if you press the bootsel button, plug the pico, and release the button, you can load the executable with :

cp Synthpathy.uf2 /media/user/RPI-RP2/

Development notes

Visualize generated sound

If you have minicom and python 3 installed on your computer, you can visualize the waveform created by the software with the following process :

mkdir build
cd build
cmake -DPICO_SDK_PATH=/your/sdk/path -DDEBUG_AUDIO=1 ..
make
cp Synthpathy.uf2 /media/user/RPI-RP2/
minicom -b 115200 -o -D /dev/ttyACM0 -C capture.txt

python3 ../python_scripts/audio_plotter.py capture.txt

After starting minicom, you will see the raw samples created by Synthpathy. You are supposed to use it in order to see anything else than zeros. You can leave minicom with Ctrl+A, X. These samples are saved in capture.txt, which can be interpreted as a csv. The csv is then processed by audio_plotter.py in order to display the audio waveform in a much more pleasing way. This script also creates an audio wav file in the same build directory. Please note that Synthpathy cannot create real-time audio while also printing samples. As a result, the output audio file will be shorter than the duration of your tests. This is obviously not true when using Synthpathy without DEBUG_AUDIO activated.

Debug messages

The previous section showed that defining the macro DEBUG_AUDIO with cmake results in Synthpathy printing raw samples in the console. Alternatively defining the macro DEBUG (with cmake -DDEBUG=1 ..) allows to see what events are taken into account and how they are handled.

Defining the macro TESTS_ONLY (with cmake -DTESTS_ONLY=1 ..) puts the software in a special mode where it does not synthesize anything anymore, only performing timing measurements. This is useful since it is important that all sound generating functions need to run in about 20 microseconds (sampling period with a sampling frequency of 50kHz).

Credits

Versions

Version numbers are of the form X.Y.Z, where :

  • X refers to major version, any change in this numbers prevents retro-compatibility with previous data and/or hardware setup.
  • Y refers to non-breaking functionality increments.
  • Z refers to bugs and mistakes corrections.

synthpathy's People

Contributors

bricecroix 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.