Audio system issues - Fixed in 1.0.3!

Official support for: bitwig.com
RELATED
PRODUCTS

Post

I just posted this in this thread about the audio interfaces not showing up, but I figured it deserved a topic to itself because if Bitwig sees this.. I have all the answers about how to fix their engine so these issues won't happen anymore!

Okay so the issues are two-fold and I'm pretty sure they are only aware of one of them. When the Bitwig engine is queried to find what audio devices exist the resulting XML is not valid.

Example:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<Io>
   <HostApis>
      <HostApi id="0" name="ASIO" deviceCount="4" defaultInputDevice="0" defaultOutputDevice="0" />
      <HostApi id="1" name="Windows WASAPI" deviceCount="23" defaultInputDevice="20" defaultOutputDevice="4" />
   </HostApis>
    USB\VID_23E8&PID_0100\0001002008080
    USB\VID_23E8&PID_0100\0001002008080
</Io>
The lines with USB\VID in them break this XML, so whatever XML interpreter Bitwig is using freaks out and basically returns nothing - in this case you get no selectable Audio Systems in the preferences. Due to a response on that other thread, I believe Bitwig is already aware of this issue.. but..

This is not the only issue!

They also aren't sanitizing inputs, which means in some cases you get things like...

Code: Select all

<AudioDevice id="3" name="FirePod ASIO x64" hostApi="ASIO" numInputs="10" numOutputs="10" defaultInputLatency="0.017415" defaultOutputLatency="0.017415" defaultSampleRate="44100.0" supportedSampleRates="44100,48000,88200,96000">
         <BufferSize min="768" max="768" preferred="768" granularity="0" />
         <Inputs>
            <Input name="LineIn 1&2 left" />
Anyone see the issue? Probably not. The Input listed here has name="LineIn 1&2 left", well you're not allowed to have ampersands within values in XML. This issue will only happen with devices that return names with ampersands.. so it's not going to happen to everyone. When this happens it will make it so you can't select any audio interfaces. Again, the engine freaks out at the invalid XML and crashes.

I wrote a quick script (windows only) that patches this issue by redirecting all calls to the bitwig engine through my script and then manually fixes these issues with regular expressions. This isn't a solution though! I can't provide this script to you guys because it only works due to me custom coding it for my specific issues. The crux of the problem is that I can't just remove/replace ampersands within the resulting XML because that could also replace ampersands getting returned from other parts of the engine or in places where they are valid - and that would screw things up in a whole different set of ways.

To prove I'm not just making this stuff up - here's me adding in my patch script and you can see the resulting XML is fixed (no more USB\VID lines)
Image

And after doing that the problems are completely fixed!
Image

Another interesting thing.. after fixing this I reverted the engine exe's back to their original version and somehow it's still working in Bitwig. Perhaps they are caching the results of these queries?

TL;DR: The issues people are having with not being able to select things within the Audio Interfaces window in the preferences are due to the Bitwig engine generating invalid XML.
Last edited by trappar on Fri Mar 28, 2014 10:34 pm, edited 1 time in total.

Post

I guess I can post the script I used in case anyone else wants to give it a try. I'm not giving any support for this though. This is totally a hack, and everyone should really just wait for Bitwig to fix the issues.

This is coded in AutoIt. You have to compile this script with the "Console?" flag enabled. Rename the engine exe's (both 32 and 64 bit) to "engine-broken.exe" and place the compiled script where the engine exe used to be. AKA move engine-x86.exe -> engine-broken.exe and this script -> engine-x86.exe.

Here's the code:

Code: Select all

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.8.1
 Author:         trappar

 Script Function:
	Redirect calls to bitwig engine through this script to prune out lines
	which cause audio interfaces to not get detected correctly

#ce ----------------------------------------------------------------------------

#include <File.au3>
#include <Constants.au3>

Local $out, $err

RunWaitGetOutput('engine-broken.exe ' & $CmdLineRaw, @ScriptDir, $out, $err)

$out = StringRegExpReplace($out, "(?m)^\s*USB.*[\n\r]+", "")
$out = StringRegExpReplace($out, "Line(In|Out) (\d+)\&(\d+)", "LineIn $2&$3")

ConsoleWrite($out)

Func RunWaitGetOutput($Program, $WorkingDir, ByRef $StdOut, ByRef $StdErr)
	Local $pid = Run(@ComSpec & " /c " & $Program, $WorkingDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

	While 1
		$StdOut &= StdoutRead($pid)
		If @error Then ExitLoop
	WEnd

	While 1
		$StdErr &= StderrRead($pid)
		If @error Then ExitLoop
	WEnd

	$StdOut = StringStripWS($StdOut, 3)
	$StdErr = StringStripWS($StdErr, 3)

	Return True
EndFunc
Note that the second "StringRegExpReplace" call will only work if your device has the exact same bad formatting as mine did. You can replace that regular expression with one of your own to fix whatever issues result from you running.. "engine-x86 io-devices ASIO > temp.xml" then trying to validate that XML using something like this: http://www.xmlvalidation.com/

Post

Impressive work!

Post

Can't compile anything here. Please PM me damn exe and i'll gladly try it because i can't get bitwig to work at all..

Post

As I said, I'm not supporting this as a real solution. I'm intentionally not posting a compiled exe since this isn't a solution for people who don't know exactly what they are doing. I don't want to be responsible for corrupting your install in any way.

If you're really dead set on trying my script though. Just save the text into a file with a .au3 extension and download/install AutoIt. Then run the Aut2Exe utility (listed in the start menu as something like "Compile AutoIt to Exe"), select the .au3 as the script, and select somewhere to save it to. Enable the "Console?" option, and click Compile. Voila - an exe.

Fortunately I got the following message from user kurasu who (I'm pretty sure) works for Bitwig
kurasu wrote:Very nice work, we've already fixed the issue with the data that shouldn't be there, but I wasn't aware of the sanitizing of the ampersand, good catch!

Thanks,
Claes
So it sounds like we should be expecting a fix for this very soon.

Post

Claes is for sure one of the devs (also made Surge VST :D )

ps.. super nice work.. I don't have the issue myself.. well, not to my knowledge, but yeah very good :)

Post

Not sure if i have this particular problem, but I tried your fix and it doesn't work for me (I couldn't find were to put the Console? flag either, so I hope i did it right)

Can you point me in the right direction?

Code: Select all

C:\Program Files (x86)\Bitwig Studio 1.0.2\bin\x64>engine-x64.exe io-apis
<?xml version="1.0" encoding="UTF-8"?>
<Io>
AudioSM::init nChannels is 0
   <HostApis>
      <HostApi id="0" name="ASIO" deviceCount="4" defaultInputDevice="0" default
OutputDevice="0" />
      <HostApi id="1" name="Windows WASAPI" deviceCount="10" defaultInputDevice=
"13" defaultOutputDevice="4" />
   </HostApis>
</Io>



C:\Program Files (x86)\Bitwig Studio 1.0.2\bin\x64>engine-x64.exe io-devices 'Wi
ndows WASAPI'
<?xml version="1.0" encoding="UTF-8"?>
<Io>
AudioSM::init nChannels is 0
   <AudioDevices>
</Io>

C:\Program Files (x86)\Bitwig Studio 1.0.2\bin\x64>




C:\Program Files (x86)\Bitwig Studio 1.0.2\bin\x64>engine-x64.exe io-devices ASI
O
<?xml version="1.0" encoding="UTF-8"?>
<Io>
AudioSM::init nChannels is 0
   <AudioDevices>
      <AudioDevice id="0" name="ASIO4ALL v2" hostApi="ASIO" numInputs="6" numOut
puts="2" defaultInputLatency="0.01161" defaultOutputLatency="0.01161" defaultSam
pleRate="44100.0" supportedSampleRates="44100,48000,88200,96000,176400,192000">
         <BufferSize min="64" max="2048" preferred="512" granularity="8" />
         <Inputs>
            <Input name="Virus TI Audio 1" />
            <Input name="Virus TI Audio 2" />
            <Input name="Virus TI Audio 3" />
            <Input name="Virus TI Audio 4" />
            <Input name="Virus TI Audio 5" />
            <Input name="Virus TI Audio 6" />
         </Inputs>
         <Outputs>
            <Output name="Virus TI Audio 1" />
            <Output name="Virus TI Audio 2" />
         </Outputs>
      </AudioDevice>
      <AudioDevice id="1" name="EDIROL FA-66" hostApi="ASIO" numInputs="6" numOu
tputs="6" defaultInputLatency="0.00798186" defaultOutputLatency="0.00798186" def
aultSampleRate="44100.0" supportedSampleRates="44100">
         <BufferSize min="352" max="352" preferred="352" granularity="0" />
         <Inputs>
            <Input name="MicIn1 left" />
            <Input name="MicIn1 right" />
            <Input name="LineIn 3&4 left" />
            <Input name="LineIn 3&4 right" />
            <Input name="SpdifIn left" />
            <Input name="SpdifIn right" />
         </Inputs>
         <Outputs>
            <Output name="LineOut 1&2 left" />
            <Output name="LineOut 1&2 right" />
            <Output name="LineOut 3&4 left" />
            <Output name="LineOut 3&4 right" />
            <Output name="SpdifOut left" />
            <Output name="SpdifOut right" />
         </Outputs>
      </AudioDevice>
      <AudioDevice id="2" name="Generic Low Latency ASIO Driver" hostApi="ASIO"
numInputs="2" numOutputs="2" defaultInputLatency="0.02" defaultOutputLatency="0.
02" defaultSampleRate="44100.0" supportedSampleRates="44100,48000,88200,96000,17
6400,192000">
         <BufferSize min="882" max="882" preferred="882" granularity="882" />
         <Inputs>
            <Input name="FA-66 In 3 (FA-66) 1" />
            <Input name="FA-66 In 3 (FA-66) 2" />
         </Inputs>
         <Outputs>
            <Output name="FA-66 Out 1 (FA-66) 1" />
            <Output name="FA-66 Out 1 (FA-66) 2" />
         </Outputs>
      </AudioDevice>
AudioSM::init nChannels is 0
AudioSM::init nChannels is 0
AudioSM::init nChannels is 0
AudioSM::init nChannels is 0
AudioSM::init nChannels is 0
AudioSM::init nChannels is 0
      <AudioDevice id="3" name="Virus USB ASIO driver" hostApi="ASIO" numInputs=
"2" numOutputs="2" defaultInputLatency="0.00290249" defaultOutputLatency="0.0029
0249" defaultSampleRate="44100.0" supportedSampleRates="44100,48000">
         <BufferSize min="128" max="128" preferred="128" granularity="0" />
         <Inputs>
            <Input name="In 1" />
            <Input name="In 2" />
         </Inputs>
         <Outputs>
            <Output name="Out 1" />
            <Output name="Out 2" />
         </Outputs>
      </AudioDevice>
   </AudioDevices>
</Io>

Post

You are definitely getting this same issue. Based on the output of the commands you gave me it looks like you should be able to choose between ASIO and Windows WASAPI in the audio interfaces page in the Bitwig preferences, but you're unable to choose an interface once you select either ASIO or Windows WASAPI? Is this correct?

I'm actually seeing some stuff in there I haven't seen in other logs - all the lines like "AudioSM::init nChannels is 0"

Which could be causing it to not even let you choose between an "Audio System". If you're able to choose an audio system in Bitwig then the compiled script should work for you with no modifications. In order to compile with the console flag you need to open "Compile Script to .exe (x86)" from your start menu or directly open "[autoit install path]\Aut2Exe\Aut2exe.exe"

It should look something like this when you compile:
Image

Please let me know if you're able to choose an audio system! This is potentially yet another bug which the guys at Bitwig may not be aware of!

Post

trappar wrote:You are definitely getting this same issue. Based on the output of the commands you gave me it looks like you should be able to choose between ASIO and Windows WASAPI in the audio interfaces page in the Bitwig preferences, but you're unable to choose an interface once you select either ASIO or Windows WASAPI? Is this correct?

I'm actually seeing some stuff in there I haven't seen in other logs - all the lines like "AudioSM::init nChannels is 0"

Which could be causing it to not even let you choose between an "Audio System". If you're able to choose an audio system in Bitwig then the compiled script should work for you with no modifications. In order to compile with the console flag you need to open "Compile Script to .exe (x86)" from your start menu or directly open "[autoit install path]\Aut2Exe\Aut2exe.exe"

It should look something like this when you compile:
Image

Please let me know if you're able to choose an audio system! This is potentially yet another bug which the guys at Bitwig may not be aware of!
Thanks for the quick help, I can select WASAPI and it works, not good, but at least I get sound..

I don't have the console option on the aut2exe, only 'Compile for system x64'

I downloaded the latest version of AHK from their website..

Any ideas?

Post

This is my aut2exe :

Image

Post

They _just_ released 1.0.3 while I was trying this, and it resolved the issue with no device showing under 'ASIO'...

So I guess this is resolved now, will get back when I tried it!

Post

yes, the fix for both the issues is fixed in 1.0.3.. let us know if you have any other audio interface issues.

Post

kurasu wrote:yes, the fix for both the issues is fixed in 1.0.3.. let us know if you have any other audio interface issues.
Just a quick test and I am able to select my FA-66 under the ASIO drivers now, and it seems to work perfectly on first sight, so thank you for releasing this so late in the evening and just in time for the weekend..

Hats off ! :party:

Post

1.0.3 fixed the audio device issues for me, I'll post in my other thread as well. Woohoo! Now to go play. :)

Post

daytwa wrote:1.0.3 fixed the audio device issues for me, I'll post in my other thread as well. Woohoo! Now to go play. :)
I can confirm it works for me as well! 8)

Post Reply

Return to “Bitwig”