Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playing ogg vorbis music stream stutters #15847

Closed
imekon opened this issue Jan 18, 2018 · 25 comments
Closed

Playing ogg vorbis music stream stutters #15847

imekon opened this issue Jan 18, 2018 · 25 comments

Comments

@imekon
Copy link

imekon commented Jan 18, 2018

Godot V3.0 RC1

Windows 10

Play a simple ogg vorbis stream, it plays in left channel only and stutters. Same setup works fine on same hardware in V2.1.4 official release.

Steps to reproduce:
streamPlayer.stream = musicStream
streamPlayer.play()

Minimal reproduction project:

MusicPlayerRC1.zip

@reduz
Copy link
Member

reduz commented Jan 18, 2018 via email

@imekon
Copy link
Author

imekon commented Jan 18, 2018

Yes, tried reencoding. Still stutters and comes out of left channel only.

@mrcdk
Copy link
Contributor

mrcdk commented Jan 18, 2018

You are using an AudioStreamPlayer2D which is used to play 2D positional audio. Its postion is top-left so that's why it plays only in the left channel. You need to use an AudioStreamPlayer to play music.

@imekon
Copy link
Author

imekon commented Jan 18, 2018

That fixed the left channel only playing, however it still stutters. Since it's playing at a slower speed, I think it's dropping audio blocks.

@mrcdk
Copy link
Contributor

mrcdk commented Jan 18, 2018

I can't reproduce the stutters https://streamable.com/xmeyx

@vnen
Copy link
Member

vnen commented Jan 18, 2018

Doesn't stutter for me. Tried to change the sample rate of my audio interface, but in any config it still plays fine.

Is there any message in the console window/output panel?

@imekon
Copy link
Author

imekon commented Jan 18, 2018

This is all that appears in the console:

OpenGL ES 3.0 Renderer: GeForce GTX 970/PCIe/SSE2
GLES3: max ubo light: 409
GLES3: max ubo reflections: 455, ubo size: 144
ARVR: Registered interface: Native mobile
OPENING: D:/samples/godot/MusicPlayerRC1 (D:::samples::godot::MusicPlayerRC1)
running cmdline: "D:\tools\godot 3.0 rc\Godot_v3.0-rc1_win64.exe" "--path" "D:/samples/godot/MusicPlayerRC1" "--editor"
OpenGL ES 3.0 Renderer: GeForce GTX 970/PCIe/SSE2
GLES3: max ubo light: 409
GLES3: max ubo reflections: 455, ubo size: 144
ARVR: Registered interface: Native mobile
erasing C:\Users\goodwin\AppData\Roaming/Godot/projects/MusicPlayerRC1-567aab528bb594fb906e52a45e61b280/filesystem_update3
Running: D:\tools\godot 3.0 rc\Godot_v3.0-rc1_win64.exe --path D:/samples/godot/MusicPlayerRC1 --remote-debug 127.0.0.1:6007 --allow_focus_steal_pid 8064 --position 448,240
running cmdline: "D:\tools\godot 3.0 rc\Godot_v3.0-rc1_win64.exe" "--path" "D:/samples/godot/MusicPlayerRC1" "--remote-debug" "127.0.0.1:6007" "--allow_focus_steal_pid" "8064" "--position" "448,240"
OpenGL ES 3.0 Renderer: GeForce GTX 970/PCIe/SSE2
GLES3: max ubo light: 409
GLES3: max ubo reflections: 455, ubo size: 144
ARVR: Registered interface: Native mobile

I'm guessing this is specific to my hardware (ugh), so I'll try this on my laptop when I next get to it (in a few days). I may try a different encoder - I'm using audacity.

@leiget
Copy link

leiget commented Jan 19, 2018

Maybe try a different song. Here's some: http://www.vorbis.com/music/

@imekon
Copy link
Author

imekon commented Jan 19, 2018

I tried a couple from http://www.vorbis.com/music/, same stuttering.

@marcelofg55
Copy link
Contributor

I tested on Windows and Mac and I got no stuttering with that project.
It plays on the left speaker only too here, but if I use a AudioStreamPlayer node instead of a AudioStreamPlayer2D node it plays on both speakers correctly.

@imekon
Copy link
Author

imekon commented Jan 19, 2018

Anyway to change output to XAudio2 or RtAudio? Project config only shows WASAPI and it's a string not a dropdown. I did try XAudio2 or RtAudio but they didn't work.

@marcelofg55
Copy link
Contributor

Try with the string RtAudio-DirectSound in the project config.

@imekon
Copy link
Author

imekon commented Jan 19, 2018

Woohoo! That did it, it's playing perfectly now!

@marcelofg55
Copy link
Contributor

That's odd, I wonder why its stuttering for you with WASAPI driver.. what audio card do you have?

@imekon
Copy link
Author

imekon commented Jan 19, 2018

I have a USB Terratec DMX 6Fire sound card.

@marcelofg55
Copy link
Contributor

What frequency is Windows using for your card? 192 kHz?

@reduz
Copy link
Member

reduz commented Jan 19, 2018 via email

@imekon
Copy link
Author

imekon commented Jan 19, 2018

The frequency is 176400Hz, that seems to be the default for Windows 10.

from my time doing audio software

I used to work for Sensaura, on WDM device drivers for audio, then audio at Codemasters for various racing games.

@marcelofg55
Copy link
Contributor

The frequency is 176400Hz, that seems to be the default for Windows 10.

Can you test with a lower frequency, 44100 Hz or 48000 Hz? thanks!

@imekon
Copy link
Author

imekon commented Jan 19, 2018

I just spent the last 10 minutes with no audio after changing frequency to anything other than 176.4kHz.
It simply says for 44100 "not supported". Bit strange it shows it in the drop down list then.
Once I set it back to 176.4kHz, shutdown, wait for everything to switch off, then restart, eventually I got audio back.
It's an old sound card... maybe I should consider upgrading... I like it because it has so many external inputs.

@leiget
Copy link

leiget commented Jan 20, 2018

41000 not supported?! It's the most supported rate out there. Weird. It sounds like some setting or driver problem somewhere.

@imekon
Copy link
Author

imekon commented Jan 21, 2018

Checked this on my laptop - no stutter with WASAPI. I think the fault is with my dodgy sound card.

@imekon imekon closed this as completed Jan 21, 2018
@akien-mga akien-mga added this to the 3.0 milestone Jan 21, 2018
@hedin-hiervard
Copy link
Contributor

hedin-hiervard commented Aug 1, 2020

Same here. Godot 3.2 / 3.2.2, on ONE Windows machine .ogg playback with 44100 Hz samplerate is slow/sluttering. Tried changing audio driver string to RtAudio-DirectSound - nothing changes. I have this in the logs:

**WARNING**: WASAPI: Unsupported number of channels: 1
   At: drivers/wasapi/audio_driver_wasapi.cpp:330:init_render_device() - WASAPI: Unsupported number of channels: 1

UPD: the problem only manifests itself with a certain audio-device (Usb headset), on an internal Realtek audio-card the output is fine.

@Calinou
Copy link
Member

Calinou commented Aug 1, 2020

Tried changing audio driver string to RtAudio-DirectSound - nothing changes.

As far as I know, RtAudio is no longer present in Godot since 3.1. There's an XAudio driver but it's not compiled in by default, and I doubt it still works in the current state of things.

UPD: the problem only manifests itself with a certain audio-device (Usb headset), on an internal Realtek audio-card the output is fine.

Try changing the device's output sample rate. USB headsets embed their own sound card, which means they're seen as additional output devices (like HDMI audio).

@hedin-hiervard
Copy link
Contributor

hedin-hiervard commented Aug 1, 2020

Try changing the device's output sample rate. USB headsets embed their own sound card, which means they're seen as additional output devices (like HDMI audio).

The problem was narrowed to down to a device having mono-output (1 channel). So logically those headphones have 2 output devices: one is chat (mono) the second is game (stereo). Both have 48k output rate. Chat device output is buggy, the game output is fine. Chat also shows this in the logs:

**WARNING**: WASAPI: Unsupported number of channels: 1
   At: drivers/wasapi/audio_driver_wasapi.cpp:330:init_render_device() - WASAPI: Unsupported number of channels: 1

So basically Godot doesn't play well with WASAPI mono devices. I have no idea how to fix that..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants