I heard about this great sound system a week ago and I’m testing it to see if it can be used in my software. Up to now I was using OpenAL, my code is in OpenGL and I thought it was the best thing to do. But now that I found this one, the deal has changed.
I wrote the code for FMOD in my software and begun to test. The most important thing is that it has to be fast, very fast, because my software is used to do tests in real-time, with different tools like movements captors or A/D boards and I need a precision of a millisecond (or a very very few ms). I don’t need all DSP stuff, just playing sound as soon as I ask it and moving it in 3D with the motion we give.
The sounds work great in my 3D world but it seems that the first tests gave something like about a 100ms delay from the time where I move in my 3D world, and the time where the sound is heard correctly (louder on the right side for a sound moving to the right for example). When I make fast movement (with mouse for exemple), we can hear clearly this latency.
Is this possible that the position update of the sound, terminated by the FSOUND_3D_Update function takes a so long time, or is it (maybe) a problem from my software ?
This is my only question.
- Ceydric asked 16 years ago
Exactly. I did the same kind of tests with the mouse. But I’ve just tried by pressing a key, one sets the listener position to (-15, 0, 0) and the other to (15, 0, 0). And it is again the same result, I mean in hardware 3D mode, the sound seems to move “slowly” from the left to the right ( it takes I think about 100ms, but I will do some tests with a real-time machine to record the sound volume next week to see exactly how many time it takes to have the full volume and the right position). In the software 3D mode, when the sound position is updated, the change is instantaneous, but it takes about 100ms to be updated between the time I press a key and the time the position is realy updated (for this I think it should depend on the processor frequency).
Here is a little drawing to understand what I’m saying :
X = event, explained under it
<–> time elapsed, explained above this
Hardware3D : (some kind of paning)
a few ms about a hundred ms <----------> <-------------------------------------------------> X -------------X----------------------------------------------------X
Key pressed starting paning the sound is good
Software2D : (no paning)
about a hundred ms <--------------------------------------------------------------> X ----------------------------------------------------------------- X
Key pressed the sound is good
So it really seems to be a sound card problem and maybe a sound blaster live value – win2K problem because the software mode works (even if it takes time to be updated, but when it is, the sound goes directly from left to right) and it is the hardware mode which does not function correctly and I don’t think I can do anything about it.
Sorry, my drawings don’t appears like I wrote it.
In Hardware3D, the first <—–> is “a few ms”, the second <—–> is “about a hundred ms”.
And the events are 1/ “Key pressed”, 2/ “Starting paning”, 3/ “The sound is good”.
In software3D, the first X is “Key pressed” and the second is “The sound is good”.
Oh I forgot one other thing.
I tried to use FSOUND_SetFrequency, which works fine except when I give it a negative value. With this value, it works great, because the sound plays back, but when I give it a new positive value, the sound is still playing backwards, so 80000 is interpreted as -80000 for example.
Any idea ?
I’m working on a PIII 1GH, Win2K, SBLive Value, 256 MB memory, Visual C++ 6.0 if you want to know.
Thanks a lot for your reply.
I’m using Windows 2000. I tried WINMM and DSOUND, and I let FMOD choose the best for me (it was DSOUND it seems). I use FSOUND_Sample_Load (FSOUND_FREE, soundName, FSOUND_FORCEMONO | FSOUND_HW3D, 0). First I didn’t called FSOUND_SetBufferSize, then I tried to set it at 50, or whatever and there was no change in the delay. Actually, the start and the stop of the sound is almost instantaneous, and the change of the frequency too, but not the change of the position (I mean the audible result of the change of the source’s position or the listener). That’s why I thought it might be something about the FSOUND_3D_Update which is pobably delayed.
I tried the new dll you send me (I was using v.220.127.116.11 and I replaced it by this one v.18.104.22.168) and there was no change even for my second problem.
Now, I made some new tests for my second problem which is the frequency of the sound. I realized that the results are not the same if we use FSOUND_2D or FSOUND_HW3D in the FSOUND_Sample_Load function.
In FSOUND_2D mode, the frequency does make change on the sound emitted in a range from -700000 to +700000, which are the values you give, but even with your new dll, once you are in a negative frequency, you can’t go back to a positive value, it still acts like a negative value.
In FSOUND_3D mode, the frequency does make change only between +100 to about +100000. No backwards reading and no change after 100000 Hertz.
I know that your sound system can do a lot of things, and I’m really impressed by this and its quality but actually my little problems I’m talking about are the real important ones for me (but I think I will use more and more things from this sound system in the future). Thanks again for replying me (I hope this doesn’t give you too much work … 😕 )
I may have found the beginning of an answer to my first problem which is the latency I observed. I linked the sound position to my mouse button which is updated at about 130 Hz. When my button is not pushed the sound is at place A. When I push my button, the sound is placed at place B. Actually it seems that the position is quickly understood and taken into account by the sound engine but what we hear is some kind of linear interpolation between place A to place B which give me this perceptible delay. In my example the position A is far left which give us almost no sound on the right and left speaker and the position B is almost at the listener position. I don’t have an intermediate position, just A or B but when I push my button the sound comes progressively from “nothing’s heard” to “the sound is at full power”.
This is only for 3D sounds because in 2D mode I have a delay with no kind of interpolation, just delay when using the pan function.
Maybe there is some kind of variables to set in order not to have this interpolation thing ? Maybe this is inherent to DSOUND ?
First, thanks again for answering me … 😛
I made several tests since my last message. Let’s start with what you suggested me. I used correctly FSOUND_3D_SetAttributes and FSOUND_3D_Listener_SetAttributes, switching some axes to have the good orientation corresponding to my environnement and all works fine with this. I tried without the FSOUND_HW3D flag and you were right, the sound isn’t doing any interpolation thing anymore (but the position is updated much slower than with the flag on my PIII 1GHz … 😕 ). So it might be a driver problem… I’m going to check for a new one, actually I’m using the driver which was on my sound blaster installation CD … I hope my problems will go away after that.
So I talked to you about some new tests. I want to launch the sound and come back to my code as quickly as possible so I measured the time it takes to unpause the sound paused either with the FSOUND_PlaySoundEx (FSOUND_FREE, sound, NULL, TRUE) function or with the FSOUND_SetPaused (hChannel, TRUE) function. And when I use the flag FSOUND_2D in FSOUND_Sample_Load function, it takes only about 0.2 ms to execute this and return to my code which is very fast and good for me, but the sound takes time to begin (about a hundred ms I presume and I guess it depends on the CPU), at the opposite when I use the FSOUND_HW2D flag, the sound comes a lot more quickly but the function takes about 5 ms to come back with a 3mbytes sound file and about 2ms with a 1ko file (the smallest sound I could create, a simple beep). This time is the same when I use FSOUND_HW3D (or maybe a little more time (+1ms). Do you think it is possible ?
So now I guess the only choice left to me is choosing between coming back soon to my code but having a sound delayed (software mode) or coming back several ms after the unpause function but having a sound starting much more quickly (hardware mode) … difficult choice because both are important … but maybe once my driver will be updated the function won’t take so much time to come back … I know I’m talknig about some ms which is almost nothing for a sound system, but can be a lot for me.
Anyway I’m very impressed and pleased to use FMOD, it can do so much things and works very well and easily.
Please login first to submit.