Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 40
  1. #1

    Determine samplerate LMS, squeezelite or like

    Hi here... first post in dev-section ever here

    I allready contacted some of the devoleper's here, but i also would like some input's of howto actually write my own plugins.
    It's hard to find information howto get started, as i to be honest have no clue where to start?


    Well the real case is as follows :
    Over at diyaudio, there is a new thread where a very good low cpupower dsp engine is developed.
    This DSP engine "camilladsp" is capable of making room correction, X-overs etc.. for stereo/speaker systems (the one we all have in our livingroom )
    The engine takes the input from e.g. squeezelite/LMS and convert it through some filter (could be bass boost, or correction of the room where speakers are etc...)

    Well, i have it going on newest piCorePlayer with some "ugly" init.d scripts everything is running very very good without glitches, noise or anything weird, so that's a good start.
    For now the camilladsp_engine only "converts" normal (ALSA) 44.1KhZ streams from LMS/squeezelite/Loopback[camilladsp]Loopback ---> real hardware soundcard (CD quality).
    If i should have it working with other samplerates (44,1 / 88,2 / 96 ..... 192Khz...) i must somehow determine the samplerate for the next song played.
    If i could see that somewhere through a plugin, or in LMS somewhere or even squeezelite i could switch the filter on the camilladsp_engine on the fly.

    I really hope someone here can give me some input, or also if someone have some howto's to get me started making my own plugin (if i need that for samplerate determination)

    Best Regards; Jesper.

  2. #2
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    991
    Quote Originally Posted by Jesperlykke View Post
    Well, i have it going on newest piCorePlayer with some "ugly" init.d scripts everything is running very very good without glitches, noise or anything weird, so that's a good start.
    For now the camilladsp_engine only "converts" normal (ALSA) 44.1KhZ streams from LMS/squeezelite/Loopback[camilladsp]Loopback ---> real hardware soundcard (CD quality).
    squeezelite can output the audio data to stdout, and camilladsp can read from stdin so you can avoid the whole loopback method.

    Quote Originally Posted by Jesperlykke View Post
    If i should have it working with other samplerates (44,1 / 88,2 / 96 ..... 192Khz...) i must somehow determine the samplerate for the next song played.
    If i could see that somewhere through a plugin, or in LMS somewhere or even squeezelite i could switch the filter on the camilladsp_engine on the fly.
    I really hope someone here can give me some input, or also if someone have some howto's to get me started making my own plugin (if i need that for samplerate determination)
    A plugin runs on the server, but you need the information on the client. If you have to query the server, you might as well just use the standard LMS API to get the info.
    However, I think this approach will generally not work due to latency etc.
    You could try increase squeezelite's logging and check if you find the info in the log file.

    Taking one step back: Is it even realistic to switch the sample rate per song? Does any hardware support switching this on the fly (while the device is in use / opened)? Does any software (afaik, squeezelite sets the sample rate when starting, and the re-samples if required)
    Is there any advantage to doing this (won't the audio just be re-sampled anyway on the device)?
    Personally, I'd just let squeezelite upsample to the max supported rate of the hardware, and feed the data to camilladsp
    Various SW: Web Interface | Playlist Editor / Generator | Music Classification | Similar Music | Announce | EventTrigger | LMSlib2go | ...
    Various HowTos: build a self-contained LMS | Bluetooth/ALSA | Control LMS with any device | ...

  3. #3
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    18,625
    Quote Originally Posted by Jesperlykke View Post
    I really hope someone here can give me some input, or also if someone have some howto's to get me started making my own plugin (if i need that for samplerate determination)
    Have you looked at how BruteFIR and InguzDSP plugins were implemented ?

  4. #4
    Quote Originally Posted by Roland0 View Post
    squeezelite can output the audio data to stdout, and camilladsp can read from stdin so you can avoid the whole loopback method.


    A plugin runs on the server, but you need the information on the client. If you have to query the server, you might as well just use the standard LMS API to get the info.
    However, I think this approach will generally not work due to latency etc.
    You could try increase squeezelite's logging and check if you find the info in the log file.

    Taking one step back: Is it even realistic to switch the sample rate per song? Does any hardware support switching this on the fly (while the device is in use / opened)? Does any software (afaik, squeezelite sets the sample rate when starting, and the re-samples if required)
    Is there any advantage to doing this (won't the audio just be re-sampled anyway on the device)?
    Personally, I'd just let squeezelite upsample to the max supported rate of the hardware, and feed the data to camilladsp
    Hi and thanks for answering.

    I could ofcause do the suggested upsample you mention in last line...
    Personally, I'd just let squeezelite upsample to the max supported rate of the hardware, and feed the data to camilladsp
    But my goal is to do it the way brutefirdrc does.

    squeezelite sets the sample rate when starting, and the re-samples if required)
    Is there any advantage to doing this (won't the audio just be re-sampled anyway on the device)?
    I don't think so, right now i use squeezelite and LMS server on an old NAS, without any dsp and my DAC shows the right samplerate when some hirez streams from e.g Qobus.

    Thanks again... Rgds; Jesper.
    Last edited by Jesperlykke; 2020-03-23 at 12:33.

  5. #5
    Quote Originally Posted by bpa View Post
    Have you looked at how BruteFIR and InguzDSP plugins were implemented ?
    Hello...

    I tried looking at the code, but it's to complicated for me

    I know through that it's possible to determine somehow, while brutefir does it i know.

    Jesper.

  6. #6
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    991
    Quote Originally Posted by Jesperlykke View Post
    I tried looking at the code, but it's to complicated for me
    I know through that it's possible to determine somehow, while brutefir does it i know.
    The BruteFIR plugin takes a completely different approach than what you are doing now. The audio processing is done on the server, and the data is then sent to the client(s) which will then play it as-is.
    I've never tried it, but I'd imagine this won't play well with multiple (synchronized) players. It's also significantly more complex to do (esp. from an integration PoV), that's why the plugin is "complicated" (as you put it)
    If you want to try this, you could do the following:
    - Install the BruteFIR plugin and try to get it to run
    - re-write BrutefirDrc/Bin/brutefirwrapper to use camilladsp instead of BruteFIR (keeping the same parameters, so you don't have to change the plugin itself)
    - if this works, make the required modification to the plugin
    Various SW: Web Interface | Playlist Editor / Generator | Music Classification | Similar Music | Announce | EventTrigger | LMSlib2go | ...
    Various HowTos: build a self-contained LMS | Bluetooth/ALSA | Control LMS with any device | ...

  7. #7
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    5,720

    Determine samplerate LMS, squeezelite or like

    Quote Originally Posted by Jesperlykke View Post
    Hi here... first post in dev-section ever here

    I allready contacted some of the devoleper's here, but i also would like some input's of howto actually write my own plugins.
    It's hard to find information howto get started, as i to be honest have no clue where to start?


    Well the real case is as follows :
    Over at diyaudio, there is a new thread where a very good low cpupower dsp engine is developed.
    This DSP engine "camilladsp" is capable of making room correction, X-overs etc.. for stereo/speaker systems (the one we all have in our livingroom )
    The engine takes the input from e.g. squeezelite/LMS and convert it through some filter (could be bass boost, or correction of the room where speakers are etc...)

    Well, i have it going on newest piCorePlayer with some "ugly" init.d scripts everything is running very very good without glitches, noise or anything weird, so that's a good start.
    For now the camilladsp_engine only "converts" normal (ALSA) 44.1KhZ streams from LMS/squeezelite/Loopback[camilladsp]Loopback ---> real hardware soundcard (CD quality).
    If i should have it working with other samplerates (44,1 / 88,2 / 96 ..... 192Khz...) i must somehow determine the samplerate for the next song played.
    If i could see that somewhere through a plugin, or in LMS somewhere or even squeezelite i could switch the filter on the camilladsp_engine on the fly.

    I really hope someone here can give me some input, or also if someone have some howto's to get me started making my own plugin (if i need that for samplerate determination)

    Best Regards; Jesper.
    If you are willing to recompile squeezelite I can show you where to put a hack to do that, itís fairly easy. If you donít want to, then you need to force proxy in LMS and have decoding done there because LMS does not always know sample rate (the client only knows when it opens and parses the file/stream)
    Last edited by philippe_44; 2020-03-23 at 19:04.
    LMS 7.7, 7.8 and 7.9 - 5xRadio, 3xBoom, 4xDuet, 1xTouch, 1 SB2. Sonos PLAY:3, PLAY:5, Marantz NR1603, JBL OnBeat, XBoxOne, XBMC, Foobar2000, ShairPortW, JRiver 21, 2xChromecast Audio, Chromecast v1 and v2, , Pi B3, B2, Pi B+, 2xPi A+, Odroid-C1, Odroid-C2, Cubie2, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5

  8. #8
    Morning ...

    If you are willing to recompile squeezelite I can show you where to put a hack to do that, itís fairly easy. If you donít want to, then you need to force proxy in LMS and have decoding done there because LMS does not always know sample rate (the client only knows when it opens and parses the file/stream)
    Yes i would be delighted to recompile the squeezelite source. I have the tools on my RPI4 allready installed for this.

    This hack in the source you mention, i really looking forward to see and try!; thanks

    Jesper.

  9. #9
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    5,720
    Quote Originally Posted by Jesperlykke View Post
    Morning ...

    Yes i would be delighted to recompile the squeezelite source. I have the tools on my RPI4 allready installed for this.

    This hack in the source you mention, i really looking forward to see and try!; thanks

    Jesper.
    Look at decode.c. You have a function named decode_newstream whose purpose is to decide the sample rate of the *next* track. If you add your hack here, you'll always have the chosen sample rate, including when squeezelite decides to do resampling. Every decoder must call it with the rate it has extracted for the next track and then it goes through resampler's evaluation if needed.
    LMS 7.7, 7.8 and 7.9 - 5xRadio, 3xBoom, 4xDuet, 1xTouch, 1 SB2. Sonos PLAY:3, PLAY:5, Marantz NR1603, JBL OnBeat, XBoxOne, XBMC, Foobar2000, ShairPortW, JRiver 21, 2xChromecast Audio, Chromecast v1 and v2, , Pi B3, B2, Pi B+, 2xPi A+, Odroid-C1, Odroid-C2, Cubie2, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5

  10. #10
    unsigned decode_newstream(unsigned sample_rate, unsigned supported_rates[]) {

    // called with O locked to get sample rate for potentially processed output stream
    // release O mutex during process_newstream as it can take some time

    MAY_PROCESS(
    if (decode.process) {
    UNLOCK_O;
    sample_rate = process_newstream(&decode.direct, sample_rate, supported_rates);
    LOCK_O;
    }
    );

    return sample_rate;
    }


    So i have to make a hack here for showing the sample rate.

    Can you suggest something to get me started, i will have to lear some C coding to get further.
    Could it be possible to "paste" sample_rate into a file, say /home/pi/.samplerate? I really like to learn myself, but can you perhaps show me howto do that or maybe some other clevere way that i can use ?

    Thank you very much

Posting Permissions

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