• 0

Question

Hey gang,

I have a media application (Bedia, free available here: http://www.blissgig.com/display.aspx?id=13 ) that I have added speech recognition. The problem is that on some lower end systems the SR causes the audio playback to become "off" from the video playback, usually by only a fraction of a second. I am using WMP as the audio/video playback.

The question is, I am thinking of having a threaded class that does the monitoring for the speech recognition, but before I go down that path I thought I'd ask for any thoughts? Is there anything I should be aware of or......

I know the question is a bit vague, I am attempting to avoid mentioning specifics so that any and all issues for this process are brought up.

Thank for your time.

9 answers to this question

Recommended Posts

  • 0

If I understand well, you're currently handing the audio data to a speech recognition API before handing it to WMP, which can cause the audio to become out of sync? It's pretty strange that this is happening, but I'm not familiar with WMP.

In any case, doing this on separate thread would work as long as you're actually handing out the data to the processes (WMP and SR) in parallel and not having one waiting on the other, otherwise you're not gaining anything by using multiple threads.

  • 0

Thanks Dr.

The speech commands affect Play, Pause, other playback controls as well as menu commands. I really don't know why the audio becomes unsynced so the idea of moving the SR to another thread is a shot in the dark. I have completed the code in a test bed and will move it into the app in the next few days. I will drop a note here to let everyone know how it goes.

The nice part of the SR being on another thread is that some of the processing (is a command valid, etc) is within that thread and SHOULD not affect any playback. I just return a string that informs the base app what I need to do, just as if the user had pressed a mouse button.

Have a great day.

James

  • 0

Thanks Dr.

The speech commands affect Play, Pause, other playback controls as well as menu commands. I really don't know why the audio becomes unsynced so the idea of moving the SR to another thread is a shot in the dark. I have completed the code in a test bed and will move it into the app in the next few days. I will drop a note here to let everyone know how it goes.

The nice part of the SR being on another thread is that some of the processing (is a command valid, etc) is within that thread and SHOULD not affect any playback. I just return a string that informs the base app what I need to do, just as if the user had pressed a mouse button.

Have a great day.

James

Did you do it delegate style? Or are you constantly checking a string for a value?

  • 0

Did you do it delegate style? Or are you constantly checking a string for a value?

Yes I am using a Delegate, thanks for asking. Only when acceptable conditions have been met is a string sent back to the calling thread. This is why I thought about going this route, all the work to insure that this is an acceptable command before affecting the app. I really do appreciate you asking to make sure.

Peace,

James

  • 0

Yes I am using a Delegate, thanks for asking. Only when acceptable conditions have been met is a string sent back to the calling thread. This is why I thought about going this route, all the work to insure that this is an acceptable command before affecting the app. I really do appreciate you asking to make sure.

Peace,

James

I know some people will thread things but then sit there waiting for the thread to finish/do something instead of carrying on and doing what needs to be done away from the thread and acknowledging when the thread has something for it. That's the reason I asked.

But yea, logically if the thread is just sitting in a loop like:

wait for command

process command

if command is good raise the event

repeat

and the main program is sitting in a

play movie/sit in idle state

**Event raised**

check event

do event

repeat

And there is no reliance on one or the other to preform individual tasks and you aren't sitting there in a:

while (x != y) or while(myThread.ThreadState == ThreadState.Running)

Then I don't see why it wouldn't work, and it should work better than a non-threaded system.

  • 0

Thanks again Firey,

Your diagram statement is exactly what is going to happen (I haven't added my new class to my app yet. I almost always create a test bed application to insure that it is working on it's own before adding it to the real application)

I still find it strange that the audio becomes unsynced.... but when I shut down the SR option, which disposes of the SR components, the issue goes away. I state this in case anyone else ever has the issue that they know that someone else has seen it.

Have a fun day.

  • 0

Thanks again Firey,

Your diagram statement is exactly what is going to happen (I haven't added my new class to my app yet. I almost always create a test bed application to insure that it is working on it's own before adding it to the real application)

I still find it strange that the audio becomes unsynced.... but when I shut down the SR option, which disposes of the SR components, the issue goes away. I state this in case anyone else ever has the issue that they know that someone else has seen it.

Have a fun day.

One thing to check, would be CPU usage. I know that in some cases High CPU usage can cause things to become un-synced. If the playback has full video decoding frames can be ready and display but the CPU can't keep up with keeping things (like the Audio) synced properly.

  • 0

One thing to check, would be CPU usage. I know that in some cases High CPU usage can cause things to become un-synced. If the playback has full video decoding frames can be ready and display but the CPU can't keep up with keeping things (like the Audio) synced properly.

Interesting thought. The app has run for two+ years on this lightwight machine but with the addition of SR it could be hitting high. I will check this out, thanks.

This topic is now closed to further replies.
  • Posts

    • I do trust Apple probably more than these other companies with certain data, but I also do think (and it has been demonstrated that) Apple pulls a lot of shenanigans and always has for a long time.
    • Does your iPhone support the latest iOS version? Here's the iOS 27 compatibility list by Aditya Tiwari It's that time of year when we get to know about the latest operating system updates for Apple devices. For iPhone, Apple previewed the iOS 27 update at WWDC 2026, where the company finally introduced an upgraded version of Siri. Apple typically supports iPhone models for up to five years. But it has been making exceptions in recent years (read iPhone 11). If you're wondering whether your iPhone is compatible with the iOS 27 update, here is the official list of devices: iPhone 17 Pro Max, iPhone 17 Pro, iPhone 17, iPhone 17e, iPhone Air iPhone 16 Pro Max, iPhone 16 Pro, iPhone 16, iPhone 16 Plus, iPhone 16e iPhone 15 Pro Max, iPhone 15 Pro, iPhone 15 Plus, iPhone 15 iPhone 14 Pro Max, iPhone 14 Pro, iPhone 14 Plus, iPhone 14 iPhone 13 Pro Max, iPhone 13 Pro, iPhone 13, iPhone 13 mini iPhone 12 Pro Max, iPhone 12 Pro, iPhone 12, iPhone 12 mini iPhone 11 Pro Max, iPhone 11 Pro, iPhone 11 iPhone SE (2nd generation), iPhone SE (3rd generation) So, you can download the iOS 27 developer beta on up to 31 different iPhone models. There has been no change to the list of supported iPhones since iOS 26. However, it will expand to include more devices when the iPhone 18 series arrives later this year. To download the developer beta on your iPhone, go to Settings > General > Software Update > Beta Updates. Here, select "iOS 27 Developer Beta" from the list of choices to get the new update. In addition to iOS 27, you can try the developer beta versions of macOS 27, iPadOS 27, watchOS 27, tvOS 27, and HomePod software 27 on your supported devices. iOS 27 comes with improved Liquid Glass, which you can adjust using a new transparency slider. Apple said during the keynote that iPhone apps now launch up to 30% faster, new photos appear in the Photos app up to 70% faster, and AirDrop transfers work up to 80% faster. The new update promises to improve performance on older iPhones by introducing a new CPU Scheduler that supports devices all the way back to the iPhone 11. While iOS 27 is supported on older iPhones, it goes without saying that they'll lack several features due to hardware differences. For instance, iPhone 14/14 Plus and older models come with a notch instead of the Dynamic Island. Similarly, Apple Intelligence features are supported on iPhone 15 Pro/Pro Max and later models.
    • The Radeon RX 9070 XT is right up there with the GeForce RTX 5070 Ti
    • I don't know why someone said useless, but it does have that pesky kernel driver bundled, and it's in perennial turmoil. When it goes bad, it goes very bad, and it's impossible to predict when it will due to system differences. I know that they're in the middle of development for a major new version that will include a completely new driver, one that they expect will largely solve the problem, but that's a ways out and it's unproven at this point.
    • doesn't AdGuard let ads through that pay to be let through?
  • Recent Achievements

    • Experienced
      JayZJay went up a rank
      Experienced
    • Reacting Well
      Sir_Timbit earned a badge
      Reacting Well
    • Week One Done
      rubentuben8 earned a badge
      Week One Done
    • Week One Done
      ARaclen earned a badge
      Week One Done
    • Week One Done
      jojodbn earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      524
    2. 2
      PsYcHoKiLLa
      232
    3. 3
      +Edouard
      132
    4. 4
      ATLien_0
      88
    5. 5
      Steven P.
      83
  • Tell a friend

    Love Neowin? Tell a friend!