Hello,
Nooby question for ALSA experts, I hope this is the right forum: is it possible to invert the polarity of a digital stream on the fly using just ALSA? I've been discussing the usefulness of such a feature with the maintainer of a free MPD-based player for the Raspberry Pi, and the preferable way to implement this would seem to be using ALSA directly, possibly by means of a LADSPA plugin.
Please keep this thread focused on the feasability of this task; the merits of why this may or may not be useful to have can be discussed elsewhere if there is demand. Notice, however, that some pretty good DACs have a dedicated button for this purpose. Also DAPHILE (based on sqeezelite) has such a setting, although buried deep inside the menu system.
Nooby question for ALSA experts, I hope this is the right forum: is it possible to invert the polarity of a digital stream on the fly using just ALSA? I've been discussing the usefulness of such a feature with the maintainer of a free MPD-based player for the Raspberry Pi, and the preferable way to implement this would seem to be using ALSA directly, possibly by means of a LADSPA plugin.
Please keep this thread focused on the feasability of this task; the merits of why this may or may not be useful to have can be discussed elsewhere if there is demand. Notice, however, that some pretty good DACs have a dedicated button for this purpose. Also DAPHILE (based on sqeezelite) has such a setting, although buried deep inside the menu system.
Just define your own alsa device in .asoundrc with route plugin and invert the required channel. I do this for one of the channels (ttable ..... 0.1= -1 ) in virtual balanced_out device Virtual balanced in/out from regular soundcard in linux - results .
Interesting 🙂
The ttable coefficient represents volume (%) correct?
And a negative value inverts the waveform?
The ttable coefficient represents volume (%) correct?
And a negative value inverts the waveform?
Code:
A.B = X
The coeff X is a decimal-point number representing the multiplier of input channel A into the output channel B. All contributions to channel B are summed - that is why when mixing two channels (0.0 = X, 1.0 = Y) the coeffs should not exceed 0.5 to make sure no clipping can occur during the summation.
Negative sign just inverts phase - multiplication by a negative number.
The string number is read by the c-stdlib function strtod.
Great, thanks 🙂 but is it performing a phase shift of the waveform (moving it forwards or backwards in time) or is it inverting the waveform (flipping it but no time shift)
Phase vs Polarity explained | JustMastering.com
Phase vs Polarity explained | JustMastering.com
Hi, i think I actually asked the same thing by starting a new thread.
Going through this post I cant say I found/know the solution.
I need to invert both channels on the fly, both flipped. Running picoreplayer.
Did you manage to make the correct config?
Thanks
Going through this post I cant say I found/know the solution.
I need to invert both channels on the fly, both flipped. Running picoreplayer.
Did you manage to make the correct config?
Thanks
Actually your requirement for on-the-fly flipping complicates the matter substantially. You cannot use a fixed alsa device with route plugin as its config cannot be changed while the stream plays.
Actually your requirement for on-the-fly flipping complicates the matter substantially. You cannot use a fixed alsa device with route plugin as its config cannot be changed while the stream plays.
I'm not sure I understand, or maybe my description was really bad, sorry!
I want a permeant config so every track is played with inverted polarity, all the time for any audio that the pCP plays. Both channels.
Does it makes sense or maybe I mistook your reply?
Thanks
Last edited:
I thought you wanted to flip the polarity on the fly, i.e. during playback.
If not, then use the alsa route solution as described earlier.
In alsa config (.e.g. $HOME/.asoundrc ):
And tell your playback software to use the new alsa device called "inverted".
You will have to ask at the picoreplayer forums how to change the read-only filesystem of picorelinux to store the .asoundrc file and change your player config permanently Raspberry Pi .
If not, then use the alsa route solution as described earlier.
In alsa config (.e.g. $HOME/.asoundrc ):
Code:
pcm.inverted {
type route
slave {
pcm "hw:0" # the actual soundcard
channels 2
}
ttable {
0.0= -1 # first channel inverted (in0 -> out0 * -1)
1.1= -1 # second channel inverted (in1 -> out1 * -1)
}
}
And tell your playback software to use the new alsa device called "inverted".
You will have to ask at the picoreplayer forums how to change the read-only filesystem of picorelinux to store the .asoundrc file and change your player config permanently Raspberry Pi .
Amazing thanks a lot. Ill test it
There is also a player specific polarity setting in the LMS Server Settings page.
There is also a player specific polarity setting in the LMS Server Settings page.
I didnt know that! Im new to LMS!
Ill check that too when Im back home.
Im in the middle of Iceland at the moment 🙂
- Status
- Not open for further replies.
- Home
- Source & Line
- PC Based
- polarity inversion on the fly by means of ALSA?