Re: [Alsa-user] Unbalanced stereo input as balanced mono input
Gunnar Arndt wrote: the configuration of an Alsa PCM device which does that job automatically in real time: (1) Grab a stereo signal from the line input. (2) Invert either the left OR the right channel (i.e. multiply its signal's amplitude by minus 1). (3) Merge the channels to mono. pcm.fake_balanced { type route slave.pcm hw:0# or whatever ttable [ [ 1 -1 ] ] } http://alsa.opensrc.org/Asoundrc#Downmix_stereo_to_mono But that suggestion does not seem work as expected - if I use that configuration, the left channel is doubled, and the right channel is dropped when recording (or the other way, doesn't matter). The ttable specifies how the channels of the route device are mapped from/to the channels of the slave device. It's a two-dimensional array (i.e., an array containing arrays), with the outer array having one entry for each route-device channel, and each inner array having one entry for each slave channel. (The ttable.r.s value mechanism of specifying table entries works too, but is typcially not as easy to understand.) Regards, Clemens -- ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
Re: [Alsa-user] Unbalanced stereo input as balanced mono input
On Sun, 23 Aug 2015 18:07:32 -0700 (PDT), Bill Unruh wrote: Now, that may mean that there is common mode noise, in which case running the balanced into an unbalanced would be very noisy, or the noise was all in the ground wire, in which case bal-unbal might work. It's the nature of unbalanced connections, that they are noisier than balanced connections. However, there are several ways to implement balanced IOs. Using two unbalanced mono input channels as a single balanced input channel is not one of that ways. Most important is that the output and input fit together, than to care about balanced or unbalanced. Cable length and impedance need more attention. The microphone might provide line output (unusual, but not impossible). The OP should consider to use microphone output instead and to use a pre-amp for the input. I suspect to care about cable length and impedance is more important than to fake a balanced input. I doubt that a faked balanced input using two unbalanced mono inputs of an elcheapo audio device is good for any kind of measurement or audio recording. Btw. there's always a discussion if the cold output should be open-circuit for balanced output to unbalanced input. So you could consider the unbalanced to unbalanced connections I posted as wrong. OTOH a connection of cold and ground is wanted for unbalanced output to balanced input. We could discuss the amount of cores of the cable, to provide the latter, but since this thread is about balanced to faked balanced, we could add a discussion about balanced to balanced grounding. The grounding between balanced IOs could also be done in different ways. Note that he does not say what measurements he wants to do. If it is just levels then the crappy sound card might do, but even freq response is liable to be dominated by his the response of his sound card. And noise is almost certainly dominated by the sound card. IIRC the OP even didn't mention if the microphone should be used for measurements or underwater vocal recording. We aren't talking about a professional solution, we are talking about the advantage to fake a balanced input when using a crappy user input device in combination with the balanced output of a measuring microphone. There's no advantage! We do not need to care about technical reasons pro and con a faked balanced input by two unbalanced inputs. We simply should notice that 1. relatively good balanced pre-amps are very cheap nowadays and 2. they were more expensive years ago, when nobody considered to make two unbalanced inputs of home recording gear a faked balanced input. Why wasn't this done? Nobody was brilliant enough to think about this superp idea? Unbalanced stereo input as balanced mono input is an utterly wrong idea. I recommend to get a cheap, but anyway relatively good microphone pre-amp or directly pay for a better audio card with an integrated microphone pre-amp and FWIW to use defaults regarding the grounding, IOW not to modify gear and to use averaged, common cables. If getting new equipment shouldn't be an option, I would use the provided IOs as they are and not fake a balanced input. 2 Cents, Ralf -- ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
Re: [Alsa-user] Unbalanced stereo input as balanced mono input
As mentioned, it's an experiment - I'm about to get better hardware, but found it interesting. I'm actually suprised by furor I caused... Am 24.08.2015 um 22:46 schrieb Bill Unruh: The cheapest analog hardware method to convert from balanced to unbalanced requires two conditions: 1) the balanced output must come from a transformer (coil of wire on a ferrous core); _AND_ 2) you are willing to sacrifice a little noise floor in exchange for economy. That solution is to just ground one of the balanced wires and use the other as signal. I know that this is the common way, but why would I do it that way if there IMHO is a better one? As I had explained in my initial message, there is noise which can be cancelled by using the line in as a fake-balanced. Btw, that noise is actually from the on-board wiring - it's there even if nothing is connected to line input. And with the fake balanced, it is cancelled, so I guess that Asrock have placed the wires for the left and right channels in close proximity to each other on the mainboard, allowing to use the advantages of fake-balanced signalling even there. Why not buy a better sound card? Kludging stuff to cancel out design incompetence will almost always come back to bite you. -- ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
Re: [Alsa-user] Unbalanced stereo input as balanced mono input
On Mon, 24 Aug 2015, Gunnar Arndt wrote: Btw, that noise is actually from the on-board wiring - it's there even if nothing is connected to line input. If nothing is connected even the best discrete circuits could be noisy. For e.g. phono pre-amps it's common to insert short circuit connectors, when they are unused. Another analog hardware solution would be to use an audio isolation transformer in front of your digitizer. Radio Shack used to sell a fairly cheap audio isolation transformer that worked surprisingly well. A metal box for shielding is probably a good idea. I'm not sure if I understand correctly what its purpose would be - unbalance the signal, like what I know as an opposite DI box? If you put under consideration that the noise comes from the mainboard for the most part, you'll agree that it would not make sense to unbalance the signal before reaching the mainboard, as some box would require. It makes sense! Mic balanced -long-wire- balanced in, circuit with transformer, unbalanced out -short-wire- unbalanced in, mobo audio device If a transformer is the best solution for your usage is questionable, but it for sure is a better solution, than what you're doing. I know that a better sound card is required - especially for the frequency range: the mic goes down to 9Hz, whereas the current sound chip goes only to 20Hz. Audio engineering isn't rocket science. A lot of quite good prosumer sound cards can't go lower than 20 Hz. Don't care that much about key data, such as signals that might have half of the level, than other signals or a wide frequency response range. The quality of circuits and signals depends on balance of a lot of specifications, that have to fit to the usage. Consider your faked balanced input as very imbalanced. If you get rid of noise, you not necessarily win sound quality, let alone a linear or what ever kind of response that might be wanted for measurements. -- ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
Re: [Alsa-user] Unbalanced stereo input as balanced mono input
Ralf, you have been engaging heavily in this discussion, but, as it seems to me, with increasing aggression. I cannot comprehend that - if you do not like my idea, you do not have to use it. Further comments below. Am 24.08.2015 um 11:55 schrieb Ralf Mardorf: On Sun, 23 Aug 2015 18:07:32 -0700 (PDT), Bill Unruh wrote: Now, that may mean that there is common mode noise, in which case running the balanced into an unbalanced would be very noisy, or the noise was all in the ground wire, in which case bal-unbal might work. It's the nature of unbalanced connections, that they are noisier than balanced connections. That's why I'm trying simulate a balanced one - before you go bananas now: If you look back to my initial message, you'll notice that I used the words `abuse' and `experimental' to describe my approach. However, there are several ways to implement balanced IOs. Using two unbalanced mono input channels as a single balanced input channel is not one of that ways. That must be why that way works well, as it seems. Most important is that the output and input fit together, than to care about balanced or unbalanced. Cable length and impedance need more attention. The microphone might provide line output (unusual, but not impossible). It does - not very loud, but there is a clear signal when recording through the line input - much stronger that the still significant noise (which is gone when unbalancing/subtracting). The OP should consider to use microphone output instead and to use a pre-amp for the input. There is a microphone output? I haven't used the microphone input as it provides a bit of voltage for a cheap microphone's amp, which is not required for mine, because it is battery-powered. I suspect to care about cable length and impedance is more important than to fake a balanced input. Yeah, must be the cable length. It's always the cable length. I doubt that a faked balanced input using two unbalanced mono inputs of an elcheapo audio device is good for any kind of measurement or audio recording. I agree with you on that - that is why I described my approach as experimental in the first place. Btw. there's always a discussion if the cold output should be open-circuit for balanced output to unbalanced input. So you could consider the unbalanced to unbalanced connections I posted as wrong. OTOH a connection of cold and ground is wanted for unbalanced output to balanced input. We could discuss the amount of cores of the cable, to provide the latter, but since this thread is about balanced to faked balanced, we could add a discussion about balanced to balanced grounding. The grounding between balanced IOs could also be done in different ways. Note that he does not say what measurements he wants to do. If it is just levels then the crappy sound card might do, but even freq response is liable to be dominated by his the response of his sound card. And noise is almost certainly dominated by the sound card. IIRC the OP even didn't mention if the microphone should be used for measurements or underwater vocal recording. That's actually off topic to answer my question - if unbalancing (subtracting left and right) can be done by ALSA. As it seems to be important for you guys: I'm currently configuring DSP-based crossovers for active speakers, which involves measurements of the speakers' impulse and frequency response. We aren't talking about a professional solution, we are talking about the advantage to fake a balanced input when using a crappy user input device in combination with the balanced output of a measuring microphone. There's no advantage! Wrong: At least, it cancels the noise of the sound card. Of course, that's evidence of the lost-cost hardware problem everybody keeps complaining about. And, as with every proper balanced connection, interference introduced to both the non-inverted and the inverted line at the same level is canceled when finally subtracting them. I don't see why that would not work. Matching levels and impedance is another issue. We do not need to care about technical reasons pro and con a faked balanced input by two unbalanced inputs. We simply should notice that 1. relatively good balanced pre-amps are very cheap nowadays and 2. they were more expensive years ago, when nobody considered to make two unbalanced inputs of home recording gear a faked balanced input. Why wasn't this done? Nobody was brilliant enough to think about this superp idea? Do you have evidence anybody did think about it? It's not about having the brightest idea for me - I just wanted to know how to realize it, which I now do. And, in fact, I'm far more interested in technical reasons than in historical or economical ones, as the latter cannot prove that the idea was wrong. To my understanding, technical ones so far couldn't either. Unbalanced stereo input as balanced mono input is an utterly wrong idea. That must be why it
Re: [Alsa-user] Unbalanced stereo input as balanced mono input
The cheapest analog hardware method to convert from balanced to unbalanced requires two conditions: 1) the balanced output must come from a transformer (coil of wire on a ferrous core); _AND_ 2) you are willing to sacrifice a little noise floor in exchange for economy. That solution is to just ground one of the balanced wires and use the other as signal. I know that this is the common way, but why would I do it that way if there IMHO is a better one? As I had explained in my initial message, there is noise which can be cancelled by using the line in as a fake-balanced. Btw, that noise is actually from the on-board wiring - it's there even if nothing is connected to line input. And with the fake balanced, it is cancelled, so I guess that Asrock have placed the wires for the left and right channels in close proximity to each other on the mainboard, allowing to use the advantages of fake-balanced signalling even there. Why not buy a better sound card? Kludging stuff to cancel out design incompetence will almost always come back to bite you. -- ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
Re: [Alsa-user] Unbalanced stereo input as balanced mono input
Clemens, thank you for your reply - it has been the only helpful one so far. Am 24.08.2015 um 08:43 schrieb Clemens Ladisch: Gunnar Arndt wrote: the configuration of an Alsa PCM device which does that job automatically in real time: (1) Grab a stereo signal from the line input. (2) Invert either the left OR the right channel (i.e. multiply its signal's amplitude by minus 1). (3) Merge the channels to mono. pcm.fake_balanced { type route slave.pcm hw:0# or whatever ttable [ [ 1 -1 ] ] } I had to add some stuff, but now it works. My asound.conf looks like this now: pcm.symmetric { type route slave { pcm hw:0,2 channels 2 } ttable [ [ 1 -1 ] [ 1 -1 ] ] } ctl.symmetric { type hw card 0 } I had tested a similar solution yesterday evening after I had found that negative scaling is possible here: http://www.volkerschatz.com/noise/alsa.html but the nested array notation you have suggested makes things easier. Regards Gunnar http://alsa.opensrc.org/Asoundrc#Downmix_stereo_to_mono But that suggestion does not seem work as expected - if I use that configuration, the left channel is doubled, and the right channel is dropped when recording (or the other way, doesn't matter). The ttable specifies how the channels of the route device are mapped from/to the channels of the slave device. It's a two-dimensional array (i.e., an array containing arrays), with the outer array having one entry for each route-device channel, and each inner array having one entry for each slave channel. (The ttable.r.s value mechanism of specifying table entries works too, but is typcially not as easy to understand.) Regards, Clemens -- ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
Re: [Alsa-user] Unbalanced stereo input as balanced mono input
Robert, thank you for your message. I appreciate the additional information. Am 23.08.2015 um 23:20 schrieb Robert M. Riches Jr.: Date: Sun, 23 Aug 2015 19:11:17 +0200 From: Gunnar Arndt madenhac...@gmail.com To: alsa-user@lists.sourceforge.net I have the following idea, which may be of interest for other users, too: I would like to abuse the 'normal' unbalanced stereo input of my on-board sound as a balanced mono input. I have a measurement microphone with an integrated amplifier and a balanced mono output which should be connected to consumer sound devices with an `ordinary' unbalanced input (I have added a very short explanation on the term `balanced' to the post scriptum). ... In the analog domain, one issue will be the signal levels. Line level is usually a few hundred millivolts. Mike level is usually on the order of a few millivolts. When going through a stereo line input, you might not have enough gain. There is also some likelihood that the line input's front-end's noise floor might be too high for your mike signals. The mic has an integrated amp which seems to deliver line level - at least, I have a clear signal from the mic on the line input, which is much stronger than the noise. Another analog domain issue is that noise and other common mode excursions might be of greater amplitude than signal and might be larger than your input channel can handle. A true balanced input channel, perhaps with a transformer front end, would be more likely to handle larger common mode noise than desired differential signal. The cheapest analog hardware method to convert from balanced to unbalanced requires two conditions: 1) the balanced output must come from a transformer (coil of wire on a ferrous core); _AND_ 2) you are willing to sacrifice a little noise floor in exchange for economy. That solution is to just ground one of the balanced wires and use the other as signal. I know that this is the common way, but why would I do it that way if there IMHO is a better one? As I had explained in my initial message, there is noise which can be cancelled by using the line in as a fake-balanced. Btw, that noise is actually from the on-board wiring - it's there even if nothing is connected to line input. And with the fake balanced, it is cancelled, so I guess that Asrock have placed the wires for the left and right channels in close proximity to each other on the mainboard, allowing to use the advantages of fake-balanced signalling even there. Another analog hardware solution would be to use an audio isolation transformer in front of your digitizer. Radio Shack used to sell a fairly cheap audio isolation transformer that worked surprisingly well. A metal box for shielding is probably a good idea. I'm not sure if I understand correctly what its purpose would be - unbalance the signal, like what I know as an opposite DI box? If you put under consideration that the noise comes from the mainboard for the most part, you'll agree that it would not make sense to unbalance the signal before reaching the mainboard, as some box would require. For the digital domain solution, if your use case is non-real-time, you could record a stereo signal into a 2-channel WAV file and then post-process it into a mono WAV file by taking the difference. Sox might have a filter for that. Otherwise, a C program wouldn't take long to write to do that. An alternative to saving the (noisy) stereo file would be to output RAW samples and do the conversion using Linux pipes--but that would probably introduce considerable latency, depending on buffer sizes. As explained in my initial message, I had tested my approach with recording software successfully, and was looking for a (soft) real-time solution, which Clemens has provided in the meantime. Regards Gunnar -- ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
Re: [Alsa-user] Unbalanced stereo input as balanced mono input
Hi Gunnar, no bad feelings here. I was neither aggressive, nor sarcastic. I worked a little bit as audio engineer and a little bit for one of the two more known German mic companies. I'm currently configuring DSP-based crossovers for active speakers, which involves measurements of the speakers' impulse and frequency response. Assumed the left and right stereo channel circuits of your integrated audio device work different. What would happen to the mix of the cold and hot signal? How much matters noise for those measurements? I've got no experiences with measurments, but IMO noise might be less critical, than an experimental input. YMMV! On Mon, 24 Aug 2015 13:46:41 -0700 (PDT), Bill Unruh wrote: Kludging stuff to cancel out design incompetence will almost always come back to bite you. +1 On Mon, 24 Aug 2015 22:49:16 +0200, Gunnar Arndt wrote: I'm actually suprised by furor I caused... If we would talk to each other you could notice that the voices are relaxed. Regards, Ralf -- ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
Re: [Alsa-user] Unbalanced stereo input as balanced mono input
On Sun, 23 Aug 2015 19:11:17 +0200, Gunnar Arndt wrote: I have a measurement microphone with an integrated amplifier and a balanced mono output which should be connected to consumer sound devices with an `ordinary' unbalanced input AFAIK Audacity supports LADSPA plugins, so perhaps a plugin does what you want to get. http://plugin.org.uk/ladspa-swh/docs/ladspa-swh.html#tth_sEc2.60 I don't know if this is what you want. However, what you're doing is bad engineering. 1. You should use the microphone unbalanced. http://www.sengpielaudio.com/KlinkensteckerUndXLRsteckerSymmetrisch.pdf 2. Splitting a mono output for a stereo input doesn't need attention, just stereo to mono needs attention. 3. I suspect the integrated amp is for a capacitor microphone and perhaps a battery is integrated, so that no phantom power is needed. If so, then it still matters that a line input differs from a microphone input. The amp likely is need to provide any output, it's unlikely a pre-amp to match non-microphone inputs. However, you can connect the microphone to a line input, it's just not optimal to do it. -- ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
Re: [Alsa-user] Unbalanced stereo input as balanced mono input
Date: Sun, 23 Aug 2015 19:11:17 +0200 From: Gunnar Arndt madenhac...@gmail.com To: alsa-user@lists.sourceforge.net Hi Alsa users, I have the following idea, which may be of interest for other users, too: I would like to abuse the 'normal' unbalanced stereo input of my on-board sound as a balanced mono input. I have a measurement microphone with an integrated amplifier and a balanced mono output which should be connected to consumer sound devices with an `ordinary' unbalanced input (I have added a very short explanation on the term `balanced' to the post scriptum). My equipment: * Ubuntu 14.04.3 with latest updates, including Kernel 3.19 and ALSA 1.0.25. * HD-Audio-based Realtek AL1150 codec on an Asrock X99 Extreme4 mainboard - with unbalanced stereo input, of course. * Earthworks M30BX microphone with a balanced mono output (an XLR plug). * A DMX out cable (XLR to 3.5mm stereo) connects the mic correctly to the line input of the sound card: Ground to ground, balanced non-inverting to unbalanced left, balanced inverting to unbalanced right. ... In the analog domain, one issue will be the signal levels. Line level is usually a few hundred millivolts. Mike level is usually on the order of a few millivolts. When going through a stereo line input, you might not have enough gain. There is also some likelihood that the line input's front-end's noise floor might be too high for your mike signals. Another analog domain issue is that noise and other common mode excursions might be of greater amplitude than signal and might be larger than your input channel can handle. A true balanced input channel, perhaps with a transformer front end, would be more likely to handle larger common mode noise than desired differential signal. The cheapest analog hardware method to convert from balanced to unbalanced requires two conditions: 1) the balanced output must come from a transformer (coil of wire on a ferrous core); _AND_ 2) you are willing to sacrifice a little noise floor in exchange for economy. That solution is to just ground one of the balanced wires and use the other as signal. Another analog hardware solution would be to use an audio isolation transformer in front of your digitizer. Radio Shack used to sell a fairly cheap audio isolation transformer that worked surprisingly well. A metal box for shielding is probably a good idea. For the digital domain solution, if your use case is non-real-time, you could record a stereo signal into a 2-channel WAV file and then post-process it into a mono WAV file by taking the difference. Sox might have a filter for that. Otherwise, a C program wouldn't take long to write to do that. An alternative to saving the (noisy) stereo file would be to output RAW samples and do the conversion using Linux pipes--but that would probably introduce considerable latency, depending on buffer sizes. HTH Robert -- ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
Re: [Alsa-user] Unbalanced stereo input as balanced mono input
On Sun, 23 Aug 2015 14:20:46 -0700, Robert M. Riches Jr. wrote: That solution is to just ground one of the balanced wires and use the other as signal. This (an unbalanced wiring) is the only sane solution for this kind of setup. Faked balanced input or real balanced input by using a transformer or what ever kind of cheap circuit won't help. After that it's possible to connect this mono signal to the left and right input, no de-coupling and no conversion is needed, but I anyway wouldn't do it. IMO the OP should record the unbalanced signal by the left or right channel only and split it to two mono signals by software, e.g. by jackd connections, assumed it should be needed. However, one issue still remains. Line input is not optimised for microphone output. Btw. I guess integrated consumer audio provides some kind of microphone input. It might be crappy, but likely better than any kind of connection to crappy line inputs. A cheap microphone pre-amp with line output might help when using mobo integrated audio too. For what purpose ever a measurement microphone might be good for, I doubt that usage with an on-board audio device makes much sense. -- ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
Re: [Alsa-user] Unbalanced stereo input as balanced mono input
He stated that if he ran the signal left and right with the ground as common ground, he got lots of noise. If he subtracted L from R the noise disappeared. Now, that may mean that there is common mode noise, in which case running the balanced into an unbalanced would be very noisy, or the noise was all in the ground wire, in which case bal-unbal might work. But there is another issue. He does not say if the mic is a battery operated unit or a mains operated. If the latter, then the battle between the grounds of his mic and his computer will produce lots of noise. If battery, then it might work. Certainly I would agree that use of a better sound card would be advisable. Note that he does not say what measurements he wants to do. If it is just levels then the crappy sound card might do, but even freq response is liable to be dominated by his the response of his sound card. And noise is almost certainly dominated by the sound card. William G. Unruh | Canadian Institute for| Tel: +1(604)822-3273 PhysicsAstronomy | Advanced Research | Fax: +1(604)822-5324 UBC, Vancouver,BC | Program in Cosmology | un...@physics.ubc.ca Canada V6T 1Z1 | and Gravity | www.theory.physics.ubc.ca/ On Mon, 24 Aug 2015, Ralf Mardorf wrote: On Sun, 23 Aug 2015 14:20:46 -0700, Robert M. Riches Jr. wrote: That solution is to just ground one of the balanced wires and use the other as signal. This (an unbalanced wiring) is the only sane solution for this kind of setup. Faked balanced input or real balanced input by using a transformer or what ever kind of cheap circuit won't help. After that it's possible to connect this mono signal to the left and right input, no de-coupling and no conversion is needed, but I anyway wouldn't do it. IMO the OP should record the unbalanced signal by the left or right channel only and split it to two mono signals by software, e.g. by jackd connections, assumed it should be needed. However, one issue still remains. Line input is not optimised for microphone output. Btw. I guess integrated consumer audio provides some kind of microphone input. It might be crappy, but likely better than any kind of connection to crappy line inputs. A cheap microphone pre-amp with line output might help when using mobo integrated audio too. For what purpose ever a measurement microphone might be good for, I doubt that usage with an on-board audio device makes much sense. -- ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user -- ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user