Can't figure out the RCA plug inputs.

Moderator: flatmax

Post Reply
Posts: 6
Joined: Sat May 19, 2018 10:24 am

Can't figure out the RCA plug inputs.

Post by dietslurm » Sun May 20, 2018 11:11 am

Ah, yes, I always forget:
stereo soundcard, Pi recently installed from image file and up to date.

This works.

Code: Select all

aplay /VOLUMES/gizmonics/ainjector/piano2.wav
That is, I can play that file, and hear it.

I have a C program which will capture from the onboard mic.
In the interest of space I will not post the whole thing.
Even in this snippet I removed surplus error reporting -- but
I'm not getting any errors reported anyway.

Code: Select all

char thedevs[6][80] = 
//	the microphone.
strcpy(capdev, thedevs[0] );

//	both handles are initialized this way.
//   this subroutine is called on each handle.  so the handles are
//   set up identically.  I swiped this from some unsigned code online.
//   the huge latency value turns out to be handy -- a sharp rap on the
//   deck gets played out enough later that there's no confusion about
//   what i heard.
if ((err = snd_pcm_set_params(handle,
			500000)) < 0)
	{   /* 0.5sec */

# define IILIMIT 2000
for (ii = 0; ii < IILIMIT; ++ii)
	if ((err = snd_pcm_readi(capture_handle, can, cansize)) != cansize)
	if ((err = snd_pcm_writei(playback_handle, can, cansize)) != cansize)

Assuming (probably incorrectly) that the rest of my code isn't the problem,
what I want to know in the short term is why I can only get input from the
onboard microphone. I've tried all of the "thedevs" values and none work.
Some have errors -- not shown, but the ones that work are always the microphone.
I want to capture from the RCA input jacks.

FWIW, the microphone is doing what it should -- that is, if I say hello to it, I hear
hello on the speakers. (It's faint, but I can fix that another way.) So the "can"
isn't being garbled. In fact, once I get this to read from the RCA plugs I'm
just a small bit of programming away from completing the project.

I can't figure out how to use "aplay -l" output. I made my "thedevs" list from "aplay -L".
(arecord -L and aplay -L return the same list. arecord -l and aplay -l are likewise the same.)
Is that wrong? Frankly, when I didn't get /dev entries with the card I was thrown
for a loop--that's what I expected. I don't know what I'm doing. I probably need
a good tutorial page. ... p_c_m.html
is the real reference, I guess, but I'm not able to put the pieces together.

Code: Select all

[root@labrat alsa]# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: audioinjectorpi [audioinjector-pi-soundcard], device 0: AudioInjector audio wm8731-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
Thanks for whatever you can tell me.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests