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

DAB sample rate incorrect on some radio stations yet other streams are fine on the same mux #74

Closed
diddy-boy opened this issue Mar 11, 2024 · 6 comments

Comments

@diddy-boy
Copy link

Hi there
Dablin is being used as part of another project but some radio channels on the same mux sound odd at the wrong sample rate.

There is at least one stream issue for every digital mux here in the UK.
I have referenced the main national DAB mux for the BBC as this issue can be reproduced by anyone with DAB on openwebrx in the UK.

The DAB mux in question is :-

https://en.wikipedia.org/wiki/BBC_National_DAB

This mux consists of the radio stations :-

BBC Radio 1
BBC Radio 2
BBC Radio 3
BBC Radio 4
BBC Radio 5 Live
BBC Radio 6 Music
BBC Radio 1 Xtra
BBC Radio 4 Xtra
BBC AsianNetwork
BBC World Service

All stations work correctly except :-
BBC Radio 5 Live (64-80 kbit/s Mono)
BBC Radio 4 xtra (80 kbit/s Mono)
BBC AsianNetwork (64 kbit/s Mono)
BBC World Service (64Kbit/s Mono)

They all sound like Alvin and the Chipmunks.
I suspect that its because the streams are mono.
Is this an issue in Dablin ?

thanks in advance
Rich

@andimik
Copy link
Contributor

andimik commented Mar 11, 2024

This sounds more a problem with either your sound card or ffmpeg.

@basicmaster
Copy link
Member

@diddy-boy
You refer to the embedded use as part of OpenWebRX, don't you?
Apparently OpenWebRX assumes a fixed sample rate of 48 kHz and Stereo audio. However for PCM output (which is used by OpenWebRX here) DABlin uses the native sample rate and channel count of the actual service. This may vary, e.g. BBC Radio 1 has 48 kHz Stereo, while BBC World Service has 48 kHz Mono (and e.g. BFBS UK on SDL National has 32 kHz Mono). So everytime a service doesn't match 48 kHz Stereo, it won't sound right.

A simple solution would be to let DABlin output the audio in encoded form (just a lossless repackaging that doesn't consume much CPU power) via the -u parameter and add a separate audio player (ffplay of vlc) afterwards in the processing chain.

Another solution would be to add support to DABlin for always using the same fixed sample rate/channel count for PCM output. But this might require sample rate conversion in case the audio decoders for MP2/AAC don't have built-in support for this...

@diddy-boy
Copy link
Author

diddy-boy commented Mar 11, 2024 via email

@basicmaster
Copy link
Member

There is a further way to address jketterl/openwebrx#155:
I could add an additional output option that still outputs the PCM samples, but initially prepends a RIFF WAVE header. This way @jketterl could retrieve sample rate/sample format/channel count of the PCM samples and configure the audio output of OpenWebRX accordingly.

@basicmaster
Copy link
Member

I just added a RIFF WAVE output. This way the necessary parameters can be derived from the prepended header, for correct audio output.

I hereby also changed the sample format to always 16bit integer, as 32bit float makes the WAVE output more complex. 16bit CD quality should be sufficient for DAB here.

@diddy-boy
Copy link
Author

diddy-boy commented Mar 30, 2024 via email

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

No branches or pull requests

3 participants