You are not logged in.

#1 2016-04-02 10:38:14

kudykennedy
Member
Registered: 2015-04-11
Posts: 21

[SOLVED] How to play very short MP3 (less than a sec) in Linux?

So, I have thousands of MP3, and I'm using Audacious.
My files contain one word each, and thus most are less than 1 second.
I cannot play most of them, my players have a tendency to skip to the next file without even play the sound out.
This is very frustrating as I put them in a playlist and learn vocabulary. Most of them don't even sound anything.

YOU CAN PLAY IT AFTER PRESSING PLAY AGAIN.

You can reproduce the problem with the file I give.
http://s000.tinyupload.com/index.php?fi … 8136875990

I have tried a lot of music players, but and only foobar2000 can play it perfectly, which is in WINDOWS.

I have even gone far to use ffmpeg to pad 1 sec of silence, but the audio made is changed due to its having different kbps.

FILES=myfiles/*
for f in $FILES do
ffmpeg -i "1secsilence.mp3 | $f" -c copy -f mp3 "0000.mp3"
mv 0000.mp3 myfiles/$f
done

I need a way to listen to all of them like foobar does.

Last edited by kudykennedy (2016-04-02 14:48:43)

Offline

#2 2016-04-02 10:59:26

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

can't reproduce.

mpv 1.mp3 1.mp3 1.mp3

played just fine.
deadbeef and mpd worked fine too. vlc too.

the mpv command had a little larger gap between the files. actually that is wrong behavior, but it's what you want it seems.

Last edited by Rasi (2016-04-02 11:02:06)


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#3 2016-04-02 11:04:02

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

mpv also works fine for me, so does "play" from [extra]/sox.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2016-04-02 11:04:48

kudykennedy
Member
Registered: 2015-04-11
Posts: 21

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

this mpv rocks, but as I said, Audacious, many GUI programs, and even cmus cannot play at first try.

Offline

#5 2016-04-02 11:08:11

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

Well, you didn't actually say that.  You said that *nothing* in linux could play them.  This led me to suspect there was a problem with your sound configuration.  But it turns out one a subset of audio programs are an issue, right?  It would help to know which ones actually work and which ones don't.

So audiacious doesn't work, nor does cmus, but mpv does?

EDIT: I just installed audacious, it plays that file just fine for me to.

Do you have any gst-plugins packages installed?  Particularly gst-plugins-ugly?  Or at least lame and libmad?  What about mpg123?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2016-04-02 11:35:30

kudykennedy
Member
Registered: 2015-04-11
Posts: 21

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

Now even I can't reproduce it. After run mpv successfully now Audacious works fine too (!?!)
I used to open a single file and it didn't sound. Last time I could reproduce it is after changing pavucontrol from HDMI to Analog stereo duplex, which audacious works, then change back to HDMI, then it doesn't work. Now it works in HDMI too.
For now I will mark this thread as solved.
I should just get rid of the audacious and use mpv anyway... Thanks guys.

Offline

#7 2016-04-02 11:44:07

kudykennedy
Member
Registered: 2015-04-11
Posts: 21

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

I am sorry this is unsolved again...
I will give you my 994 mp3 files (weight about 6 MB) for you to reproduce.
That sample I gave was just too small.

http://s000.tinyupload.com/index.php?fi … 9461920565
You can hear that for about 4-5 audio, the player just sounds out 1 word.
Even mpv failed sad

Offline

#8 2016-04-02 11:50:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

Still no problem here.  Please describe exactly how you are trying to play these, and answer my questions in the previous post.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#9 2016-04-02 12:13:20

kudykennedy
Member
Registered: 2015-04-11
Posts: 21

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

I want to play all of those files, one pronounced after another, just like playlist of music.
You would understand, one word in english, then one word in arabic... 0001 and 0002 for example.
A code of

mpv 0001.mp3 0002.mp3 0003.mp3 0004.mp3

, I want 0001 to be pronounced, then 0002, so on...
But I can only hear of something in the middle, the player process faster than it could play.
Now none of the players work (play all 4 consecutively), audacious, mpv, and sox play.

Last edited by kudykennedy (2016-04-02 12:18:33)

Offline

#10 2016-04-02 12:50:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

This is getting a bit tiring:

Trilby wrote:

...and answer my questions in the previous post.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#11 2016-04-02 12:50:50

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

No problems here playing them and hearing all words on a pure alsa setup with vlc and sox play.

gst-plugin-ugly, lame, libmad & mpg123 are all present.

$ play 0001.mp3 0002.mp3 0003.mp3 0004.mp3
play WARN mp3-util: MAD lost sync
play WARN mp3-util: MAD lost sync

0001.mp3:

 File Size: 2.94k     Bit Rate: 34.4k
  Encoding: MPEG audio    
  Channels: 1 @ 16-bit   
Samplerate: 16000Hz      
Replaygain: off         
  Duration: 00:00:00.68  

In:100%  00:00:00.68 [00:00:00.00] Out:32.8k [      |      ]        Clip:0    

0002.mp3:

 File Size: 11.1k     Bit Rate: 64.2k
  Encoding: MPEG audio    
  Channels: 1 @ 16-bit   
Samplerate: 22050Hz      
Replaygain: off         
  Duration: 00:00:01.38  

In:98.1% 00:00:01.36 [00:00:00.03] Out:98.0k [      |      ]        Clip:0    

0003.mp3:

 File Size: 3.66k     Bit Rate: 33.9k
  Encoding: MPEG audio    
  Channels: 1 @ 16-bit   
Samplerate: 16000Hz      
Replaygain: off         
  Duration: 00:00:00.86  

In:100%  00:00:00.86 [00:00:00.00] Out:140k  [      |      ]        Clip:0    

0004.mp3:

 File Size: 20.1k     Bit Rate: 64.1k
  Encoding: MPEG audio                                                                                           
  Channels: 1 @ 16-bit                                                                                           
Samplerate: 22050Hz                                                                                              
Replaygain: off                                                                                                  
  Duration: 00:00:02.51                                                                                          
                                                                                                                 
In:99.0% 00:00:02.48 [00:00:00.03] Out:259k  [      |      ]        Clip:0                                       
Done.
$ 

Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#12 2016-04-02 12:59:56

kudykennedy
Member
Registered: 2015-04-11
Posts: 21

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

I found out, the problem disappears after I change my PAVUCONTROL configuration to something else.
At first I am in "Digital Stereo (HDMI) Output + Analog Stereo Input", got the problem, changed to "Analog Stereo Output" (which uses my laptop's speaker), the problem is no more, then change back to HDMI, the problem appears again.
@Trillby: about your questions: I didn't say I tested all players. Yes, probably sound configuration, not audio programs issue. Any packages you mentioned, I installed prior making this thread.
So, after some time in HDMI config, the problems comes back. I'm ok with using laptop's speaker, but why this problem persists in HDMI config?

Offline

#13 2016-04-02 13:02:26

frostschutz
Member
Registered: 2013-11-15
Posts: 1,409

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

You could use sox to add half a second of silence (or however much you need)... target format should be lossless in this case.

I have this issue with my onboard intel-hd sound card, there seems to be some audio buffer involved which eats some of the audio, but that's just a wild guess... I really don't know enough about how audio works.

Somehow this causes songs played by mpd to kind of "cross-fade" even though no such option is enabled; and audio in mplayer takes an extra 1-2 seconds to play until mplayer somehow magically manages to sync the audio to the video. In some other programs this A/V sync just doesn't work at all...

Offline

#14 2016-04-02 13:05:20

kudykennedy
Member
Registered: 2015-04-11
Posts: 21

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

@frostschutz: yeah, but the flac format is heavy, here I can listen to thousands words with only some megabytes in size.
The temporary fix is to switch to laptop speaker, play the files, then switch back to HDMI.

Offline

#15 2016-04-02 13:10:25

kudykennedy
Member
Registered: 2015-04-11
Posts: 21

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

Update: This problem will disappear whenever I have the pavucontrol window open, and appears when not!
And this problem appears only in HDMI configuration of pavucontrol, laptop speaker works fine everytime.
Still a weird behavior if you ask me. But at least I can narrow down the problem for you.

Last edited by kudykennedy (2016-04-02 13:14:34)

Offline

#16 2016-04-03 15:51:13

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

I assume that the connection to the hdmi sink is closed and reopened each time, and having pavucontrol open will leave the sink open to show the pavucontrol meters. Can you try to set the  exit-idle-time= in your daemon.conf in /etc/pulse/daemon.conf to -1 and restart pulseaudio (issuing a

pulseaudio -k

and waiting for the respawn should be sufficient) and check if the behavior continues?

Offline

#17 2016-04-04 11:17:36

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: [SOLVED] How to play very short MP3 (less than a sec) in Linux?

I am able to reproduce the same behaviour with very short mp3 file using mpg123. Mp3 plays fine with cmus everytime. With mpg123 it plays fine 2/5 times while other times it appears like sound output is truncated to variable degree, as if mpg123 exits even before playing complete file.

changing exit-idle-time to -1 has no effect on this behaviour

I have gst-plugins-ugly installed.

EDIT: I am using laptop speakers only , no HDMI

no issue using sox, all mp3 plays fine there with (play *.mp3)

Last edited by Docbroke (2016-04-04 13:48:16)

Offline

Board footer

Powered by FluxBB