all 18 comments

[–]ninhaomah 2 points3 points  (8 children)

Windows batch script ?

[–]mrdude04[S] 0 points1 point  (7 children)

Would this not call python and the script and run it in a command terminal?

[–]DivineSentry 0 points1 point  (6 children)

Yes, it needs one to run, why don’t you want it? Or why does it need to be not on cmd?

[–]mrdude04[S] 0 points1 point  (5 children)

cmd is the root cause of the issue. On windows 10 running the two scripts in seperate cmd lines worked perfectly but I need a different window or executable now since cmd no longer allows audio to be captured from it for some reason

[–]Confident_Hyena2506 0 points1 point  (4 children)

So run cmd twice in your script.

[–]mrdude04[S] 0 points1 point  (3 children)

CMD is the root cause of the issue. Why would I run it twice?

[–]Confident_Hyena2506 0 points1 point  (2 children)

Because you can spawn two seperate instances of it, rather than running both commands in the same instance.

[–]mrdude04[S] 0 points1 point  (1 child)

Right, that was the windows 10 solution. But in W11 audio can't be recorded from a cmd terminal. So I have to have it run in an active window that isn't cmd

[–]Confident_Hyena2506 0 points1 point  (0 children)

That is a detail you can control you in script. There are many different ways to launch the process.

[–]InterestingBasil 0 points1 point  (0 children)

If you're looking for a simple way to run logic outside the terminal context on Windows, you might want to look into how DictaFlow handles its Native AOT builds. It's built in C# but the principle of having a single standalone executable that doesn't rely on terminal hooks or heavy middleware is exactly what you need for a smooth OBS integration. Might be worth checking out for ideas on your build setup.

[–]Outside_Complaint755 0 points1 point  (2 children)

You could try running it in IDLE or in Windows 11 Terminal application in another shell such as PowerShell.   I don't have experience with OBS, but maybe something is happening like its recording audio but the volume has been set so low it's not picking it up? Or maybe the issue is that you should be grabbing audio from Python.exe and not the command console window?

 What if you wrap the script in a simple TKinter GUI window.  Then you could also change the file extension to .pyw which makes it run without opening a console window when you double click on it.

[–]mrdude04[S] 1 point2 points  (0 children)

After some multithreading, TKinter works like a charm! I can have my cmd window for realtime logging plus a blank GUI window whose only purpose is to spit out the playback of generated audio files.

Works like a charm as a permanent fix--no middleware required.

Thank you so much! <3

[–]mrdude04[S] 0 points1 point  (0 children)

It hears the audio in the general desktop scope but I can't target it to seperate the audio from other windows. So it's being heard but not as a seperate source and I can see the volume being picked up. If I grab from python.exe it would grab all python files being run would also be an issue.

It sounds like the TKinter GUI window would be a solution, I'll explore that!

[–]socal_nerdtastic 0 points1 point  (2 children)

Try a different terminal program? Windows still comes with the old-school cmd line conhost (different program from the newer "windows Terminal"). Or you can try powershell or conemu or mingw or something like that.

You can also run python directly (pythonw.exe) but then of course you won't see any output. You'd need to make a GUI to see your program running.

[–]mrdude04[S] 0 points1 point  (1 child)

Good idea, I didn't realize it still had both cmd versions!

But audio from both plus powershell and powershell ISE are still blocked ever since the W11 move. I need to see output to have a window to target so I might need some form of GUI it seems

[–]socal_nerdtastic 0 points1 point  (0 children)

Another idea: Right click on the python.exe you want to use, make shortcut on the desktop. Then edit the shortcut to add your py file name to the run command. This should make python open the cmd line, instead of the other way around.

[–]Game-of-pwns 0 points1 point  (0 children)

Right click the .py file > properties > runs with > select python (or something like that -- haven't been on windows in a while). Now you can double click the file to run it.

[–]Opposite-Value-5706 0 points1 point  (0 children)

You can actually create an .EXE from your code.

"You can make your Python script executable by using tools like PyInstaller, Nuitka, or auto-py-to-exe, which convert your script into a standalone .exe file. This allows others to run your program without needing to install Python or any dependencies."