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

Thread: Crossfade and loop

  1. #1
    Junior Member
    Join Date
    Oct 2016
    Posts
    14

    Crossfade and loop

    Hi,

    I want to loop certain wave files, but I want them to crossfade.
    So, one file plays almost till the end (3 to 4 seconds) and crossfades into the next.
    No buttons, not interaction, just looping forever.

    I'm a Frankenscript coder - by cutting & sewing together - but here it's the reasoning behind it I cannot mathemetize. Concrete code help is very very welcome..

    ---> I think there has to be something to indicate that a file ends, to be able to start the next one
    - by a specific object?
    - by calculating the length of your file - how to know/stock this?
    - other
    ?

    thanks

    ---> the audio board is great; by the way, crystal clear sound :-)

    greetzw,
    dywen

  2. #2
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,251
    As a start, I'd just use two known files - with known length - and use millis() to determine the point where you want start the next file.
    If that works, you can add the next step, and try to determine the length in your program.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    25,022
    Quote Originally Posted by dywen View Post
    Concrete code help is very very welcome..
    If you haven't already looked at the audio tutorials, take a look at part 2-2. It plays 2 WAV files and lets you pan between them.

    With a little coding as Frank suggested, you should be able to achieve your goal. The player also has functions you can call to find the current position with the file and the total length. But if you know the lengths, maybe fixed numbers with delay() or elapsedMillis would be simpler.

  4. #4
    Junior Member
    Join Date
    Oct 2016
    Posts
    14
    Ok. I did not make the link with the panning example..
    Thanks!

Posting Permissions

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