Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: SF2 / MIDI-Player for Audio Library or simple Stretching of WAV-Files ?

Hybrid View

  1. #1
    Junior Member
    Join Date
    Jan 2018

    SF2 / MIDI-Player for Audio Library or simple Stretching of WAV-Files ?

    Hi all,
    I had played around with the ESP32 last year and had found this library from Earle Philhower III and used it as a Sample-Player in my project.
    I moved only a bit of the code from ESP8266 to my ESP32 and was surprised to get it working.
    In my project, I used the wavplayer to play and loop a WAV-File from Progmem in variable speed.

    Weeks ago I bought my first Teensy and thought that the Audio-Library is able to play WAV-Files in variable speed .. but it cannot.

    A workaround could be to modify the player for Soundfonts which is existing in the Audio-Library.
    It seems to be a bit of work to transform an SF2 into the right format.

    Earle Philhower was able to use the SF2-File directly which works well on the ESP8266.
    Could this library, which he optimized for the ESP8266 work with the teensy 3.x too??
    Earle hat also created a MIDI-File-Player together with the SF2-Library. ... could be interesting to play back stored (short or longer) MIDI-Tracks.

    Who is able to transform this for the Teensy?

    As an Alternative, I had created my library for the ESP32 to stretch or compress an existing WAV-File by repeating Samples or dropping Samples
    ... the code does not support the expected Filter or Reverb! ... only the Pitch works acceptable for Rythem- or Percussion-Loops.

    What would be the best option to get cool pitchable Samples in the Audio-Library for the Teensy? Direct SF2-Play or Simple Stretching like I did on the ESP32?


  2. #2
    Senior Member
    Join Date
    Feb 2015
    AudioEffectGranular can pitch shift and change playback speed. Just route an AudioPlaySdWav (or whatever sound source) through it.

    Take a look here for the example:

  3. #3
    Junior Member
    Join Date
    Jan 2018
    Hi all, after some days I am able to change the speed of a played WAV-File.
    1. I replaced the files play_sd_wav.h and play_sd_wav.cpp .. still 16bit and the current version is only able to stretch 44.1kHz 16Bit-Stereo-Files. Mono-Files and other sampling-times are on the ToDo-List.

    If someone wants to peek inside the current solution:

    The quality is ok for Drum-loops and I have tested with Sinus Loops too to find bugs in the solution.
    If You test it, keep in mind that it has to be copied into the existing Audio-Library.

    I have copied mine over from the original place (Mac OSX)

    cd /Applications/
    cp -R * /Users/myUserName/Documents/Arduino/libraries/Audio

    and then I have replaced the 2 files under Arduini/libraries/Audio/ and created some test files and tested with the new example.

    With this solution, - no extra additional library AudioEffectGranular is needed to store the Grains of the WAV-File.

  4. #4
    Senior Member
    Join Date
    Feb 2015
    I'm guessing you're taking this route rather than the Granular effect because of RAM limitations?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts