Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Theres an option for speed/tempo?  (Read 5342 times)

0 Members and 1 Guest are viewing this topic.

CosminPerRam

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Theres an option for speed/tempo?
« on: July 12, 2017, 12:04:39 pm »
Hello fellas, i wonder if there's a way to change the tempo/speed of the music? Even when the music is running? And also, how i can see at what second is the music at the moment? Also, im beginner in C++. Thanks in advance!

Flaze07

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
    • Email
Re: Theres an option for speed/tempo?
« Reply #1 on: July 12, 2017, 03:59:33 pm »
ahh...you did what I told you  ;D
altho I cannot provide an answer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Laurent Gomila - SFML developer

lucifercartwright

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Theres an option for speed/tempo?
« Reply #3 on: August 06, 2017, 12:52:59 pm »
The pitch is the only thing you can change that has an effect on the music speed:
https://www.sfml-dev.org/documentation/2.4.2/classsf_1_1SoundSource.php#a72a13695ed48b7f7b55e7cd4431f4bb6

For the current playback position:
https://www.sfml-dev.org/documentation/2.4.2/classsf_1_1SoundStream.php#a6070416e1e1a11b5915e9314dd6638f7

Is there a reason why when you set the pitch higher the sound gets sped up?

Hapax

  • Hero Member
  • *****
  • Posts: 3386
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Theres an option for speed/tempo?
« Reply #4 on: August 06, 2017, 03:21:06 pm »
Yes, a higher pitch has a higher frequency so increasing the pitch technically just increases the speed at which the samples are played back.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

lucifercartwright

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Theres an option for speed/tempo?
« Reply #5 on: August 07, 2017, 09:51:35 am »
Yes, a higher pitch has a higher frequency so increasing the pitch technically just increases the speed at which the samples are played back.

But how do programs like Audacity manage to up the pitch while maintaining the same speed of the sound?

Or is this delving into something too complicated to explain?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Theres an option for speed/tempo?
« Reply #6 on: August 07, 2017, 01:17:21 pm »
Quote
But how do programs like Audacity manage to up the pitch while maintaining the same speed of the sound?
They use more complicated algorithms, that are not part of OpenAL (and therefore SFML).
Laurent Gomila - SFML developer