Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 6 of 6
  1. #1
    Junior Member
    Join Date
    Oct 2021
    Posts
    3

    LMS plugin allowing digital time delay

    Hy
    I am new to LMS, wich I really enjoy and use with PcP on a RPi3.
    In my listening room, my left and right speakers have an axial dis-alignment (about 1 meter), depending from where I listen. So I would like to apply a time delay compensation of a few milliseconds to the closest of the speakers. That would of course have to be bit-perfect.
    I looked but did not see any plugin allowing this. Brutefir probably would do, but apparently the plugin is not accessible anymore ?
    Would you have any suggestion ?
    Thank you very much !
    Best
    Nils

  2. #2
    Senior Member
    Join Date
    Apr 2005
    Location
    Honiton, Devon, UK
    Posts
    1,973
    Quote Originally Posted by nils92 View Post
    Hy
    I am new to LMS, wich I really enjoy and use with PcP on a RPi3.
    In my listening room, my left and right speakers have an axial dis-alignment (about 1 meter), depending from where I listen. So I would like to apply a time delay compensation of a few milliseconds to the closest of the speakers. That would of course have to be bit-perfect.
    I looked but did not see any plugin allowing this. Brutefir probably would do, but apparently the plugin is not accessible anymore ?
    Would you have any suggestion ?
    Thank you very much !
    Best
    Nils
    SOX is available in pCP and has a delay option that will allow you to specify different delays for different channels.
    Excerpt from the SOX man page:
    Code:
    delay {length}
        Delay one or more audio channels. length can specify a time or, if appended with an 's', a number of samples.
        Do not specify both time and samples delays in the same command.
        For example, delay 1.5 0 0.5 delays the first channel by 1.5 seconds, the third channel by 0.5 seconds,
        and leaves the second channel (and any other channels that may be present) un-delayed.
    You'll need to set up a custom-convert file in LMS, but that's pretty straightfoward.
    Until recently: Transporter -> ATC SCM100A, now sold :-(
    House move forced change to: piCorePlayer(RPi2/HiFiBerry DIGI2 Pro) -> Meridian 218 -> Meridian M6

  3. #3
    Junior Member
    Join Date
    Oct 2021
    Posts
    3
    Quote Originally Posted by cliveb View Post
    SOX is available in pCP and has a delay option that will allow you to specify different delays for different channels.
    Excerpt from the SOX man page:
    Code:
    delay {length}
        Delay one or more audio channels. length can specify a time or, if appended with an 's', a number of samples.
        Do not specify both time and samples delays in the same command.
        For example, delay 1.5 0 0.5 delays the first channel by 1.5 seconds, the third channel by 0.5 seconds,
        and leaves the second channel (and any other channels that may be present) un-delayed.
    You'll need to set up a custom-convert file in LMS, but that's pretty straightfoward.
    Thanks very much cliveb

    So from what I understood after a bit of search, I will have to
    - activate C-3PO plugin
    - from the Picoreplayer LMS tab, I will load a custom convert file in a .txt format
    - in this custom-convert, no need to copy the whole convert.conf file, I just have to add something like the following line to time-compensate for a 1 m speaker disalignment : [sox] delay 0 0.003 (to add a 3 ms delay to the second channel)

    Is that the general idea ?

    I don't know if sox will accept to handle 0.003 second, it would probably be better to input samples rather than seconds, but then the number of samples would depend upon the sample rate, wich makes it more complicated

  4. #4
    Senior Member
    Join Date
    Apr 2005
    Location
    Honiton, Devon, UK
    Posts
    1,973
    Quote Originally Posted by nils92 View Post
    Thanks very much cliveb

    So from what I understood after a bit of search, I will have to
    - activate C-3PO plugin
    - from the Picoreplayer LMS tab, I will load a custom convert file in a .txt format
    - in this custom-convert, no need to copy the whole convert.conf file, I just have to add something like the following line to time-compensate for a 1 m speaker disalignment : [sox] delay 0 0.003 (to add a 3 ms delay to the second channel)

    Is that the general idea ?

    I don't know if sox will accept to handle 0.003 second, it would probably be better to input samples rather than seconds, but then the number of samples would depend upon the sample rate, wich makes it more complicated
    I don't think the C-3PO plugin is relevant. I run SOX in a custom-convert to do room correction EQ and the C-3PO plugin is not active in my LMS (which is running in pCP on a RPi3).

    You're right that you don't need to replicate the standard convert.conf in your custom-convert - it just needs to override the standard stuff for the particular file types and players of interest. I'd say your file should look something like:
    Code:
    flc flc * <mac address of the player needing the delay>
       [sox] -q --multi-threaded --no-clobber -t flac $FILE$ -t flac - delay 0 0.003
    This is assuming your source files are FLAC. If you use some other format, you'd need to change the file type, eg. for MP3:
    Code:
    mp3 flc * <mac address of the player needing the delay>
       [sox] -q --multi-threaded --no-clobber -t mp3 $FILE$ -t flac - delay 0 0.003
    You make a good point about whether SOX will accept 0.003 to represent 3ms of delay, and the issue of different sample rates if you instead specify samples.
    I guess you'll just have to experiment.

    One last comment: when I tried loading a custom-convert using pCP's upload facility, it kept complaining that the file was the wrong format, so I had to manually set it up with an editor while SSH'd into the machine.
    Until recently: Transporter -> ATC SCM100A, now sold :-(
    House move forced change to: piCorePlayer(RPi2/HiFiBerry DIGI2 Pro) -> Meridian 218 -> Meridian M6

  5. #5
    Junior Member
    Join Date
    Oct 2021
    Posts
    3
    Quote Originally Posted by cliveb View Post
    I don't think the C-3PO plugin is relevant. I run SOX in a custom-convert to do room correction EQ and the C-3PO plugin is not active in my LMS (which is running in pCP on a RPi3).

    You're right that you don't need to replicate the standard convert.conf in your custom-convert - it just needs to override the standard stuff for the particular file types and players of interest. I'd say your file should look something like:
    Code:
    flc flc * <mac address of the player needing the delay>
       [sox] -q --multi-threaded --no-clobber -t flac $FILE$ -t flac - delay 0 0.003
    This is assuming your source files are FLAC. If you use some other format, you'd need to change the file type, eg. for MP3:
    Code:
    mp3 flc * <mac address of the player needing the delay>
       [sox] -q --multi-threaded --no-clobber -t mp3 $FILE$ -t flac - delay 0 0.003
    You make a good point about whether SOX will accept 0.003 to represent 3ms of delay, and the issue of different sample rates if you instead specify samples.
    I guess you'll just have to experiment.

    One last comment: when I tried loading a custom-convert using pCP's upload facility, it kept complaining that the file was the wrong format, so I had to manually set it up with an editor while SSH'd into the machine.
    Thanks cliveb, I'm progressing !
    I managed to create an effective custom-convert file through SSH, and so could test your code.
    But, when using for instance the <delay 0 1> instruction in the line code, I do indeed have a time delay effect of 1s, but this time delay is not applied to the right speaker as opposed to the left one, as I would need it to. Instead, it generates an echo of 1s of the audio stream for both left and right speakers. So left and right remain aligned. Perhaps "channel 1" is not pointing to left speaker, and "channel 2" to right speaker ?

    I tried to sort things out with the sox manual, but to say the truth with my level of knowledge I'm having a bit of a hard time, as I do not find that instructions such as "multi-threaded", "no-clobber" are very much explicited...

    I'll let it sleep overnight before coming back to it ;-)

    And by the way, indeed no use of C-3PO to run Sox.

  6. #6
    Senior Member
    Join Date
    Apr 2005
    Location
    Honiton, Devon, UK
    Posts
    1,973
    Quote Originally Posted by nils92 View Post
    Thanks cliveb, I'm progressing !
    I managed to create an effective custom-convert file through SSH, and so could test your code.
    But, when using for instance the <delay 0 1> instruction in the line code, I do indeed have a time delay effect of 1s, but this time delay is not applied to the right speaker as opposed to the left one, as I would need it to. Instead, it generates an echo of 1s of the audio stream for both left and right speakers. So left and right remain aligned. Perhaps "channel 1" is not pointing to left speaker, and "channel 2" to right speaker ?
    Sorry, but I've never used the delay option with SOX, so I don't have direct experience with how it might behave. Nor am I keen on fiddling around with my own custom-convert file to try it out, so I'm afraid you'll have to conduct your own experiments.

    Quote Originally Posted by nils92 View Post
    I tried to sort things out with the sox manual, but to say the truth with my level of knowledge I'm having a bit of a hard time, as I do not find that instructions such as "multi-threaded", "no-clobber" are very much explicited...
    multi-threaded just tells SOX to use multiple cores to do its processing, if the CPU you're using has them, which might speed up processing a touch. You don't have to include that option.

    no-clobber causes SOX to prompt before overwriting an output file, which is generally a good option to include. But in the context of using it with LMS, it's pretty much redundant. Can't hurt to include it, though.
    Until recently: Transporter -> ATC SCM100A, now sold :-(
    House move forced change to: piCorePlayer(RPi2/HiFiBerry DIGI2 Pro) -> Meridian 218 -> Meridian M6

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
  •