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

Author Topic: Access to Current Music Data?  (Read 2705 times)

0 Members and 1 Guest are viewing this topic.

snerp

  • Newbie
  • *
  • Posts: 1
    • View Profile
Access to Current Music Data?
« on: January 30, 2016, 10:40:00 pm »
I'm wondering about building a Music + video art project where the video is dynamically generated based on the audio. So I was wondering, is there a way for me to poll data from the sound buffer?

Basically I want to do:
// Declare a new music
sf::Music music;
// Open it from an audio file
if (!music.openFromFile("music.ogg"))
{
    // error...
}
// Change some parameters
music.setLoop(true);         // make it loop
// Play it
music.play();

And then every frame I want to check what the music has done since last frame. Does SFML have a way to do this? I assume it does since the audio module seems pretty powerful and people are recording audio with it?
Basically, think Audiosurf, I want to use the waveform to find the pitch and volume to use as inputs to generate visuals instead of a track.

Edit: some more info.

Basically, the part I'm having a problem with is accessing the sound data, also I'm not sure what format it's going to be in.
« Last Edit: January 30, 2016, 11:03:50 pm by snerp »

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Access to Current Music Data?
« Reply #1 on: February 01, 2016, 12:52:46 am »
sf::Music does not give you the ability to access the samples that it uses.
You can build your own music class from sf::SoundStream (as sf::Music does) that does what you need but it should be possible to inherit from sf::Music to provide a way to access those samples, although copying or altering sf::Music might be simpler/easier.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything