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
    Posts
    9

    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.
    https://github.com/earlephilhower/ESP8266Audio
    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??
    https://github.com/earlephilhower/ES...btinysoundfont
    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.
    https://github.com/ErichHeinemann/hm...eratorSAMPLE.h
    https://github.com/ErichHeinemann/hm...atorSAMPLE.cpp

    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?

    Regards
    Erich

  2. #2
    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: https://github.com/PaulStoffregen/Au...r/Granular.ino

  3. #3
    Junior Member
    Join Date
    Jan 2018
    Posts
    9
    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:
    https://github.com/ErichHeinemann/teensystuff/

    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)
    /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/Audio
    too
    Users/myUserName/Documents/Arduino/libraries/Audio

    cd /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/Audio
    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
    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
  •