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

Thread: Searching for Audio Time-Stretching algorithm

  1. #1
    Junior Member
    Join Date
    Nov 2021
    Posts
    3

    Searching for Audio Time-Stretching algorithm

    Hello everybody,

    I am searching for an algorithm for time-stretching audio data. I want to build a sound-module for model ships with a teensy 3.6. I would prefer a simple algorithm without using any complex libraries because the sound shall be in sync with some additional effects.

    Has anybody an idea where I can start searching or already a useable algorithm?

    Best regards

    Frank13

  2. #2
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,368
    Stretching by which ratio or ratios?

  3. #3
    Senior Member
    Join Date
    Oct 2015
    Location
    Vermont, USA
    Posts
    314
    Are you willing to accept the pitch shifting along with the time stretching? Like, if you make the sample longer, the pitch drops proportionally. If so, it's pretty easy.

    But, if you want the pitch to stay the same while the length changes, that's harder.

    Which do you need?

  4. #4
    Junior Member
    Join Date
    Nov 2021
    Posts
    3
    Hi,

    I need the hard way... the pitch should stay largely where it is. The optimum range would be 50 to 200 %, otherwise I can use multible data files and switch to the "faster" or "slower" sound after for example 75% to 150%.

    Greetings

    Frank13

  5. #5
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,428
    Yes, it will not work to just play the audio slower.
    If you listen to a motor, it will not change pitch. The time between ignitions changes.
    I could imagine to cut the audio in short pieces (with audacity) and to play these pieces, according to the rpm.
    It should good with a player like this: https://github.com/FrankBoesing/Teensy-WavePlayer
    Perhaps it would be good to add more iginition-independed "noise" audio by playing it in the background for other loud mechanics (transmission) or the exhaust system, etc.. to make it more realitic.
    The mentioned player has a automatic "loop" system which will be helpful - i guess it can produce relatic sound with just changing the length of the loop.. (but as mentioned additional independed background sound would be good)
    Last edited by Frank B; 11-26-2021 at 11:06 AM.

  6. #6
    Senior Member manicksan's Avatar
    Join Date
    Jun 2020
    Location
    Sweden
    Posts
    327
    Can't you use the wave table synth object for that, as it already doing some down/up "frequency shifting" of the sound.
    Just create "one sample" soundfont and use that.
    I have no idea how it would sound like but you can try.

  7. #7
    Junior Member
    Join Date
    Nov 2021
    Posts
    3
    Hello everybody,

    Thanks for the ideas! I will have a look at the wave table object later, just now I am trying the "simple" version: My sound has a start-sequence, a loop (only a few bytes long) and a end-sequence. I already programmed a player which repeats the loop as long I want. Now I will try to change the loop on my PC an then play the version of the loop corresponding to the speed. Hopefully it sounds good...

    Greetings

    Frank13

Posting Permissions

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