sox bike.ogg -n spectrogram -o bike-spectrogramm.png
The idea is to get an audio stream which can be used for diffrent things e.g. streaming or saving as file. ALSA have a file plugin but the following way is nicer.
At first, load the driver as root:
modprobe snd-aloop
Now your soundcard list have a new entry. Based on a host with one soundcard numbered as 0 the loopdevice is 1.
Create a file called .asoundrc
in your home directory:
pcm.!default { type plug slave { pcm { type asym playback.pcm "hw:Loopback,0,0" capture.pcm "hw:Loopback,1,0" } } }
You can found the output of hw:Loopback,0,0
as output on hw:Loopback,1,0
as input.
You default device is the loopback device because the line pcm.!default
.
Not all programs works fine, but this works fine with an one second delay and a lot of traffic.
ssh user@remote_host "rec -t ogg -p" | play -p
At this time, the sound output of a program tunnels through your local host.
The tool ssh
connects the remote_host
and starts he tool rec -t ogg -p
.
The rec
tool records all sound from the default device which is now the loopback device.
The remote sound is put into the ssh tunnel and piped to local play.