Home of the Squeezebox™ & Transporter® network music players.
Page 6 of 8 FirstFirst ... 45678 LastLast
Results 51 to 60 of 77
  1. #51
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,481
    Quote Originally Posted by bpa View Post
    Great that problem has been tracked down. It is an old feature which clearly is not used much and possible some of recent development have introduced an incompatibility.

    Michael would certainly co-ordinate as necessary.
    Next step is diagnose what has been broken - perhaps it has been broken for a long time.
    Philippe made a lot of "streaming audio" changes for 8.* so I'm guessing he'll check to see if some of his changes cause the problem.
    I will have a look but I've finally not made changes to the "silence creation" part (I was thinking about that to have a sream.flac instead of stream.mp3) and funny enough, one of the main issue was that no player supports properly change of sampling rate during single stream. I noticed that for flac and I re-checked for mp3 and saw the same and anyway squeezelite code confirms that. So although the mp3 or flac can have independant sampling rate per block, players won't analyse every block and reprogram themselves. AFAIK (and I'd need to verify that) LMS inserts fix silence frames when some silence is required at the beginning and the silence files (found in HTML/EN/html) are 44.1 kHz. So that problem has (almost) no solution, we can't have many silence files (we don't really know which one might be required anyway) and we can't easily reprogram DAC on-the-fly
    Last edited by philippe_44; 2021-08-02 at 12:26.
    LMS 8.2 on Odroid-C4 - SqueezeAMP!, 5xRadio, 5xBoom, 2xDuet, 1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3

  2. #52
    Senior Member
    Join Date
    Jan 2017
    Posts
    156
    Quote Originally Posted by philippe_44 View Post
    I will have a look but I've finally not made chnages to the "silence creation" part (I was thinking about that to have a sream.flac instead of stream.mp3) and funny enough, one of the main issue was that no player supports properly change of sampling rate during single stream. I noticed that for flac and I re-checked for mp3 and saw the same and anyway squeezelite code confirms that. So although the mp3 or flac can have independant sampling rate per block, players won't analyse every block and reprogram themselves. AFAIK (and I'd need to verify that) LMS inserts fix silence frames when some silence is required at the beginning and the silence files (found in HTML/EN/html) are 44.1 kHz. So that problem has (almost) no solution, we can't have many silence files (we don't really know which one might be required anyway) and we can't easily reprogram DAC on-the-fly
    Couldn't LMS modify the header of those silence files when using them and recalculate the length that it fits to the desired length?

  3. #53
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,748
    The setting is really a server based solution because of h/w based players.

    With s/w based players like squeezelite with a lot more control/knowledge of the output stream , it would make more sense to have a command line option - it is a compromise but since not many people have the problem, it might be the easiest way.

  4. #54
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,748
    Quote Originally Posted by bpa View Post
    The setting is really a server based solution because of h/w based players.

    With s/w based players like squeezelite with a lot more control/knowledge of the output stream , it would make more sense to have a command line option - it is a compromise but since not many people have the problem, it might be the easiest way.
    Thinking a bit more - this approach would probably fail if players are synced.

  5. #55
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,481
    If look at LMS code, it's violently hard-coded

    Code:
    	if ($client->streamBytes() == 0 && $client->streamformat() eq 'mp3') {
    	
    		my $silence = 0;
    		# use the maximum silence prelude for the whole sync group...
    		foreach my $buddy ($client->syncGroupActiveMembers()) {
    
    			my $asilence = $prefs->client($buddy)->get('mp3SilencePrelude');
    
    			if ($asilence && ($asilence > $silence)) {
    				$silence = $asilence;
    			}
    		}
    		
    		0 && $log->debug("We need to send $silence seconds of silence...");
    		
    		while ($silence > 0) {
    			$chunk .=  ${Slim::Web::HTTP::getStaticContent("html/lbrsilence.mp3")};
    			$silence -= (1152 / 44100);
    		}
    		
    		my $len = length($chunk);
    		
    		main::DEBUGLOG && $log->debug("Sending $len bytes of silence.");
    		
    		$client->streamBytes($len);
    		
    		return \$chunk if ($len);
    	}
    Maybe best we can do is disable that unless rate is 44.1. I'll check if the information is available at that point
    LMS 8.2 on Odroid-C4 - SqueezeAMP!, 5xRadio, 5xBoom, 2xDuet, 1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3

  6. #56
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,481
    Quote Originally Posted by philippe_44 View Post
    If look at LMS code, it's violently hard-coded

    Code:
    	if ($client->streamBytes() == 0 && $client->streamformat() eq 'mp3') {
    	
    		my $silence = 0;
    		# use the maximum silence prelude for the whole sync group...
    		foreach my $buddy ($client->syncGroupActiveMembers()) {
    
    			my $asilence = $prefs->client($buddy)->get('mp3SilencePrelude');
    
    			if ($asilence && ($asilence > $silence)) {
    				$silence = $asilence;
    			}
    		}
    		
    		0 && $log->debug("We need to send $silence seconds of silence...");
    		
    		while ($silence > 0) {
    			$chunk .=  ${Slim::Web::HTTP::getStaticContent("html/lbrsilence.mp3")};
    			$silence -= (1152 / 44100);
    		}
    		
    		my $len = length($chunk);
    		
    		main::DEBUGLOG && $log->debug("Sending $len bytes of silence.");
    		
    		$client->streamBytes($len);
    		
    		return \$chunk if ($len);
    	}
    Maybe best we can do is disable that unless rate is 44.1. I'll check if the information is available at that point
    I've submitted a PR with that

    Code:
    if ($client->streamBytes() == 0 && $client->streamformat() eq 'mp3' && $client->streamingSong()->samplerate() == 44100) {
    It's lazyman version as it will only work for files (samplerate in $song object is only set when streaming local files), you could try to use
    Code:
    $client->streamingSong->currentTrack->samplerate
    as well if you prefer
    Last edited by philippe_44; 2021-08-02 at 11:32.
    LMS 8.2 on Odroid-C4 - SqueezeAMP!, 5xRadio, 5xBoom, 2xDuet, 1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3

  7. #57
    Senior Member
    Join Date
    Jan 2017
    Posts
    156
    Quote Originally Posted by philippe_44 View Post
    I've submitted a PR with that

    Code:
    if ($client->streamBytes() == 0 && $client->streamformat() eq 'mp3' && $client->streamingSong()->samplerate() == 44100) {
    It's lazyman version as it will only work for files (samplerate in $song object is only set when streaming local files), you could try to use
    Code:
    $client->streamingSong->currentTrack->samplerate
    as well if you prefer
    If it applies only to MP3 anyway, one could do an "extended lazyman" version with two different silence files for 44.1 and 48 kHz. Other sampling rates for MP3 should be really unusual.

  8. #58
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,748
    Quote Originally Posted by schup011 View Post
    If it applies only to MP3 anyway, one could do an "extended lazyman" version with two different silence files for 44.1 and 48 kHz. Other sampling rates for MP3 should be really unusual.
    Other sampling rates are all lower. 32kHz is the only stream I've "seen" on same streaming radio.

    Need to understand - does this feature work with AAC/Flac streams ?
    If not then why bother with the feature for MP3 streams only ?
    If yes, why does it work with AAC/Flac and not MP3 ?

    edit:

    OK code say " if ($client->streamBytes() == 0 && $client->streamformat() eq 'mp3') {"
    It is MP3 only - so why not remove this "feature" since it is not generic ?

  9. #59
    Senior Member
    Join Date
    Jan 2017
    Posts
    156
    Yes, I also did learn only from the code posted above that it was only applying to MP3. I think for streams, it is really questionable because if you jump into a radio stream, it does not matter if you loose a second that is "eaten" by the Amp. Only for files, it could make sense since lots of classical music files really start at the very first second.
    So I could also imagine to restrict this to files .

  10. #60
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,481
    Quote Originally Posted by schup011 View Post
    If it applies only to MP3 anyway, one could do an "extended lazyman" version with two different silence files for 44.1 and 48 kHz. Other sampling rates for MP3 should be really unusual.
    Yes, we could have 3 files, for 32, 44.1 and 48 but ... see below
    Quote Originally Posted by bpa View Post
    Other sampling rates are all lower. 32kHz is the only stream I've "seen" on same streaming radio.

    Need to understand - does this feature work with AAC/Flac streams ?
    If not then why bother with the feature for MP3 streams only ?
    If yes, why does it work with AAC/Flac and not MP3 ?

    edit:

    OK code say " if ($client->streamBytes() == 0 && $client->streamformat() eq 'mp3') {"
    It is MP3 only - so why not remove this "feature" since it is not generic ?
    I would tend to agree with you, and I think it's a legacy thing at the time mp3 was the only game in town for SB. But I'm speculating here and probably Michael has a better opinion.
    LMS 8.2 on Odroid-C4 - SqueezeAMP!, 5xRadio, 5xBoom, 2xDuet, 1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •