Audio SDL: Video editor Sound muted without muting it #66786

Closed
opened 2019-07-12 17:42:21 +02:00 by AnityEx · 26 comments

System Information
Operating system: Windows-10-10.0.17134 64 Bits
Graphics card: GeForce GTX 1060 3GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 388.13

Blender Version
Broken: version: 2.80 (sub 74), branch: master, commit date: 2019-07-11 13:50, hash: 06312c6d2d
Worked: 2.79b

Short description of error
Audio playback not making any sound

Exact steps for others to reproduce the error
add a image strip and then a mp4 video file or only the mp4 file, it just doesn't sound at all by any means
filenotworking.blend

**System Information** Operating system: Windows-10-10.0.17134 64 Bits Graphics card: GeForce GTX 1060 3GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 388.13 **Blender Version** Broken: version: 2.80 (sub 74), branch: master, commit date: 2019-07-11 13:50, hash: `06312c6d2d` Worked: 2.79b **Short description of error** Audio playback not making any sound **Exact steps for others to reproduce the error** add a image strip and then a mp4 video file or only the mp4 file, it just doesn't sound at all by any means [filenotworking.blend](https://archive.blender.org/developer/F7603346/filenotworking.blend)
Author

Added subscriber: @AnityEx

Added subscriber: @AnityEx

#67133 was marked as duplicate of this issue

#67133 was marked as duplicate of this issue

Added subscribers: @Sergey, @neXyon, @mano-wii

Added subscribers: @Sergey, @neXyon, @mano-wii

With the sound output through HDMI the file worked without problems.
But then I decided to try with a headset and the sound continued to come from the screen through the HDMI (while in other programs the sound came out through the headset).
So I went into Preferences->System->Audio Device and even choosing the same Device something updates and the sound goes out through the headset normally.

The problem must be related, but (I don't understand anything about this area).
@neXyon, @Sergey any idea?

With the sound output through HDMI the file worked without problems. But then I decided to try with a headset and the sound continued to come from the screen through the HDMI (while in other programs the sound came out through the headset). So I went into `Preferences->System->Audio Device` and even choosing the same `Device` something updates and the sound goes out through the headset normally. The problem must be related, but (I don't understand anything about this area). @neXyon, @Sergey any idea?
Member

@AnityEx which audio device/backend (OpenAL or SDL) are you using and does it work if you switch it under Preferences->System->Audio Device?

@mano-wii this sounds like a different bug, but same question for you. Switch the device/backend in the preferences and then try to switch between headset and screen to check if it has the same problem.

@AnityEx which audio device/backend (OpenAL or SDL) are you using and does it work if you switch it under Preferences->System->Audio Device? @mano-wii this sounds like a different bug, but same question for you. Switch the device/backend in the preferences and then try to switch between headset and screen to check if it has the same problem.

The sound plays back on both macOS and Linux for me (both default OpenAL). So doesn't seem this is anything to do with the dependency graph integration or the RC build itself.

The sound plays back on both macOS and Linux for me (both default OpenAL). So doesn't seem this is anything to do with the dependency graph integration or the RC build itself.
Author

@neXyon SDL Does not work at all, but OpenAl and openAl-soft do work

@neXyon SDL Does not work at all, but OpenAl and openAl-soft do work

In #66786#720451, @neXyon wrote:
@mano-wii this sounds like a different bug, but same question for you. Switch the device/backend in the preferences and then try to switch between headset and screen to check if it has the same problem.

The same situation is seen with OpenAL and OpenAL-Soft.
If I load Blender with the headset already plugged in. The sound comes from the headset.

SDL is mute both on the headset and on the screen.

> In #66786#720451, @neXyon wrote: > @mano-wii this sounds like a different bug, but same question for you. Switch the device/backend in the preferences and then try to switch between headset and screen to check if it has the same problem. The same situation is seen with `OpenAL` and `OpenAL-Soft`. If I load Blender with the headset already plugged in. The sound comes from the headset. `SDL` is mute both on the headset and on the screen.
Member

Added subscriber: @LazyDodo

Added subscriber: @LazyDodo
Member

Okay, from what I gather from both of you now is that OpenAL works, but SDL does not on Windows. @LazyDodo can you check if SDL works on windows or if it's not? Maybe we need a library update on windows?

As for the plugging in headsets @mano-wii, there's nothing we can do. The only thing you could try to do is to open an issue for OpenAL soft, there is already a similar one as far as I checked: https://github.com/kcat/openal-soft/issues/291

Okay, from what I gather from both of you now is that OpenAL works, but SDL does not on Windows. @LazyDodo can you check if SDL works on windows or if it's not? Maybe we need a library update on windows? As for the plugging in headsets @mano-wii, there's nothing we can do. The only thing you could try to do is to open an issue for OpenAL soft, there is already a similar one as far as I checked: https://github.com/kcat/openal-soft/issues/291

Added subscriber: @TheKlikluk

Added subscriber: @TheKlikluk

Added subscriber: @you.le

Added subscriber: @you.le

I just tested on windows. By default, openAL is selected on my computer and the sound plays normally. If I select SDL, the sound is not played whereas the sound is played both with openAL and SDL in 2.79b. When I replace 2.8 SDL2.dll with 2.79b SDL2.dll, the sound works correctly both with openAL and SDL in 2.8. Then it seems to come from SDL2 lib update in 2.8 I think

I just tested on windows. By default, openAL is selected on my computer and the sound plays normally. If I select SDL, the sound is not played whereas the sound is played both with openAL and SDL in 2.79b. When I replace 2.8 SDL2.dll with 2.79b SDL2.dll, the sound works correctly both with openAL and SDL in 2.8. Then it seems to come from SDL2 lib update in 2.8 I think
Ray molenkamp was assigned by Joerg Mueller 2019-07-18 08:43:35 +02:00
Philipp Oeser changed title from Video editor Sound muted without muting it to Audio SDL: Video editor Sound muted without muting it 2019-09-03 14:21:33 +02:00

Changed status from 'Needs Developer To Reproduce' to: 'Confirmed'

Changed status from 'Needs Developer To Reproduce' to: 'Confirmed'

Added subscriber: @iss

Added subscriber: @iss

I should have clarified, thatI tested this on windows

I should have clarified, thatI tested this on windows
Member

In #66786#720955, @neXyon wrote:
Okay, from what I gather from both of you now is that OpenAL works, but SDL does not on Windows. @LazyDodo can you check if SDL works on windows or if it's not? Maybe we need a library update on windows?

Audaspace request AUDIO_S16SYS , SDL goes best I can do is AUDIO_F32LSB and audaspace goes , FINE no audio.

the SDL documentation says

If obtained is NULL, the audio data passed to the callback function will be guaranteed to be in the requested format, and will be automatically converted to the actual hardware audio format if necessary. If obtained is NULL, desired will have fields modified.

Did a quick test, and it indeed restored audio with SDL, but most of the SDLDevice ctor code can/should be removed so i'll leave it to @neXyon to do a proper cleanup there.

> In #66786#720955, @neXyon wrote: > Okay, from what I gather from both of you now is that OpenAL works, but SDL does not on Windows. @LazyDodo can you check if SDL works on windows or if it's not? Maybe we need a library update on windows? Audaspace request `AUDIO_S16SYS` , SDL goes best I can do is `AUDIO_F32LSB` and audaspace goes , *FINE* no audio. the [SDL documentation ](https://wiki.libsdl.org/SDL_OpenAudio) says ``` If obtained is NULL, the audio data passed to the callback function will be guaranteed to be in the requested format, and will be automatically converted to the actual hardware audio format if necessary. If obtained is NULL, desired will have fields modified. ``` Did a quick test, and it indeed restored audio with SDL, but most of the `SDLDevice` ctor code can/should be removed so i'll leave it to @neXyon to do a proper cleanup there.
Ray molenkamp removed their assignment 2020-06-03 21:24:08 +02:00
Joerg Mueller was assigned by Ray molenkamp 2020-06-03 21:24:08 +02:00
Member

Ah, we're on SDL 2 now, and SDL 2 has new audio sample formats. Originally, the SDL backend was implemented for SDL 1.2 which had only 8 and 16 bit sample formats . If we're using SDL 2 now, it makes sense to update.

@LazyDodo can you please elaborate why and which code of the ctor should be removed? I think it should rather be extended to support the new sample formats... So, please try if this patch works for you: sdl_2.diff

Cheers

Ah, we're on SDL 2 now, and SDL 2 has new audio sample formats. Originally, the SDL backend was implemented for SDL 1.2 which [had only 8 and 16 bit sample formats ](https://www.libsdl.org/release/SDL-1.2.15/docs/html/sdlaudiospec.html). If we're using SDL 2 now, it makes sense to update. @LazyDodo can you please elaborate why and which code of the ctor should be removed? I think it should rather be extended to support the new sample formats... So, please try if this patch works for you: [sdl_2.diff](https://archive.blender.org/developer/F8576903/sdl_2.diff) Cheers
Member

Given SDL is guaranteed to give us the format we want as long as we don't give it an opportunity to tell us otherwise, i was planning to go with

diff --git a/extern/audaspace/plugins/sdl/SDLDevice.cpp b/extern/audaspace/plugins/sdl/SDLDevice.cpp
index 603e16001b8..fe6deb54b24 100644
--- a/extern/audaspace/plugins/sdl/SDLDevice.cpp
+++ b/extern/audaspace/plugins/sdl/SDLDevice.cpp
@@ -58,7 +58,7 @@ SDLDevice::SDLDevice(DeviceSpecs specs, int buffersize) :
 
 	m_specs = specs;
 
-	SDL_AudioSpec format, obtained;
+	SDL_AudioSpec format;
 
 	format.freq = m_specs.rate;
 	if(m_specs.format == FORMAT_U8)
@@ -70,21 +70,9 @@ SDLDevice::SDLDevice(DeviceSpecs specs, int buffersize) :
 	format.callback = SDLDevice::SDL_mix;
 	format.userdata = this;
 
-	if(SDL_OpenAudio(&format, &obtained) != 0)
+	if(SDL_OpenAudio(&format, NULL) != 0)
 		AUD_THROW(DeviceException, "The audio device couldn't be opened with SDL.");
 
-	m_specs.rate = (SampleRate)obtained.freq;
-	m_specs.channels = (Channels)obtained.channels;
-	if(obtained.format == AUDIO_U8)
-		m_specs.format = FORMAT_U8;
-	else if(obtained.format == AUDIO_S16LSB || obtained.format == AUDIO_S16MSB)
-		m_specs.format = FORMAT_S16;
-	else
-	{
-		SDL_CloseAudio();
-		AUD_THROW(DeviceException, "The sample format obtained from SDL is not supported.");
-	}
-
 	create();
 }
 
Given SDL is guaranteed to give us the format we want as long as we don't give it an opportunity to tell us otherwise, i was planning to go with ``` diff --git a/extern/audaspace/plugins/sdl/SDLDevice.cpp b/extern/audaspace/plugins/sdl/SDLDevice.cpp index 603e16001b8..fe6deb54b24 100644 --- a/extern/audaspace/plugins/sdl/SDLDevice.cpp +++ b/extern/audaspace/plugins/sdl/SDLDevice.cpp @@ -58,7 +58,7 @@ SDLDevice::SDLDevice(DeviceSpecs specs, int buffersize) : m_specs = specs; - SDL_AudioSpec format, obtained; + SDL_AudioSpec format; format.freq = m_specs.rate; if(m_specs.format == FORMAT_U8) @@ -70,21 +70,9 @@ SDLDevice::SDLDevice(DeviceSpecs specs, int buffersize) : format.callback = SDLDevice::SDL_mix; format.userdata = this; - if(SDL_OpenAudio(&format, &obtained) != 0) + if(SDL_OpenAudio(&format, NULL) != 0) AUD_THROW(DeviceException, "The audio device couldn't be opened with SDL."); - m_specs.rate = (SampleRate)obtained.freq; - m_specs.channels = (Channels)obtained.channels; - if(obtained.format == AUDIO_U8) - m_specs.format = FORMAT_U8; - else if(obtained.format == AUDIO_S16LSB || obtained.format == AUDIO_S16MSB) - m_specs.format = FORMAT_S16; - else - { - SDL_CloseAudio(); - AUD_THROW(DeviceException, "The sample format obtained from SDL is not supported."); - } - create(); } ```
Member

This changes behavior... So far we had it take the closest possible configuration, in the hope we can support it. That's the more user friendly solution, especially when people don't want to bother with the details of these settings.

Also your patch won't solve the issue, SDL still wouldn't work with this, since apparently the audio device in question only supports the float sample format, which is not implemented in this patch.

Did you try my patch? If not please do!

This changes behavior... So far we had it take the closest possible configuration, in the hope we can support it. That's the more user friendly solution, especially when people don't want to bother with the details of these settings. Also your patch won't solve the issue, SDL still wouldn't work with this, since apparently the audio device in question only supports the float sample format, which is not implemented in this patch. Did you try my patch? If not please do!
Member

Also your patch won't solve the issue, SDL still wouldn't work with this, since apparently the audio device in question only supports the float sample format, which is not implemented in this patch.

We don't need to, SDL does the conversion for us

Did you try my patch? If not please do!

Not yet, I'll try to do so tonight

> Also your patch won't solve the issue, SDL still wouldn't work with this, since apparently the audio device in question only supports the float sample format, which is not implemented in this patch. We don't need to, SDL does the conversion for us > Did you try my patch? If not please do! Not yet, I'll try to do so tonight
Member

You're right, it could do the conversion. It may also change the number of channels and resample to a different sampling rate though. All of this can possibly deteriorate the quality. For example, we want to render 3D audio to the correct speaker setup that SDL outputs with and not to a wrong one and then SDL somehow changes the channel configuration resulting in a suboptimal listening experience. That's why we would rather do these things ourselves rather than having SDL do it.

You're right, it could do the conversion. It may also change the number of channels and resample to a different sampling rate though. All of this can possibly deteriorate the quality. For example, we want to render 3D audio to the correct speaker setup that SDL outputs with and not to a wrong one and then SDL somehow changes the channel configuration resulting in a suboptimal listening experience. That's why we would rather do these things ourselves rather than having SDL do it.
Member

Sorry took a few days, can confirm your patch works !

Sorry took a few days, can confirm your patch works !

This issue was referenced by 68fae13d9b

This issue was referenced by 68fae13d9b414f8f0722c60901858b4b236ee31f

This issue was referenced by fe3ca3f6ce

This issue was referenced by fe3ca3f6cef9a852ee0596b28341c519c7870d9c
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
8 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#66786
No description provided.