• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

CamillaDSP Windows 7 SPDIF config help

Yes, I did. Changing that resulted in surround malfunction. I tested every setting.

Clipboard01a.jpg

Wasapi found 6 though:

Code:
2024-09-25 14:03:09.314 T:428     debug <general>: Loading settings for e:\videos\tests\Dolby Digital AC-3 5.1.mp4
2024-09-25 14:03:09.314 T:428     debug <general>: CApplicationPlayerCallback::OnAVChange: CApplication::OnAVChange
2024-09-25 14:03:09.317 T:5708    debug <general>: CVideoPlayer::SetCaching - caching state 2
2024-09-25 14:03:09.317 T:5708    debug <general>: CDVDClock::SetSpeedAdjust - adjusted:0.000000
2024-09-25 14:03:09.319 T:5904    debug <general>: Thread BackgroundLoader 5904 terminating
2024-09-25 14:03:09.380 T:1784     info <general>: CActiveAESink::OpenSink - initialize sink
2024-09-25 14:03:09.400 T:5296    debug <general>: ------ Window Init (DialogBusy.xml) ------
2024-09-25 14:03:09.402 T:5296    debug <general>: CRenderManager::DeleteRenderer - deleting renderer
2024-09-25 14:03:09.402 T:5296    debug <general>: CWinRenderer::SelectRenderer: requested render method: 0
2024-09-25 14:03:09.402 T:5296    debug <general>: CWinRenderer::SelectRenderer: selected render method: Pixel Shaders
2024-09-25 14:03:09.403 T:5296    debug <general>: CWIN32Util::GetWindowsHDRStatus: Display is not HDR capable or cannot be detected
2024-09-25 14:03:09.403 T:5296    debug <general>: CRendererBase::CreateIntermediateTarget: intermediate target format 87.
2024-09-25 14:03:09.405 T:5296    debug <general>: CRenderManager::Configure - 6
2024-09-25 14:03:09.406 T:5296    debug <general>: CWinShader::LoadEffect: loading shader special://xbmc/system/shaders/output_d3d.fx
2024-09-25 14:03:09.413 T:5708    debug <general>: CVideoPlayer::HandleMessages - player started 2
2024-09-25 14:03:09.413 T:428     debug <general>: CApplicationPlayerCallback::OnAVChange: CApplication::OnAVChange
2024-09-25 14:03:09.423 T:5296    debug <general>: CWinShader::LoadEffect: loading shader special://xbmc/system/shaders/yuv2rgb_d3d.fx
2024-09-25 14:03:09.432 T:1784    debug <general>: CActiveAESink::OpenSink - trying to open device WASAPI:{A6E41BAF-8434-4786-B62C-7D4FFDA9FACE}
2024-09-25 14:03:09.434 T:1784    debug <general>: CAESinkWASAPI::InitializeExclusive: IsFormatSupported failed (AUDCLNT_E_UNSUPPORTED_FORMAT) - trying to find a compatible format
2024-09-25 14:03:09.434 T:1784    debug <general>: AESinkWASAPI: Input channels are [FL, FR, FC, LFE, SL, SR] - Trying to find a matching output layout
2024-09-25 14:03:09.434 T:1784    debug <general>: AESinkWASAPI: Trying matching channel layout [FL, FR, FC, LFE, SL, SR]
2024-09-25 14:03:09.492 T:1784     info <general>: CAESinkWASAPI::InitializeExclusive: WASAPI Exclusive Mode Sink Initialized using: AE_FMT_S16NE, 48000, 6
2024-09-25 14:03:09.492 T:1784    debug <general>: CActiveAESink::OpenSink - WASAPI Initialized:
2024-09-25 14:03:09.492 T:1784    debug <general>:   Output Device : LineLevel - Line 1 (Virtual Audio Cable)
2024-09-25 14:03:09.492 T:1784    debug <general>:   Sample Rate   : 48000
2024-09-25 14:03:09.492 T:1784    debug <general>:   Sample Format : AE_FMT_S16NE
2024-09-25 14:03:09.492 T:1784    debug <general>:   Channel Count : 6
2024-09-25 14:03:09.492 T:1784    debug <general>:   Channel Layout: FL, FR, FC, LFE, SL, SR
2024-09-25 14:03:09.492 T:1784    debug <general>:   Frames        : 2400
2024-09-25 14:03:09.492 T:1784    debug <general>:   Frame Size    : 12
 
OK then wasapi is the way. What surround malfunction? The log says that kodi outputs AE_FMT_S16NE to the virtual audio cable, logically the same format (S16LE) should be on the capture side set in CDSP. And some integer format for the exclusive mode to the realtek (S16LE is universal for most soundcards to start with).
 
OK then wasapi is the way. What surround malfunction?

I.e. no surround. Stereo.

The log says that kodi outputs AE_FMT_S16NE to the virtual audio cable, logically the same format (S16LE) should be on the capture side set in CDSP. And some integer format for the exclusive mode to the realtek (S16LE is universal for most soundcards to start with).
Id like to however

Code:
E:\>camilladsp stereo.yml
2024-09-25 14:24:57.922219 INFO [src/bin.rs:683] CamillaDSP version 2.0.3
2024-09-25 14:24:57.922219 INFO [src/bin.rs:684] Running on windows, x86_64
2024-09-25 14:24:57.925220 ←[38;5;196mERROR←[0m [src/bin.rs:814] Wasapi shared mode capture must use FLOAT32LE sample format

  capture:
    channels: 6
    device: "Line 1 (Virtual Audio Cable)"
    #device: "S/PDIF 1 (Virtual Audio Cable)"
    format: S16LE
    type: Wasapi
    exclusive: false
    loopback: false

  playback:
    channels: 6
    #device: "Realtek Digital Output (Realtek High Definition Audio)"
    device: "Speakers (C-Media PCI Audio Device)"
    #device: "Digital Output (C-Media PCI Audio Device)"
    format: S16LE
    type: Wasapi
    exclusive: false
 
Of course that's assuming you are using excl mode in CDSP. Why the shared one?
 
Well we're always back to this point. It never worked.

Code:
E:\>camilladsp stereo.yml
2024-09-25 14:42:18.460351 INFO [src/bin.rs:683] CamillaDSP version 2.0.3
2024-09-25 14:42:18.460351 INFO [src/bin.rs:684] Running on windows, x86_64
2024-09-25 14:42:18.520858 ←[38;5;196mERROR←[0m [src/bin.rs:286] Playback error: Playback error: Playback device doesn't support for
mat:
WaveFormat {
    nAvgBytesPerSec: 576000,
    cbSize: 22,
    nBlockAlign: 12,
    wBitsPerSample: 16,
    nSamplesPerSec: 48000,
    wFormatTag: 65534,
    wValidBitsPerSample: 16,
    SubFormat: 00000001-0000-0010-8000-00AA00389B71,
    nChannel: 6,
    dwChannelMask: 63,
}
Error: 0x88890008

----------

  capture:
    channels: 6
    device: "Line 1 (Virtual Audio Cable)"
    #device: "S/PDIF 1 (Virtual Audio Cable)"
    format: S16LE
    type: Wasapi
    exclusive: true
    loopback: false

  playback:
    channels: 6
    #device: "Realtek Digital Output (Realtek High Definition Audio)"
    device: "Speakers (C-Media PCI Audio Device)"
    #device: "Digital Output (C-Media PCI Audio Device)"
    format: S16LE
    type: Wasapi
    exclusive: true

P.S. No more realtek! It's a CMI8738 analog.
 
Make just one change at a time. Does the exclusive capture work? If so, next you can find a supported format for the C-Media controller. Its alsa driver says S16LE and S32LE, 2 to 8 channels https://github.com/torvalds/linux/blob/master/sound/pci/oxygen/oxygen_pcm.c#L56-L82 . But there can be issues with the channel mask, always a problem in wasapi. Or you can keep the shared mode on playback for now, exclusive is just an optional optimization.
 
IMO this channel layout
debug <general>: Channel Layout: FL, FR, FC, LFE, SL, SR

gets converted to channel mask with different bits than decimal 63 because SL/SR correspond to Side Left and Side Right https://github.com/xbmc/xbmc/blob/c...ne/Sinks/windows/AESinkFactoryWin.h#L117-L133 https://learn.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-waveformatextensible#remarks.

Unfortunately CDSP as is does not use the correct channel masks and would require a small hack + recompilation to fix. Maybe later, for now the shared mode should be OK (I guess the C-Media soundcard should be set to 6ch in the windows mixer)
 
Make just one change at a time. Does the exclusive capture work? If so, next you can find a supported format for the C-Media controller. Its alsa driver says S16LE and S32LE, 2 to 8 channels https://github.com/torvalds/linux/blob/master/sound/pci/oxygen/oxygen_pcm.c#L56-L82 . But there can be issues with the channel mask, always a problem in wasapi. Or you can keep the shared mode on playback for now, exclusive is just an optional optimization.
Excellent idea. The capture does work, if alone in exclusive mode.

I tried `S16LE`, `S24LE`, `S24LE3`, `S32LE`, `FLOAT32LE`, `FLOAT64LE` for the playback and none worked.

Code:
E:\>camilladsp.exe stereo.yml
2024-09-25 15:27:25.485599 INFO [src/bin.rs:683] CamillaDSP version 2.0.3
2024-09-25 15:27:25.486099 INFO [src/bin.rs:684] Running on windows, x86_64
2024-09-25 15:27:25.555108 ←[38;5;196mERROR←[0m [src/bin.rs:286] Playback error: Playback error: Playback device doesn't support for
mat:
WaveFormat {
    nAvgBytesPerSec: 576000,
    cbSize: 22,
    nBlockAlign: 12,
    wBitsPerSample: 16,
    nSamplesPerSec: 48000,
    wFormatTag: 65534,
    wValidBitsPerSample: 16,
    SubFormat: 00000001-0000-0010-8000-00AA00389B71,
    nChannel: 6,
    dwChannelMask: 63,
}
Error: 0x88890008
2024-09-25 15:27:25.583112 INFO [src\processing.rs:37] Playback thread has already stopped.

E:\>camilladsp.exe stereo.yml
2024-09-25 15:27:38.414241 INFO [src/bin.rs:683] CamillaDSP version 2.0.3
2024-09-25 15:27:38.414241 INFO [src/bin.rs:684] Running on windows, x86_64
2024-09-25 15:27:38.508753 ←[38;5;196mERROR←[0m [src/bin.rs:286] Playback error: Playback error: Playback device doesn't support for
mat:
WaveFormat {
    nAvgBytesPerSec: 1152000,
    cbSize: 22,
    nBlockAlign: 24,
    wBitsPerSample: 32,
    nSamplesPerSec: 48000,
    wFormatTag: 65534,
    wValidBitsPerSample: 24,
    SubFormat: 00000001-0000-0010-8000-00AA00389B71,
    nChannel: 6,
    dwChannelMask: 63,
}
Error: 0x88890008
E:\>camilladsp.exe stereo.yml
2024-09-25 15:28:02.453794 INFO [src/bin.rs:683] CamillaDSP version 2.0.3
2024-09-25 15:28:02.453794 INFO [src/bin.rs:684] Running on windows, x86_64
2024-09-25 15:28:02.517302 ←[38;5;196mERROR←[0m [src/bin.rs:286] Playback error: Playback error: Playback device doesn't support for
mat:
WaveFormat {
    nAvgBytesPerSec: 864000,
    cbSize: 22,
    nBlockAlign: 18,
    wBitsPerSample: 24,
    nSamplesPerSec: 48000,
    wFormatTag: 65534,
    wValidBitsPerSample: 24,
    SubFormat: 00000001-0000-0010-8000-00AA00389B71,
    nChannel: 6,
    dwChannelMask: 63,
}
Error: 0x88890008
2024-09-25 15:28:02.541805 INFO [src\processing.rs:37] Playback thread has already stopped.

E:\>camilladsp.exe stereo.yml
2024-09-25 15:28:27.926528 INFO [src/bin.rs:683] CamillaDSP version 2.0.3
2024-09-25 15:28:27.926528 INFO [src/bin.rs:684] Running on windows, x86_64
2024-09-25 15:28:27.994537 ←[38;5;196mERROR←[0m [src/bin.rs:286] Playback error: Playback error: Playback device doesn't support for
mat:
WaveFormat {
    nAvgBytesPerSec: 1152000,
    cbSize: 22,
    nBlockAlign: 24,
    wBitsPerSample: 32,
    nSamplesPerSec: 48000,
    wFormatTag: 65534,
    wValidBitsPerSample: 32,
    SubFormat: 00000001-0000-0010-8000-00AA00389B71,
    nChannel: 6,
    dwChannelMask: 63,
}
Error: 0x88890008
2024-09-25 15:28:28.019040 INFO [src\processing.rs:37] Playback thread has already stopped.
 
IMO this channel layout
debug <general>: Channel Layout: FL, FR, FC, LFE, SL, SR

gets converted to channel mask with different bits than decimal 63 because SL/SR correspond to Side Left and Side Right https://github.com/xbmc/xbmc/blob/c...ne/Sinks/windows/AESinkFactoryWin.h#L117-L133 https://learn.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-waveformatextensible#remarks.

Unfortunately CDSP as is does not use the correct channel masks and would require a small hack + recompilation to fix. Maybe later, for now the shared mode should be OK (I guess the C-Media soundcard should be set to 6ch in the windows mixer)
Ah! Nice!, yes the sound card must be in 6 ch mode or nothing happens. Thanks a lot!
Clipboard04a.jpg
 
Of course all apps in modern linux distributions are configured to output to PW/PA. If you disable the sound server, none of them will play, only the apps you specifically configure for alsa.
Hi,

Thanks for amazing help with this windows 7 setup.

I made progress (Fedora 40). I re-enabled pipewire but discarded easyeffects and installed CDSP as per https://github.com/HEnquist/camilladsp-config/blob/master/README.md and replicated what I did on windows: CDSP, IR filters newly created for this different sound card.

Here's a blob, the remainder is almost identical

Code:
  capture:
    channels: 6
    device: "hw:Loopback,1,0"
    format: S32LE
    type: Alsa

  playback:
    channels: 6
    #device: "hw:CMI8738,0,0"
    ##device: "sysdefault:CARD=CMI8738"
    #device: "front:CARD=CMI8738,DEV=0"
    #device: "rear:CARD=CMI8738,DEV=0"
    #device: "surround21:CARD=CMI8738,DEV=0"
    #device: "surround40:CARD=CMI8738,DEV=0"
    #device: "surround41:CARD=CMI8738,DEV=0"
    #device: "surround50:CARD=CMI8738,DEV=0"
    #device: "surround51:CARD=CMI8738,DEV=0"
    #device: "CARD=CMI8738,DEV=0"
    device: "pipewire"
    format: S16LE
    type: Alsa

Works beautifully, including system sounds, 6 channels.

Capture d’écran du 2024-09-26 12-46-20.pngCapture d’écran du 2024-09-26 12-52-16.png

2 1 minor problems though before I start optimizing:

- on reboot, alsa master is always reset around 38%, amd I need to manually increase it or the sound is so low that I thought for quite a while that nothing worked. Worse, it gets back again to 38 whenever pipewire requires a restart.

Capture d’écran du 2024-09-26 13-51-19.png

- starting CDSP as a service does not work, nor globally, nor as user. A fix would be great. I could always make a desktop autostart too.

UPDATE
The following has been fixed. Optimization completed. A 3 week daily adventure, I'm extremely happy with the results, and grateful for the help.

Code:
~$ systemctl --user start camilladsp
~$ systemctl --user status camilladsp
● camilladsp.service - CamillaDSP Daemon
     Loaded: loaded (/etc/xdg/systemd/user/camilladsp.service; enabled; preset: disabled)
    Drop-In: /usr/lib/systemd/user/service.d
             └─10-timeout-abort.conf
     Active: activating (auto-restart) (Result: exit-code) since Thu 2024-09-26 13:23:17 EDT; 674ms ago
    Process: 10175 ExecStart=/usr/local/bin/camilladsp /home/shizuma/.config/.camilladsp/stereo.yml (code=exited, status=214/SETSCHEDULER)
   Main PID: 10175 (code=exited, status=214/SETSCHEDULER)
        CPU: 1ms

Code:
~$ journalctl --user-unit=camilladsp
sep 26 13:16:46 systemd[3507]: /etc/xdg/systemd/user/camilladsp.service:12: Standard output type syslog is obsolete, automatically updating to journal.>
sep 26 13:16:46 systemd[3507]: /etc/xdg/systemd/user/camilladsp.service:13: Standard output type syslog is obsolete, automatically updating to journal.>
sep 26 13:16:46 (milladsp)[20202]: camilladsp.service: Failed to determine supplementary groups: Operation not permitted
sep 26 13:16:46 systemd[3507]: Started camilladsp.service - CamillaDSP Daemon.
sep 26 13:16:46 systemd[3507]: camilladsp.service: Main process exited, code=exited, status=216/GROUP
sep 26 13:16:46 systemd[3507]: camilladsp.service: Failed with result 'exit-code'.
 
Last edited:
IMO this channel layout
debug <general>: Channel Layout: FL, FR, FC, LFE, SL, SR
Interesting that on Fedora, it's FL, FR, BL, BR, FC, LFE or FL, FR, SL, SR, FC, LFE, BL, BR. Not in the same order Kodi lists them.

Code:
2024-09-26 22:15:09.494 T:41       info <general>:         m_streamTypes     : No passthrough capabilities
2024-09-26 22:15:09.494 T:41       info <general>:     Device 2
2024-09-26 22:15:09.494 T:41       info <general>:         m_deviceName      : alsa-sink
2024-09-26 22:15:09.494 T:41       info <general>:         m_displayName     : Alsa Loopback
2024-09-26 22:15:09.494 T:41       info <general>:         m_displayNameExtra: Alsa Loopback (PIPEWIRE)
2024-09-26 22:15:09.494 T:41       info <general>:         m_deviceType      : AE_DEVTYPE_PCM
2024-09-26 22:15:09.494 T:41       info <general>:         m_channels        : FL, FR, FC, LFE, SL, SR, BL, BR
2024-09-26 22:15:09.494 T:41       info <general>:         m_sampleRates     : 5512,8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,176400,192000,384000
2024-09-26 22:15:09.494 T:41       info <general>:         m_dataFormats     : AE_FMT_RAW,AE_FMT_U8,AE_FMT_S16NE,AE_FMT_S24NE4,AE_FMT_S32NE,AE_FMT_S24NE3,AE_FMT_FLOAT
2024-09-26 22:15:09.494 T:41       info <general>:         m_streamTypes     : No passthrough capabilities
2024-09-26 22:15:09.494 T:41       info <general>:     Device 3
2024-09-26 22:15:09.494 T:41       info <general>:         m_deviceName      : alsa_output.pci-0000_01_06.0.analog-surround-51
2024-09-26 22:15:09.494 T:41       info <general>:         m_displayName     : CMI8738/CMI8768 PCI Audio (CMI8738/C3DX PCI Audio Device) Surround analogique 5.1
2024-09-26 22:15:09.494 T:41       info <general>:         m_displayNameExtra: CMI8738/CMI8768 PCI Audio (CMI8738/C3DX PCI Audio Device) Surround analogique 5.1 (PIPEWIRE)
2024-09-26 22:15:09.494 T:41       info <general>:         m_deviceType      : AE_DEVTYPE_PCM
2024-09-26 22:15:09.494 T:41       info <general>:         m_channels        : FL, FR, FC, LFE, BL, BR
2024-09-26 22:15:09.494 T:41       info <general>:         m_sampleRates     : 5512,8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,176400,192000,384000
2024-09-26 22:15:09.494 T:41       info <general>:         m_dataFormats     : AE_FMT_RAW,AE_FMT_U8,AE_FMT_S16NE,AE_FMT_S24NE4,AE_FMT_S32NE,AE_FMT_S24NE3,AE_FMT_FLOAT
2024-09-26 22:15:09.494 T:41       info <general>:         m_streamTypes     : No passthrough capabilities

Had to readjust my config to remap the proper filters. The SR speaker sound was muffled. Also now capturing 8ch (7.1)

Capture d’écran du 2024-09-26 22-24-02.png
 
Last edited:
on reboot, alsa master is always reset around 38%, amd I need to manually increase it or the sound is so low that I thought for quite a while that nothing worked.
For alsa only typically it takes running 'alsactl store' to change the mixer values stored for the next boot. See https://linux.die.net/man/1/alsactl
Worse, it gets back again to 38 whenever pipewire requires a restart.
That looks like PW either restores its previous status (did you increase the volume via PW too?) or has this safe initial attenuation setup somewhere in its configuration.
 
For alsa only typically it takes running 'alsactl store' to change the mixer values stored for the next boot. See https://linux.die.net/man/1/alsactl
That I did from time to time on Debian successfully; not on Fedora with the snd_cmipci, snd_aloop modules though. It's reset on reboot and on PW restart.
That looks like PW either restores its previous status (did you increase the volume via PW too?)
The audio volume is set to 100% and remains there; only alsa master volume needs to be increasedt. I didn't have this issue with the Realtek + S/PDIF card.

As a matter of fact, it was set to 85% on the Realtek as its output was 30dB louder than the analog CMI8738. It also stayed fixed there. No need to play with it.

For the CMI card, I need to compensate the 30dB loss with the Z906 volume control, which introduces all kind of audible clicks, hisses and pops. Pro: with IR filters applied, the analog CMI audio is a lot more linear to the ear than the Realtek digital was. No explanation for that, just stating a fact easily demonstrated with a log sweep from 20-5k Hz.
or has this safe initial attenuation setup somewhere in its configuration.
Or it's the default on Fedora. My searches didn't find no clear answer to that. And no suggested 'solution' worked. Hence my question here.
 
Back
Top Bottom