All of lore.kernel.org
 help / color / mirror / Atom feed
* Record stereo from one input on the soundcard
@ 2019-01-12 13:25 Tomas Nordin
  2019-01-25 20:44 ` Tomas Nordin
  0 siblings, 1 reply; 6+ messages in thread
From: Tomas Nordin @ 2019-01-12 13:25 UTC (permalink / raw)
  To: alsa-devel

Hello List

I sent this question first to the alsa-user list but somebody
recommended somebody to send to this list instead when the user-list
don't get much attention.

I have an external USB soundcard called Audiobox from Presonus,
https://www.presonus.com/products/AudioBox-USB. Somewhere I read that
this is a class compliant USB sound card.

I use this card to record audio from a drum module (e-drums). I take the
audio signal from the head phones out socket on the module, and plug it
into input 1 on the card. The card has 2 inputs, for the moment I don't
use the second input but I consider it busy. For a minimum of hassle I
want to make my recording using arecord (want to use a command line
program).

So the card is a kind of bedroom musician type of card that might have 2
inputs, 4 inputs or 12 or whatever, to record a number of instruments at
the same time. But as I said, this card has two inputs.

The audio signal from the headphones out socket (on the drum module) is
stereo. The card support routing that stereo sound from one input, in so
far that it can be heard in stereo from the cards head phones out.

The following command lets me record audio from the card,

$ arecord -c 2 -d 60 -f S24_3LE -r 48000 -D hw:1,0 s3.wav

The resulting wav file has all hearable audio in the left speaker when
listening.

Do you think it is possible to get that stereo signal from one input on
the card into a stereo sound file. Or somehow else get left and right
audio separately from that input 1 on the card. My guess on what's
happening now is that the stereo signal gets merged as mono into one
channel.

Here are some listings:

$ uname -a
Linux raspberrypi 4.14.79+ #1159 Sun Nov 4 17:28:08 GMT 2018 armv6l GNU/Linux

$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: USB [AudioBox USB], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

$ arecord --dump-hw-params -D hw:1,0 
Recording WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
HW Params of device "hw:1,0":
--------------------
ACCESS:  MMAP_INTERLEAVED RW_INTERLEAVED
FORMAT:  S24_3LE
SUBFORMAT:  STD
SAMPLE_BITS: 24
FRAME_BITS: 48
CHANNELS: 2
RATE: [44100 48000]
PERIOD_TIME: [1000 1981429)
PERIOD_SIZE: [45 87381]
PERIOD_BYTES: [270 524286]
PERIODS: [2 1024]
BUFFER_TIME: [1875 3962858)
BUFFER_SIZE: [90 174762]
BUFFER_BYTES: [540 1048572]
TICK_TIME: ALL
--------------------
arecord: set_params:1299: Sample format non available
Available formats:
- S24_3LE

Any ideas anyone?

Best regards
--
Tomas

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Record stereo from one input on the soundcard
  2019-01-12 13:25 Record stereo from one input on the soundcard Tomas Nordin
@ 2019-01-25 20:44 ` Tomas Nordin
  2019-01-25 21:32   ` Pavel Hofman
  0 siblings, 1 reply; 6+ messages in thread
From: Tomas Nordin @ 2019-01-25 20:44 UTC (permalink / raw)
  To: alsa-devel

Hello List again

Trying a ping on this. Might not be possible to give a good answer on
the post but then maybe somebody can give me some sort of hints or
pointer to some documentation or something.

Best regards
--
Tomas

Tomas Nordin <tomasn@posteo.net> writes:

> Hello List
>
> I sent this question first to the alsa-user list but somebody
> recommended somebody to send to this list instead when the user-list
> don't get much attention.
>
> I have an external USB soundcard called Audiobox from Presonus,
> https://www.presonus.com/products/AudioBox-USB. Somewhere I read that
> this is a class compliant USB sound card.
>
> I use this card to record audio from a drum module (e-drums). I take the
> audio signal from the head phones out socket on the module, and plug it
> into input 1 on the card. The card has 2 inputs, for the moment I don't
> use the second input but I consider it busy. For a minimum of hassle I
> want to make my recording using arecord (want to use a command line
> program).
>
> So the card is a kind of bedroom musician type of card that might have 2
> inputs, 4 inputs or 12 or whatever, to record a number of instruments at
> the same time. But as I said, this card has two inputs.
>
> The audio signal from the headphones out socket (on the drum module) is
> stereo. The card support routing that stereo sound from one input, in so
> far that it can be heard in stereo from the cards head phones out.
>
> The following command lets me record audio from the card,
>
> $ arecord -c 2 -d 60 -f S24_3LE -r 48000 -D hw:1,0 s3.wav
>
> The resulting wav file has all hearable audio in the left speaker when
> listening.
>
> Do you think it is possible to get that stereo signal from one input on
> the card into a stereo sound file. Or somehow else get left and right
> audio separately from that input 1 on the card. My guess on what's
> happening now is that the stereo signal gets merged as mono into one
> channel.
>
> Here are some listings:
>
> $ uname -a
> Linux raspberrypi 4.14.79+ #1159 Sun Nov 4 17:28:08 GMT 2018 armv6l GNU/Linux
>
> $ arecord -l
> **** List of CAPTURE Hardware Devices ****
> card 1: USB [AudioBox USB], device 0: USB Audio [USB Audio]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
>
> $ arecord --dump-hw-params -D hw:1,0 
> Recording WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
> HW Params of device "hw:1,0":
> --------------------
> ACCESS:  MMAP_INTERLEAVED RW_INTERLEAVED
> FORMAT:  S24_3LE
> SUBFORMAT:  STD
> SAMPLE_BITS: 24
> FRAME_BITS: 48
> CHANNELS: 2
> RATE: [44100 48000]
> PERIOD_TIME: [1000 1981429)
> PERIOD_SIZE: [45 87381]
> PERIOD_BYTES: [270 524286]
> PERIODS: [2 1024]
> BUFFER_TIME: [1875 3962858)
> BUFFER_SIZE: [90 174762]
> BUFFER_BYTES: [540 1048572]
> TICK_TIME: ALL
> --------------------
> arecord: set_params:1299: Sample format non available
> Available formats:
> - S24_3LE
>
> Any ideas anyone?
>
> Best regards
> --
> Tomas
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Record stereo from one input on the soundcard
  2019-01-25 20:44 ` Tomas Nordin
@ 2019-01-25 21:32   ` Pavel Hofman
  2019-01-27 18:35     ` Tomas Nordin
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Hofman @ 2019-01-25 21:32 UTC (permalink / raw)
  To: Tomas Nordin, alsa-devel

Hi Tomas,

Dne 25. 01. 19 v 21:44 Tomas Nordin napsal(a):
>>
>> The following command lets me record audio from the card,
>>
>> $ arecord -c 2 -d 60 -f S24_3LE -r 48000 -D hw:1,0 s3.wav
>>
>> The resulting wav file has all hearable audio in the left speaker when
>> listening.

If you really feed stereo signal into your soundcard stereo input jack 
and the card is not somehow configured to merge the input channels, the 
above command does record stereo signal.

Available controls of the card are listed by command

amixer -c 1 contents

Best regards,

Pavel.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Record stereo from one input on the soundcard
  2019-01-25 21:32   ` Pavel Hofman
@ 2019-01-27 18:35     ` Tomas Nordin
  2019-01-28  7:52       ` Ricard Wanderlof
  2019-01-28  8:44       ` Pavel Hofman
  0 siblings, 2 replies; 6+ messages in thread
From: Tomas Nordin @ 2019-01-27 18:35 UTC (permalink / raw)
  To: Pavel Hofman, alsa-devel

Pavel Hofman <pavel.hofman@ivitera.com> writes:

> Hi Tomas,
>
> Dne 25. 01. 19 v 21:44 Tomas Nordin napsal(a):
>>>
>>> The following command lets me record audio from the card,
>>>
>>> $ arecord -c 2 -d 60 -f S24_3LE -r 48000 -D hw:1,0 s3.wav
>>>
>>> The resulting wav file has all hearable audio in the left speaker when
>>> listening.
>
> If you really feed stereo signal into your soundcard stereo input jack 
> and the card is not somehow configured to merge the input channels, the 
> above command does record stereo signal.

Ok, thanks. I have been a bit confused about the relation between the -c
option argument and the number of inputs on a card. If I understand
correctly, the -c option does not say anything about what inputs to
record from, it is saying what kind of audiofile to produce?

> Available controls of the card are listed by command
>
> amixer -c 1 contents

Here is the output of that:

$ amixer -c 1 contents
numid=2,iface=PCM,name='Capture Channel Map'
  ; type=INTEGER,access=r----R--,values=2,min=0,max=36,step=0
  : values=0,0
  | container
    | chmap-fixed=FL,FR

numid=1,iface=PCM,name='Playback Channel Map'
  ; type=INTEGER,access=r----R--,values=2,min=0,max=36,step=0
  : values=0,0
  | container
    | chmap-fixed=FL,FR

And I didn't mention that in my original post but, alsamixer has been
informing me that "This soundcard does not have any controls." when I
select the AudioBox via F6.

Is this giving any more hints on what I can do?

Best regards
--
Tomas

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Record stereo from one input on the soundcard
  2019-01-27 18:35     ` Tomas Nordin
@ 2019-01-28  7:52       ` Ricard Wanderlof
  2019-01-28  8:44       ` Pavel Hofman
  1 sibling, 0 replies; 6+ messages in thread
From: Ricard Wanderlof @ 2019-01-28  7:52 UTC (permalink / raw)
  To: Tomas Nordin; +Cc: Pavel Hofman, alsa-devel


On Sun, 27 Jan 2019, Tomas Nordin wrote:

> Ok, thanks. I have been a bit confused about the relation between the -c
> option argument and the number of inputs on a card. If I understand
> correctly, the -c option does not say anything about what inputs to
> record from, it is saying what kind of audiofile to produce?

-c 2 means "take two channels from the card and produce two channels of 
output". It does not at all address how those two channels are formed in 
the card. Usually sound cards have an internal mixer, so that input 1 
could be feeding channels 1 and 2 for instance. However, in my (limited) 
experience, the audio routed to USB is often more or less directly mapped 
to the physical inputs, with any internal mixer in the sound card 
providing monitoring functionality (the headphone output primarily).

Looking quickly at a picture of the sound card, it looks as if the two 
inputs are mono inputs, balanced when XLR connectors are used, potentially 
unbalanced when 1/4" connectors are used.

I would think that inputs 1 and 2 are sent as the left and right channels 
over USB, and that's what you get when you use arecord -c 2.

Connecting the headphone output of your drum module to input 1 will thus 
result in a mono recording on channel 1.

My guess is that the internal mixer of the sound card is set up to 
distribute both input channels to both left and right headphone outputs, 
thus you can hear sound in both the left and right channels of the 
headphone output, even when using only one of the inputs.

Most soundcards have a Windows and/or Mac application which can control 
the internal mixer; sadly, most often they use a proprietary interface and 
thus do not show up as ALSA controls. Sometimes the mixer application can 
be run under Wine; more often in a virtual Windows environment such as 
VirtualBox.

If you do want to record both channels, you would need to have a cable 
that has a stereo connector on one end, for connecting to your drum 
module, and two mono 1/4" connectors at the other end, providing inputs 1 
and 2 with the left and right channels.

What is the drum module? Does it not have ordinary outputs as well as the 
headphone output?

/Ricard
-- 
Ricard Wolf Wanderlof                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Record stereo from one input on the soundcard
  2019-01-27 18:35     ` Tomas Nordin
  2019-01-28  7:52       ` Ricard Wanderlof
@ 2019-01-28  8:44       ` Pavel Hofman
  1 sibling, 0 replies; 6+ messages in thread
From: Pavel Hofman @ 2019-01-28  8:44 UTC (permalink / raw)
  To: Tomas Nordin, alsa-devel

Dne 27. 01. 19 v 19:35 Tomas Nordin napsal(a):
> Here is the output of that:
> 
> $ amixer -c 1 contents
> numid=2,iface=PCM,name='Capture Channel Map'
>    ; type=INTEGER,access=r----R--,values=2,min=0,max=36,step=0
>    : values=0,0
>    | container
>      | chmap-fixed=FL,FR
> 
> numid=1,iface=PCM,name='Playback Channel Map'
>    ; type=INTEGER,access=r----R--,values=2,min=0,max=36,step=0
>    : values=0,0
>    | container
>      | chmap-fixed=FL,FR
> 
> And I didn't mention that in my original post but, alsamixer has been
> informing me that "This soundcard does not have any controls." when I
> select the AudioBox via F6.

That usb audio device seems to offer no feature controls:

https://forums.freebsd.org/threads/presonus-audiobox-usb-not-recognized.61395/#post-353537

Alsamixer lists only controls of type MIXER, while amixer lists all - 
incl. those of type PCM added by alsa-lib for your soundcard.

https://android.googlesource.com/kernel/common/+/android-trusty-3.10/Documentation/sound/alsa/Channel-Mapping-API.txt

Regards,

Pavel.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-01-28  8:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-12 13:25 Record stereo from one input on the soundcard Tomas Nordin
2019-01-25 20:44 ` Tomas Nordin
2019-01-25 21:32   ` Pavel Hofman
2019-01-27 18:35     ` Tomas Nordin
2019-01-28  7:52       ` Ricard Wanderlof
2019-01-28  8:44       ` Pavel Hofman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.