Author Topic: [FIX] Lag issues, frame skips, random pauses - set core affinity how-to  (Read 7074 times)

blue_h3x

  • Hero Member
  • *****
  • Posts: 5165
    • View Profile
    • AS Tournament
Issues:

Sound plays but video pauses then track goes very fast
Frame skips when screen recording
Low frame rate randomly mid song

Causes:

If something in the background starts up, or does something, this will use a bit of your CPU. Often having a knock on effect on Audiosurf.

Fix:

Disabling everything isn't always an option. If you have a MCP (multiple core processor), you can change the cores programs access and execute on.

Step 1:
Download and install Process Explorer (There are other applications but I won't cover them (I don't use them either)). This is a Microsoft endorsed tool, essentially an extension to taskmanager with some extra features. It is safe to use, for those who are doubtful about using 'special' software.
http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

Step 2:
Open Audiosurf and Process Explorer

Step 3:
Find Questviewer.exe in the process list


Step 4:
Right click on Questviwer.exe and select "Set Affinity"


Step 5:
Limit the cores Audiosurf executes on to one. Note, you can set this to any core though I recommend choosing any other than the first, ie core 0.
The majority of single threaded applications and your OS default to core 0, thus setting AS elsewhere means it won't be disturbed (as much) by background and OS usage spikes.


Oddly enough, AS can show increased performance and frames when run in a single core state.

Note:

You will have to do this every time you launch Audiosurf. (Mincus has a batch script about that can automate the process)


Side note:

When using Fraps and other screen recorders, limit those to a separate core to AS to minimise their interference with CPU access.



There's more detail to the how and why I've missed out for the sake of simplicity.
« Last Edit: November 04, 2011, 03:54:03 am by blue_h3x »
Australia is kinda awesome, but it's no Yorkshire.

NovaTerran

  • Hero Member
  • *****
  • Posts: 537
    • View Profile
Re: [FIX] Lag issues, frame skips, random pauses - set core affinity how-to
« Reply #1 on: November 03, 2011, 06:15:27 pm »
Sweet, thanks a lot bud.

Mincus

  • Hero Member
  • *****
  • Posts: 2634
    • View Profile
Re: [FIX] Lag issues, frame skips, random pauses - set core affinity how-to
« Reply #2 on: November 03, 2011, 06:51:18 pm »
Just as a note for those not wanting to bother with Process Explorer, this can be done from Task Manager.
Easiest way to open task manager is from the start bar, just right click on it:


Select the 'Processes' tab:


Find 'QuestViewer.exe' (or your recording software's process -- Fraps actually has 2 'fraps.exe' and either 'fraps64.dat' or 'fraps32.dat') then right-click and select 'Set Affinity':


And set the affinity to a core other than 0 (2 is the best bet):


As stated by h3x, this does need to be done every time you run Audiosurf. Questviewer is a pain in the neck. ;)
It's also only useful for multi-core CPUs, although I don't think there are many people left with single-cores around anyway.

If you have one of the i3/5/7 CPUs with hyperthreading then you'll see twice as many cores as the CPU actually has (for instance h3x shows 8 but actually has 4) in this case you want to push Audiosurf onto a multiple of 2 (so 2, 4 or 6). The exact reasons are down to how hyperthreading works and somewhat complicated.

As a final note, old single-core Pentium 4s that use hyperthreading will show 2 cores when they only have 1. This trick won't help those (and may even make things worse).

Edit: Spambot made me notice an error.
« Last Edit: June 18, 2013, 12:57:53 pm by Mincus »

ViRUS

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3402
    • MSN Messenger - newvirus@live.com.ar
    • View Profile
    • Email
Re: [FIX] Lag issues, frame skips, random pauses - set core affinity how-to
« Reply #3 on: November 03, 2011, 08:48:28 pm »
Stuck, good job guys.


Mincus

  • Hero Member
  • *****
  • Posts: 2634
    • View Profile
Re: [FIX] Lag issues, frame skips, random pauses - set core affinity how-to
« Reply #4 on: November 04, 2011, 03:00:10 am »
Since this topic has been stickied and the newer AMD 4/6-core crash is related with the fix being affinity based, I'll add the batch files h3x mentioned for setting the affinity on run. Currently they're spread across several topics, so having them together and stickied makes sense.

Win7/Vista fix:
 - Download the attached audiosurf-affinity-win7vista.bat
 - Copy it to Audiosurf's directory (from your Steam install: Steam\steamapps\common\audiosurf)
 - Make sure Steam is running.
 - Run audiosurf-affinity-win7vista.bat (you can make a shortcut to it on your desktop or in your start menu if you want).

Windows XP fix
XP is more complicated as it doesn't come with the tools that Windows 7 and Vista do.
 - Download PsTools from this link: http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx (this is a Microsoft endorsed tool, from their technet website, so it's safe to use).
 - Copy PsExec.exe from inside PsTools.zip to Audiosurf's directory (from your Steam install: Steam\steamapps\common\audiosurf)
 - Download and copy audiosurf-affinity-xp.bat to Audiosurf's directory.
 - Make sure Steam is running.
 - Run audiosurf-affinity-xp.bat (you can make a shortcut to it on your desktop or in your start menu if you want).
 - The first time you run PsExec.exe you will need to agree to its licence (pretty standard stuff, nothing draconian, I suggest just clicking 'agree').


A final note on the batch files, they do use core 1, which isn't ideal on a CPU with hyperthreading.
If you're having problems, right-click the .bat file, select 'edit' and it will open in notepad.
Change the '1' to a '2' and see if that helps.
« Last Edit: November 22, 2012, 10:31:28 am by Mincus »

GeoLuz

  • Sr. Member
  • ****
  • Posts: 374
    • View Profile
Re: [FIX] Lag issues, frame skips, random pauses - set core affinity how-to
« Reply #5 on: November 04, 2011, 09:49:34 am »
Thanks, Mincus and blue_h3x. I'll look into the fix to solve the problem of random pauses. I had written a post about this problem recently.
YouTube
ERtrysDynat told me to do it.

SurfinOnBeatzzz

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: [FIX] Lag issues, frame skips, random pauses - set core affinity how-to
« Reply #6 on: November 10, 2011, 02:49:37 pm »
Problem still not fixed. Tried every single core. This is annoying...
Games Radar: "Audiosurf is a near religious musical gaming experience"
Amen to that.

blue_h3x

  • Hero Member
  • *****
  • Posts: 5165
    • View Profile
    • AS Tournament
Re: [FIX] Lag issues, frame skips, random pauses - set core affinity how-to
« Reply #7 on: November 10, 2011, 03:01:39 pm »
Problem still not fixed. Tried every single core. This is annoying...

Please start a new thread posting your system specs and as much info as possible.
Australia is kinda awesome, but it's no Yorkshire.

justinrpg

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • Email
Re: [FIX] Lag issues, frame skips, random pauses - set core affinity how-to
« Reply #8 on: February 10, 2014, 02:23:03 pm »
I have a problem that nobody have yet to post. If I select any affinity other than 0, it disables all audio whatsoever in Audiosurf.
« Last Edit: February 10, 2014, 10:44:15 pm by ViRUS »

ViRUS

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3402
    • MSN Messenger - newvirus@live.com.ar
    • View Profile
    • Email
Re: [FIX] Lag issues, frame skips, random pauses - set core affinity how-to
« Reply #9 on: February 10, 2014, 10:44:58 pm »
Our eyes are just fine, so please don't write all in caps and using multiple exclamation marks. It's quite an offense on internet forums.