[Solved] No audio input going to output

Uhm, good call. No idea … what should I? Thought this works out of the box to be honest … :nerd_face:

The red LED is the clip LED - ideally the gain should be set to a position where the loudest part of the recording does not light it up.

As for recording - the OS receives the input stream, you as the user are responsible to route it as needed via various software tools available, whether it’s playing it back through the output, storing to a file, or both.

So in order to help you, you have to decide what you want to achieve with the input stream. :slight_smile:

1 Like

Oh, the signal was already hot? I set the volume to bare minimum … anyways.

Tried to google and look here on the forum for a solution and it seems the solution is so obvious nobody needs to mention how to or it is a well kept secret. I tend to think it‘s the well kept secret :man_shrugging:

Do you want to route the signal from the input directly to the output?

Yes! Also would love to record it on the way.

There’s multiple ways to achieve the same:

Use a command like:

arecord -D hw:pisound -c 2 -r 48000 -f S16_LE | tee recording.wav | aplay -D hw:pisound -

or use Audacity for graphical user interface (latest version(s) are known to have an issue when recording and playing back at the same time: Audacity and New Mono Track Recording with Monitoring?)

or use MODEP image, connect the left and the right sockets directly, ssh to it and use sudo jack_capture to record to file.

or use some alternative audio recording software on Linux.

1 Like

Uhm… so in the first place I‘d like to hear the sound.

So when I understood correctly that is achieved by the aplay command. So when I want to hear something I put that command best to the pisound button? This is not working for me unfortunately … also it breaks everything else and I can‘t even ctrl+c out of it…

Of course I want to hear sound also when not recording …and start recording whenever there is something I want to record - so maybe put the other command to another button command?

My setup is headless and I have no intention to change this.

Ok, now that you start to define the problem you want to solve, we can get closer to finding the right solution for it. :slight_smile:

The most seamless way then would be to have a JACK server running in the background all the time, forwarding data from input to the output, and a script for the button launching and stopping the sudo jack_capture to capture the stream to a new file each time it is activated.

This is because the button scripts are executed by pisound-btn which is running as a background process. Ctrl+C only affects programs launched by you in the current terminal session. The button scripts themselves should launch software to be run in background, so the execution control is returned to the pisound-btn process. This is usually achieved by having a ‘&’ symbol at the end of very last command in the button script.

1 Like

I haven‘t implemented the button - just used aplay command over ssh.

Volumio „OS“ is running and aplay also broke output of volumio / Spotify / airplay which I‘d like to keep at all times.

edit: Okay … aplay now stopped and Spotify works again - I could live with that happening if it comes back on its own.

I guess when using jackd this is also a problem for me I’d need to take into account.

Thanks for helping me! Really appreciated

Then you have to find a way to pipe through the input of Pisound to the output in a way that is friendly to all the software you want to keep running. I don’t know about the audio backends that are used by the listed software…

A virtual audio loopback device (https://www.alsa-project.org/main/index.php/Matrix:Module-aloop) might be useful to get all of this working together.

Sorry but this solution seems a bit too intense for me right now.

Your aplay command is not working because it needs to have a file, right? It‘s not routing anything.

Would be nice to route the audio in to the audio out for a starter… as I said I would be fine with not being able to use streaming music with airplay/spotify for the time I want to listen to the audio input jack.

aplay and arecord commands take exclusive control of the hardware, so stop any background applications which are working with sound before running them.

To record to a file and play it back at the same time, run:

arecord -D hw:pisound -c 2 -r 48000 -f S16_LE | tee recording.wav | aplay -D hw:pisound -

To just play whatever is coming in on the input, run:

arecord -D hw:pisound -c 2 -r 48000 -f S16_LE | aplay -D hw:pisound -

Ah, okay! Works - thanks! - but unfortunately it adds a loooot of latency - I play live music so this is unacceptable.

So I guess I need to take the jackd route now…

JACK is the route for low latency audio. I’d recommend using MODEP image for this then.

But jack audio is already installed …I feel like I am one command away from getting this to work. This adds too much latency for my workflow (switching SD cards, booting … etc.) - I will end up not using this.

To start jack, run in one session:

JACK_NO_AUDIO_RESERVATION=1 /usr/bin/jackd -v -t 2000 -P 75 -d alsa -d hw:pisound -r 48000 -p 128 -n 2 -X seq -s -S

In another terminal session, run:

jack_connect system:capture_1 system:playback_1
jack_connect system:capture_2 system:playback_2
jackdmp 1.9.10
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2014 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 75
self-connect-mode is "Don't restrict self connect requests"
Jack: JackPosixThread::StartImp : create non RT thread
Jack: JackPosixThread::ThreadHandler : start
Jack: playback device hw:pisound
Jack: capture device hw:pisound
Jack: apparent rate = 48000
Jack: frames per period = 128
Jack: JackDriver::Open capture_driver_name = hw:pisound
Jack: JackDriver::Open playback_driver_name = hw:pisound
Jack: Check protocol client = 8 server = 8
Jack: JackEngine::ClientInternalOpen: name = system
Jack: JackEngine::AllocateRefNum ref = 0
Jack: JackPosixSemaphore::Allocate name = jack_sem.1001_default_system val = 0
Jack: JackEngine::NotifyAddClient: name = system
Jack: JackGraphManager::SetBufferSize size = 128
Jack: JackConnectionManager::DirectConnect first: ref1 = 0 ref2 = 0
Jack: JackGraphManager::ConnectRefNum cur_index = 0 ref1 = 0 ref2 = 0
Jack: JackDriver::SetupDriverSync driver sem in flush mode
Failed to connect to session bus for device reservation Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

Audio device hw:pisound cannot be acquired...
Jack: ~JackDriver
Cannot initialize driver
Jack: no message buffer overruns
Jack: JackPosixThread::Stop
Jack: JackPosixThread::ThreadHandler : exit
JackServer::Open failed with -1
Jack: Succeeded in unlocking 82278944 byte memory area
Jack: JackShmMem::delete size = 0 index = 0
Jack: ~JackDriver
Jack: Succeeded in unlocking 1232 byte memory area
Jack: JackShmMem::delete size = 0 index = 1
Jack: Cleaning up shared memory
Jack: Cleaning up files
Jack: Unregistering server `default'
Failed to open server

Hmm… something with X11 is the problem? Or is that something I can ignore?

Sorry for that, updated the command:

JACK_NO_AUDIO_RESERVATION=1 /usr/bin/jackd -v -t 2000 -P 75 -d alsa -d hw:pisound -r 48000 -p 128 -n 2 -X seq -s -S

nothing changed …hmm

1 Like

This may mean that the device is already in use by other audio software.

The X display error should be worked around by ‘JACK_NO_AUDIO_RESERVATION=1’