Any news about synchronization issues?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

Any news about synchronization issues?

fauri
Hi, Fred, how are you? Here I am again!

Sorry to bother you with the same subject, but I'm still facing many sync issues. After revision 185, my drum machine no longer works as expected (creating a player in each loop). And, although the performance of uos_playnofree is better, still doesn't work as it should.

To show my problem, in simpledrums demo, change the tempo to 125. Do you realize that sometimes one of the drum pieces doesn't play. I'm noticed that with Lazarus 1.6 and Windows 10 x64.

Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

fredvs
Administrator
Hello.

Last SimpleDrums demo uses uos_AddFromMemoryStream().

Did you try with a other method:
- uos_AddFromFile ?
- uos_AddFromMemoryBuffer ?

Here, on a netbook + win10 it works ok with time-interval 50 ms.

Could you give code that you use + code of old uos release that works ok for you (or date of commit in uos-GitHub site)?

Thanks.

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

fredvs
Administrator
Hello.

Could you try last commit : b813a63..85bab44 ?

SimpleDrums demo uses new method : uos_PlayPaused() + uos_RePlay().
This should give better synchronisation.

Fre;D

Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

fauri
Thanks, Fred, but I still faced with some problems. For example, with tempo in 100, it works perfectly. But, if I change to 124 or 125, sometimes one of the pieces doesn't play. Strange, don't you?

Before revision 185, my drum machine worked great with a new player being created in each loop. Now, in that way, the sync is a total mess. But I believe that uos_PlayNoFree is the right way to go.
Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

fredvs
Administrator
This post was updated on .
fauri wrote
Thanks, Fred, but I still faced with some problems. For example, with tempo in 100, it works perfectly. But, if I change to 124 or 125, sometimes one of the pieces doesn't play. Strange, don't you?
Yes, very strange.
And I have tested on many os (Linux, FreeBSD, WinXP, Win7, win8, win81,win10).
And, indeed with win10 there are synchro-problems sometimes.
But I have also problems with all other audio-applications (that are not win10 native).
I also have problems with audio-drivers win10/64 bit.

fauri wrote
Before revision 185, my drum machine worked great with a new player being created in each loop. Now, in that way, the sync is a total mess. But I believe that uos_PlayNoFree is the right way to go.
It would be great if you give in attachment a demo with old revision (working for you).

In SimpleDrums demo code, it uses uos_AddFromFile().
But you may try with uos_AddFromMemoryStream(), the code is there ready to use.
You only have to uncomment uos_AddFromMemoryStream in demo code (and comment code using uos_AddFromFile).

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

fredvs
Administrator
In reply to this post by fauri
fauri wrote
Thanks, Fred, but I still faced with some problems. For example, with tempo in 100, it works perfectly. But, if I change to 124 or 125, sometimes one of the pieces doesn't play. Strange, don't you?

Before revision 185, my drum machine worked great with a new player being created in each loop. Now, in that way, the sync is a total mess. But I believe that uos_PlayNoFree is the right way to go.
Huh, could you try SimpeDrums demo of last commit 85bab44..8fb4e25 ?

Thanks.

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

fredvs
Administrator
This post was updated on .
Re-huh. Could you try SimpleDrums demo of very last commit : 7dd9fae..1aff5a9 ?
It uses a dummy endless input and Global Events.

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

fauri
Well... The pieces don't disappear anymore, but they are sounding strange now (being cutted). I remember that issue occured in the firsts releases of simpledrums demo.
Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

fredvs
Administrator
fauri wrote
Well... The pieces don't disappear anymore, but they are sounding strange now (being cutted). I remember that issue occured in the firsts releases of simpledrums demo.
Did you try with other wav than the one of the demo (HH.wav, SD.wav, BD.wav) ?
I want to help you but I do not understand " sounding strange now (being cutted)".
Here the sound is normal. Do you talk about the sound of BD.wav ?

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

fredvs
Administrator
In reply to this post by fauri
fauri wrote
Well... The pieces don't disappear anymore, but they are sounding strange now (being cutted). I remember that issue occured in the firsts releases of simpledrums demo.
Oooops, indeed, using headphones I can hear it...

Re-re-huh, could you try SimpleDrums of last commit 1aff5a9..d282ed2 ?

This time, I think we get it ;-)

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

fredvs
Administrator
In reply to this post by fauri
fauri wrote
Well... The pieces don't disappear anymore, but they are sounding strange now (being cutted). I remember that issue occured in the firsts releases of simpledrums demo.
Hello.
Did you try last release 82fd8ae  ?

I have try with Win10 64/32 bit and on my netbook it works perfectly, from 50 ms (and less) to 200 ms (and more).

For Win10, like in SimpleDrums demo, a endless-muted input is needed. This because Win10 has a (strange) way to work: when the audio drivers does not receive any samples, it is set in "sleep" mode.
And this make synchro not working (it takes time to wake-up the driver).
The solution is to associate a endless input so the audio driver is not set in "sleep" mode when the wave-file has terminated.

@ other uos users: is the demo SimpleDrums working for you ?

Thanks

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

Phoenix
Hello,

fredvs wrote
@ other uos users: is the demo SimpleDrums working for you ?
I'm not an expert but it seems to me okay
Win10 64bit e Laz 1.6.4 64bit FPC 3.0.2

PS.
After split the Execute () method...
In DoTerminateNoFreePlayer();
is missing:

   isfirst := true;
 
   {$IF DEFINED(portaudio)}
   for x := 0 to high(StreamOut) do
    if (StreamOut[x].Data.HandleSt <> nil) and
       (StreamOut[x].Data.TypePut = 1) then
     Pa_StopStream(StreamOut[x].Data.HandleSt);
   {$ENDIF}  

It solved a problem for Win10!
Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

fredvs
Administrator
Phoenix wrote
I'm not an expert but it seems to me okay
Win10 64bit e Laz 1.6.4 64bit FPC 3.0.2
Ha. ok thanks for testing.

Phoenix wrote
After split the Execute () method...
In DoTerminateNoFreePlayer();
is missing:

   isfirst := true;
 
   {$IF DEFINED(portaudio)}
   for x := 0 to high(StreamOut) do
    if (StreamOut[x].Data.HandleSt <> nil) and
       (StreamOut[x].Data.TypePut = 1) then
     Pa_StopStream(StreamOut[x].Data.HandleSt);
   {$ENDIF}  

It solved a problem for Win10!
Normally it must not be there, the pa_stream has not to be stopped, but now that AddFromEndlessMuted() does endless input, for synchronizing there is no more problem at end of thread (because it never ends !).

But, ok, I will re-enable isfirst := true +   Pa_StopStream in DoTerminateNoFreePlayer().

Huh, what problem for Win10 do you encounter if this is not set ?

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

fredvs
Administrator
In reply to this post by Phoenix
Phoenix wrote
In DoTerminateNoFreePlayer();
is missing:

   isfirst := true;
 
   {$IF DEFINED(portaudio)}
   for x := 0 to high(StreamOut) do
    if (StreamOut[x].Data.HandleSt <> nil) and
       (StreamOut[x].Data.TypePut = 1) then
     Pa_StopStream(StreamOut[x].Data.HandleSt);
   {$ENDIF}  

It solved a problem for Win10!
OK, thanks to note it, fixed in last commit 82fd8ae..ba3512d.

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

fauri
It worked like a charm! I made some tests with a old netbook with Windows 7, and the performance was very good too!

fredvs wrote
For Win10, like in SimpleDrums demo, a endless-muted input is needed.
Ahhh, I finally understood the purpose of uos_AddFromEndlessMuted!

By the way, how exactly works the set of functions uos_SetGlobalEvent, uos_PlayPausednofree and uos_Replay? I don't know if I understood correctly. Anyway, my project is works as expected now! Thanks a lot, Fred and Phoenix!
Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

Phoenix
Hello,

fredvs wrote
Huh, what problem for Win10 do you encounter if this is not set ?
The problem appeared only with PlayNoFree().
At uos_free() you heard the last part (very short) of the played sound.

fredvs wrote
OK, thanks to note it, fixed in last commit 82fd8ae..ba3512d.
Thanks

fauri wrote
It worked like a charm!
Good news!!
Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

fredvs
Administrator
This post was updated on .
In reply to this post by fauri
fauri wrote
It worked like a charm! I made some tests with a old netbook with Windows 7, and the performance was very good too!
Ha, finally we get it. I am very happy for you.

fauri wrote
By the way, how exactly works the set of functions uos_SetGlobalEvent, uos_PlayPausednofree and uos_Replay? I don't know if I understood correctly. Anyway, my project is works as expected now! Thanks a lot, Fred and Phoenix!
uos_SetGlobalEvent ---> uos uses RTL events to pause/resume a thread (the player).
If you set uos_SetGlobalEvent  to true, all the players already created will use only one pause-event, the same for all players.( otherwise a particular pause-event is a assigned for each player).
So, with uos_SetGlobalEvent(true), if you pause some of players, when you use uos_replay (that will use the global event), all the paused players will resume, all together, at the same moment without any delay.

uos_PlayPausednofree ---> This for start a player, no free it at end and pause it just after play.
Use this if you need a perfect synchro: first start-paused player then...

uos_Replay ---> When all the players are start-paused, use uos_Replay to play the paused players.
If uos_SetGlobalEvent was set to true, you need to uos_Replay only one player, all other start-paused players will play synchro.

Fre;D


Reply | Threaded
Open this post in threaded view
|

Re: Any news about synchronization issues?

fredvs
Administrator
In reply to this post by Phoenix
Phoenix wrote
At uos_free() you heard the last part (very short) of the played sound.
Ha, ok, so I will forget (and remove)  the isfirst concept.

Thanks Phoenix.

Fre;D