0
0

Hi to all,
I’m trying (having lots of problems) to develop an audio editor.
I would edit some 1hour_16bits_mono_mp3 sounds ( I use Qt for the front-end).
These are my steps:
1) I create a sound calling createSound on the gived sound name so:

[code:rlx1x7pq]result = AudioDevice::getInstance()->getSystem()->createSound( soundName_.toAscii().data(), FMOD_CREATESAMPLE | FMOD_SOFTWARE, 0, &m_Sound );[/code:rlx1x7pq]

2) I determine the amount of bytes so:
[code:rlx1x7pq]result = m_Sound->getLength( &m_Bytes, FMOD_TIMEUNIT_PCMBYTES );//bytes
[/code:rlx1x7pq]

3) and finally I lock the sound to get raw samples so:
[code:rlx1x7pq]result = m_Sound->lock( 0, m_Bytes, &ptr1, &ptr2, &len1, &len2 );[/code:rlx1x7pq]

The strange thing is that the point 1 (createSound) is extreemly slow, is take more or less 3 seconds. Is it normal? Or I’m doing something wrong?

I hope to get answer.

regards,
Franco

  • You must to post comments
0
0

Yes it is… Your sound is HUGE…
Use createStream instead

I would reserve createSound for small wav file, aka sound effects…

And use createStream for background music (mp3)

  • You must to post comments
0
0

[quote="icuurd12b42":2h8fuuh5]Yes it is… Your sound is HUGE…
Use createStream instead[/quote:2h8fuuh5]

How? Can I have a little example?

[quote:2h8fuuh5]I would reserve createSound for small wav file, aka sound effects…[/quote:2h8fuuh5]
ok.
A curiosity: aka stands for?

[quote:2h8fuuh5]And use createStream for background music (mp3)[/quote:2h8fuuh5]
I don’t understand what did you mean with background music. I need to edit, so I need to draw sound wave

  • You must to post comments
0
0

The example is in the FMOD Help file under GETTING STARTED.

AKA stands for "eg", or, "let’s say" or "like"

Usually, in a game, background ambiance music are large mp3 sounds. where sound effect are wav files. So it’s not applicable for you.

Try the stream way to create your sound, it should load instantly. However, I don’t know if it will affect any of your sound editor features. Possibly GetLength could cause a lag if it needs to analyse the entire sound, streamed or not….

  • You must to post comments
0
0

[quote="icuurd12b42":1nxsf4b0]The example is in the FMOD Help file under GETTING STARTED.[/quote:1nxsf4b0]
Ok thanx.

[code:1nxsf4b0]Usually, in a game, background ambiance music are large mp3 sounds. where sound effect are wav files. So it’s not applicable for you.[/code:1nxsf4b0]
Yes I understand

[quote:1nxsf4b0]Try the stream way to create your sound, it should load instantly. However, I don’t know if it will affect any of your sound editor features. Possibly GetLength could cause a lag if it needs to analyse the entire sound, streamed or not….[/quote:1nxsf4b0]
But with this can I have in memory all sound samples?

  • You must to post comments
0
0

Try it is my best answer for this. I’m not an expert in this particular area.

It could be you would only see the first loaded chunk, could be you would have to manually read each chunk, could be that lock would read the entire sound as well, nullifying the benefit of createStream, differing the delay there…

If you only want to prevent your application from locking, you may want to call createSound, but in a thread. as long as you DONT call any fmod function while the thread is active, it would be safe to do that too.

  • You must to post comments
0
0

[quote="icuurd12b42":2zk4ffyw]Try it is my best answer for this. I’m not an expert in this particular area.

It could be you would only see the first loaded chunk, could be you would have to manually read each chunk, could be that lock would read the entire sound as well, nullifying the benefit of createStream, differing the delay there…

If you only want to prevent your application from locking, you may want to call createSound, but in a thread. as long as you DONT call any fmod function while the thread is active, it would be safe to do that too.[/quote:2zk4ffyw]

Hi, I don’t only want to prevent looking, I also would speed up the loading time.
I tried to change createSound with createStream in the code I posted above and now I got a runtime error 😥

  • You must to post comments
0
0

Hi franco,

If you want access to the entire sound as uncompressed data then you’re going to have to load and decompress the entire file, so there is no benefit to using streams in this case. It takes a long time because decoding a 1 hour MP3 file takes a long time. You should use FMOD_NONBLOCKING flag to load the file in a background thread so it doesn’t block the main thread and freeze up the GUI.

To deteremine when the sound is finished loading you can poll Sound::getOpenState.

-Pete

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.