Hello all 😉
How can I make a waveform same of that :
In this picture you can see one part of my projet and you can see a small waveform, this waveform is the complete music, I create this with an other stream and every 25ms I take a spectrum…
8s for create this waveform every time you load a music.
But now I want a waveform of 10secondes (or 8 or 6) of my music and this waveform must move every 25ms…
I read all topic about waveform I understand maybe I must to use [b:gf6p6sep]FMOD_Sound_ReadData[/b:gf6p6sep].
Please help me. 😥
PS: I’m french very sorry for my bad english…
EDIT: I forget: In my program I put the music in memory [b:gf6p6sep]FMOD_System_CreateSound[/b:gf6p6sep] is not a stream.
- 21 asked 10 years ago
Group/System/Channel::getWaveData and ::getSpectrumData
Keep the data fetching low. 64 to 128 entries is about what you need (visually)
The top image in your example is the wave data.
you can draw the -1 to 1 values easilly value*height+y. You may need to make sure the values are whitin -1 to 1. I played files in older versions of FMOD when I would get garbage values beyound that range
the bottom is spectrum. You will need to normalise the data to display it as it explains in the help file. values are from 0 to 1 and can be very tiny (hence the need to normalise).
Oops, the bottom is not quite what I was thinking… It’s the entire file yes?
- icuurd12b42 answered 10 years ago
You cannot use channel->getWaveData() because you also want to diplay the waveform in the future. Use sound->readData(). For each block of x samples store the maximum value for left and right channel or use some other method like averages or something. I think all DJ apps prescan the file, calculating the waveform on-the-fly would be too expansive. You can also try sound->lock() but I don’t think it would give you good performance.
Thanks [b:12978ntq]brett[/b:12978ntq], [b:12978ntq]icuurd12b42[/b:12978ntq] & [b:12978ntq]mylo[/b:12978ntq] for reply. 😉
@[b:12978ntq]brett[/b:12978ntq]: I learn again the fonction [b:12978ntq]getWaveData()[/b:12978ntq] and I test with 16384 and I compressed the picture but it’s not what I want mylo say exactly my problem.
@[b:12978ntq]icuurd12b42[/b:12978ntq]: Your program show lot off visualisations, good, but it’s not what I want…
@[b:12978ntq]mylo[/b:12978ntq]: Yes I read lot off thing about [b:12978ntq]readData()[/b:12978ntq] and [b:12978ntq]lock()[/b:12978ntq] but I don’t know how I can use it 😕
If you can post me (in this topic for all) a simply code it will be very cool because I don’t speak english, I don’t understand the function, and I don’t find help in the web (except here).
I understand the code in offlinedecoding example but I don’t know how I can do what I want…
I try this : (but I don’t know what I receive, I don’t know what I must receive )
[code:4ua2re8e]#define CHUNKSIZE 8192
void *data = malloc(CHUNKSIZE);
unsigned int read, cursor;
FMOD_Channel_GetPosition(chan_deck[deck], &cursor, FMOD_TIMEUNIT_PCMBYTES);
FMOD_Sound_SeekData(sound_deck[deck], cursor – (CHUNKSIZE / 2));
FMOD_Sound_ReadData(sound_deck[deck], (char *)data, CHUNKSIZE, &read);[/code:4ua2re8e]
I am really really lost…
How I can use my "[i:4ua2re8e]data[/i:4ua2re8e]" ?
You know when I create a spectrum is very simply because I have a "tab" (float tab) is very simply to use it.
But with a buffer I’m lost…
I must use FMOD_Sound_SeekData() no ?
I think I ever succeed…
Please login first to submit.