stsaz / fmedia

fast audio player/recorder/converter
BSD 2-Clause "Simplified" License
216 stars 21 forks source link

WASAPI samplerate by track #11

Closed mmar22 closed 5 years ago

mmar22 commented 6 years ago

Hi I test your sw on windows and seems play only same files as setup in control panel. Please add switching samplerate to code to same as file played. Now show err

stsaz commented 6 years ago

Hello! Can you show the error message that fmedia prints?

mmar22 commented 6 years ago

c:\Users\marian\Downloads\fmedia>fmedia --dev=2 "p:\9_PUBLIC_AUDIO_FILES\WAV\SINUS 24bit\1kHz@0dB_96kHz_24bit.wav" fmedia v1.1 (win-x64)

1 " - " p:\9_PUBLIC_AUDIO_FILES\WAV\SINUS 24bit\1kHz@0dB_96kHz_24bit.wav 65.92 MB, 2:00.000 (11,520,000 samples), 4608 kbps, WAVE, 96000 Hz, int24, stereo

[......................................................................] 0:00 / 2:0008:43:43.123 :249c [error] soxr: *1: unsupported PCM conversion: int24/2/96000/i -> int24/2/48000/i

When i change config in control pannel from 48 to 96k then this file plays. Any other not equal SR same trouble.

From: Simon Zolin Sent: Friday, November 9, 2018 8:28 PM To: stsaz/fmedia Cc: mmar22 ; Author Subject: Re: [stsaz/fmedia] WASAPI samplerate by track (#11)

Hello! Can you show the error message that fmedia prints?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

stsaz commented 6 years ago

Yes, it's a known problem - libsoxr (the module which fmedia uses to convert sample rates) can't convert from/to int24 (i.e. 24-bit integer) format. I guess we should file a feature request to its developers, but I still didn't pay much attention to this. If you have time, you can ask the authors to add int24 support (libsoxr page is here: https://sourceforge.net/projects/soxr/). Or I will try to implement this by myself in one of the next releases of fmedia.

Anyway, to overcome this issue use --format=int16 - this tells fmedia to use int16 format, which works well with sample rate conversion.

mmar22 commented 6 years ago

Sorry , but i need no conversion, i need switch dac to new samplerate same as file, because support it. WASAPI is exactly for this purpose and bitperfect playback. And too need 24bits btw. for wavdop DSD.

From: Simon Zolin Sent: Monday, November 12, 2018 7:44 PM To: stsaz/fmedia Cc: mmar22 ; Author Subject: Re: [stsaz/fmedia] WASAPI samplerate by track (#11)

Yes, it's a known problem - libsoxr (the module which fmedia uses to convert sample rates) can't convert from/to int24 (i.e. 24-bit integer) format. I guess we should file a feature request to its developers, but I still didn't pay much attention to this. If you have time, you can ask the authors to add int24 support (libsoxr page is here: https://sourceforge.net/projects/soxr/). Or I will try to implement this by myself in one of the next releases of fmedia.

Anyway, to overcome this issue use --format=int16 - this tells fmedia to use int16 format, which works well with sample rate conversion.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

stsaz commented 6 years ago

WASAPI can operate in 2 different modes: shared and exclusive. By default fmedia uses shared mode. This is what you configure in Audio properties in Windows. In this mode all audio is converted to this format internally by Windows. In exclusive mode all other apps can't work while fmedia is exclusively holding access to the device. In this mode you can avoid sample rate conversion if the file format is supported by your device.

So, you either need to use exclusive mode, or set int24/96k format in Windows settings for shared mode. Otherwise there will be a conversion.

To set exclusive mode for playback open fmedia.conf and set exclusive_mode 2 in mod_conf "wasapi.out" section:

mod_conf "wasapi.out" {
...
    exclusive_mode 2
mmar22 commented 6 years ago

OMG Simon sorry i try exmode 1 and not work. 2 work fine thanks.

From: Simon Zolin Sent: Tuesday, November 13, 2018 6:30 PM To: stsaz/fmedia Cc: mmar22 ; Author Subject: Re: [stsaz/fmedia] WASAPI samplerate by track (#11)

WASAPI can operate in 2 different modes: shared and exclusive. By default fmedia uses shared mode. This is what you configure in Audio properties in Windows. In this mode all audio is converted to this format internally by Windows. In exclusive mode all other apps can't work while fmedia is exclusively holding access to the device. In this mode you can avoid sample rate conversion if the file format is supported by your device.

So, you either need to use exclusive mode, or set int24/96k format in Windows settings for shared mode. Otherwise there will be a conversion.

To set exclusive mode for playback open fmedia.conf and set exclusive_mode 2 in mod_conf "wasapi.out" section:

mod_conf "wasapi.out" { ... exclusive_mode 2 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.