LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-23-2020, 11:40 PM   #1
bobIsHere244
Member
 
Registered: Dec 2018
Posts: 37

Rep: Reputation: Disabled
Why is VLC's minimum samplerate 4Khz?


Believe it or not, I compress some of my audio files to below 4Khz, I like to compress things to save as much space as possible because sometimes it's just a couple sinewaves at low frequencies. It won't play files sampled to 3999Hz or below, but will play anything above 4Khz. So for some of these I use the default xplayer that came with my linux mint installation, but that only plays down to 2Khz. I know this is extremely niche, but is there any way to set a lower samplerate?
 
Old 08-24-2020, 09:43 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,292

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
I think aplay plays down to 2khz. You could try lower, but I think it's wisdom to avoid low frequencies in speakers. What you do with aplay I imagine can be done with arecord.

EDIT: Before you ask, I wouldn't like to listen to any of those sound files .

Last edited by business_kid; 08-24-2020 at 09:45 AM.
 
Old 08-24-2020, 10:32 AM   #3
masterclassic
Member
 
Registered: Jun 2007
Distribution: Knoppix, antiX
Posts: 252

Rep: Reputation: 73
I prefer to use "samples/second" for sample rate and "kHz" for the audio signal, to avoid any confusion.
4000 samples/second can give sounds up to about 2000 Hz (with some distorsion, of course). 2000 Hz is perhaps enough for sinus waveforms with no or few harmonics, so in theory it isn't strange. I think that low sample rate is rather too low for usual music sounds and music content.

How do you compress the signal? do you use any mp3-like code? I think lame (Lame Aint an MP3 Encoder) doesn't go lower than 8000 samples/second and 8 kbps of bitrate. It is true that one can use non standard values through the command line, at least for bitrates higher than 320 kbps but I don't know for low values.

Last edited by masterclassic; 08-24-2020 at 10:34 AM.
 
Old 08-24-2020, 02:04 PM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
If it's about saving space wouldn't extreme compression be better? I.e. convert to something like 16kbps vorbis/opus/aac?
If that's not enough, downsample to 4kHz as well.
Although, I can't imagine anything I'd like to listen to that is so reduced.
 
Old 08-24-2020, 02:29 PM   #5
masterclassic
Member
 
Registered: Jun 2007
Distribution: Knoppix, antiX
Posts: 252

Rep: Reputation: 73
Quote:
Originally Posted by ondoho View Post
If it's about saving space wouldn't extreme compression be better? I.e. convert to something like 16kbps vorbis/opus/aac?
If that's not enough, downsample to 4kHz as well.
Although, I can't imagine anything I'd like to listen to that is so reduced.
Not obvious it is any regular audio signal.
I remember (35-40 years ago) in a university laboratory, people used to take physical mesure results and store them. They used analogue tape recorders (open reel Revox tape recorders). Because the frequencies to store were very low (from a fraction of Hz to 50-100 Hz max) they used frequency modulation to translate the spectrum to the bandwith the recorder could write to the magnetic tape. Listening to that recording would give something like the modem or fax sounds.
Now, this translation could be perhaps avoided using newer data formats.

I tried once to encode regular music to some very low bitrate mp3 using a mp3 encoding software (I don't remember if it was lame or perhaps cdex). At 8 or 12 kbps, the sound was like a very old bad telephone line!
It seemed however than for low bitrates aac+ format was somehow better than mp3 (I used it for web radio casting around 2010, with edcast). It gave better sound for the same bitrate.
 
Old 08-24-2020, 02:42 PM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by masterclassic View Post
It seemed however than for low bitrates aac+ format was somehow better than mp3 (I used it for web radio casting around 2010, with edcast). It gave better sound for the same bitrate.
Yes, and I think even ogg/vorbis is much better than mp3 for low bitrates.
And opus is supposed to be even better, at least for human voice.
 
Old 08-25-2020, 03:25 PM   #7
bobIsHere244
Member
 
Registered: Dec 2018
Posts: 37

Original Poster
Rep: Reputation: Disabled
They're all in FLAC and it's not scientific data.
 
Old 08-25-2020, 03:53 PM   #8
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,599

Rep: Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546

If you search the source code for 4000 then this code comes up: https://git.videolan.org/?p=vlc.git;...ff;hb=HEAD#l82
Code:
  82     if( p_format->i_rate < 4000 )
  83     {
  84         msg_Err( p_aout, "too low audio sample frequency (%u)",
  85                  p_format->i_rate );
  86         return -1;
  87     }
Given the hard-coded value it seems unlikely there's an option to override it.

Tracing the change back shows the check was originally added in 2008, but the commit message just gives the unhelpful non-explanation of "Check against too low sample rate" without stating why 4000 is considered too low.

You could try asking on the VLC forums, but since a couple of people have asked the same question as you with no responses that's probably a waste of time - so I'd suggest reporting it as a bug (along with the reason why you want to go lower), and see if that gets you anywhere.

 
Old 09-04-2020, 05:57 PM   #9
bobIsHere244
Member
 
Registered: Dec 2018
Posts: 37

Original Poster
Rep: Reputation: Disabled
Does it have something to do with the audio buffer size of the playback loop? If the samplerate is too low doesn't it fill up too slowly? Also thanks for going to the trouble of checking the code like that!

Last edited by bobIsHere244; 09-04-2020 at 05:58 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How do you check the samplerate in use by your sound card (Slackware64 14)? Holering Linux - General 1 02-04-2013 09:08 AM
VLC error: VLC could not open the file "/usr/share/vlc/skins2/text.bmp". brjoon1021 Ubuntu 1 01-14-2009 10:48 PM
Why do they say I'm under the minimum 3 words in my Search Thread? roy7474 Linux - Newbie 1 10-30-2008 12:00 AM
Non-Linux (electrical) query about TRIACS re: why their MINIMUM current requirement? GrapefruiTgirl General 6 06-10-2008 04:48 AM
cmd line prog to convert mp3 samplerate kmasaryk Linux - Desktop 4 11-25-2006 12:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration