Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > irrKlang
Audio Visualization

illusion
Registered User
Quote
2012-11-23 04:36:55

Hello,
I am building an audio visualizer for my Graphics class that reads an mp3 file and generates particle system visualization based on various frequencies in the file.

I have seen few posts on the same topic here. From these posts I have been able to put some code together.

/**********************************************************************/

include <iostream>
include <Audio\irrKlang.h>

using namespace irrklang;
using namespace std;


int main(int argc, const char** argv)
{
// start irrKlang with default parameters
ISoundEngine* engine = createIrrKlangDevice();

if (!engine)
return 0; // error starting up the engine


irrklang::ISoundSource* sound_source = engine->addSoundSourceFromFile("as.mp3", ESM_NO_STREAMING);
sound_source->setForcedStreamingThreshold(-1);
unsigned char* sound_values = (unsigned char*)sound_source->getSampleData();
int number_of_elements = sizeof(sound_values);
for(int i=0;i < number_of_elements ;i++)
cout << endl << sound_values[i];

if(sound_values == NULL)
cout<<"Problem";


char i = 0;
engine->play2D("as.mp3");
std::cin >> i; // wait for user to press a key

engine->drop(); // delete engine

return 0;
/************************************************************************/


My problems:
When I print the values given but getSampleData();, it print blank new lines. I am fairly new to C++, as such there may be some noobish mistake I am not seeing here.


niko
Moderator
Quote
2012-11-24 08:00:02

getSampleData is usually just some bytes, showing the digital wave. Printing it as characters won't show useful information, I guess.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internat?onal" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact