Close
0%
0%

SamplerSynth Library

samplerSynth allows developers to create audio projects using sound samples. You can load different instruments.

Public Chat
Similar projects worth following
283 views
0 followers
Library to create audio projects with the ESP32 board. It uses audio samples to generate musical instrument sounds and offers functions to control playback, note duration, and volume adjustment, among other features. Its main objective is to allow the maker community interested in the creation of new musical instruments to focus on the form and functionality of their creations, being able to reproduce sounds without the need for dedicated hardware, such as the VS1053b, SAM2695, Wav Trigger or SmartWav 2 modules, which They can be expensive and take up a lot of space. In addition, it focuses on ease of use, being an accessible option for beginner programmers, unlike other advanced projects such as those by Marcel Licence or Phil Schatzmann. This library facilitates quick and easy development with acceptable sound quality for most DIY projects.

The video is in Spanish, please activate the English subtitles

Characteristics

  • Sample Playback: Support for loading and playing WAV files.
  • Polyphony: Play multiple notes simultaneously.
  • Volume Control: General volume and Dynamic adjustment of note volume. (Velocity)
  • I2S output: Uses the I2S peripheral of the ESP32 and an external DAC (MAX98357). (It could be modified to not use external DAC but it lowers the sound quality a lot)
  • Easy to Use: Simple function-based code, non-object-oriented programming.
  • Small: The entire library is just one file of less than 15kb and takes up approximately 15% of program storage space. The included samples also take up little space, approximately 700Kb of the almost 4Mb of flash memory.
  • Dependencies: LittleFS library, optional MIDI library [https://github.com/FortySevenEffects/arduino_midi_library] (used in the rtMidiIn example)

Features

  • initSynth(bck, ws, data): Initializes the synthesizer and configures the pins for I2S communication.
  • setMaxNotes(maxNotes): Sets the maximum number of simultaneous notes that can be played. 8 default maximum recommended 16
  • setInstrument(num): Loads a specific instrument sample to be played.
  • setVolume(vol): Sets the overall synth volume from (0-100)
  • setSustainNota(NoteDuration): configures the default time in milliseconds that a note lasts when calling the noteOn function (0-65535) if it is 0 it sounds indefinitely.
  • setDelayNota(dFade): Sets the fade time used in noteOff to mute the active note (0-127) 0 immediate 127 maximum duration.
  • noteOn(note, velocity, duration): Activates a musical note with the corresponding frequency, volume and duration specified.
  • noteOff(note): Turns off a musical note gradually, decreasing its volume for a set amount of time before muting it completely.
  • allnotaOff(): Disables all currently active musical notes.
  • alterNoteVol(velocity): Adjusts the volume of a note even if it is active.
  • alterPitchNote(qty): Adjusts the pitch of a note even if it is active.
  • pauseSynth(): Pauses the synthesizer task and frees resources.
  • resumeSynth(): Resume the synthesizer task.

samplerSynth.zip

Library

x-zip-compressed - 586.43 kB - 06/03/2024 at 06:37

Download

  • 1 × Lolin32 Lite Development Board
  • 1 × Class D Amplifier MAX98357A

  • 1
    Conections

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates