0
  • My project is playing a piece of audio using tone js and i want to use player.fadeIn to fade the audio in from the beginning.

  • my goal is to just have a variable to control the fade duration of the player.

  • any help on this is greatly appreciated thanks :)

  • The functionality was successful when hardcoding the value as written below. This would fade the audio in with a duration of 5 seconds.

    • player.fadeIn = 5;
      
  • When I tried to use a variable to represent the fade duration as written below, I would get the following error.

    • player.fadeIn = fadeDuration
      
    • ERROR:

      Type 'number | undefined' is not assignable to type 'Time'.
        Type 'undefined' is not assignable to type 'Time'.
      
  • and if i tried changing the type of fade duration variable to type 'Time' a similar error is presented.

    • ERROR:

      Type 'Time | undefined' is not assignable to type 'Time'.
        Type 'undefined' is not assignable to type 'Time'.
      

0 Answers0