LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-06-2016, 10:45 AM   #1
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Grab linux audio for streaming


I want to stream audio from my desktop (which only has headphones) to my raspberry pi, which is attached to speakers.

The only thing I need is to be able to grab the audio playing from my computer... from the terminal so that I can pipe it. Eg

Code:
cat this_file | nc ip port
I know I can use some other programs (like audacity) to record sound, perhaps is there anything in the cli that can do this and write to stdout?

Using Linuxmint 18. I believe it uses pulseaudio
 
Old 09-06-2016, 11:57 AM   #2
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Original Poster
Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Got a working setup


Desktop:
Code:
arecord -t wav -f cd - | ffmpeg -i - -f opus - | nc ip 9876
Rpi:
Code:
nc -l 9876 | mplayer -vo null -
I'd like to remove the ffmpeg completely but it didn't seem to work unless it used a lossy compression (flac, wav didn't work but opus, ogg, mp3 worked)
I also put the nc -l in a while loop since it makes it easier to reconnect to it.

EDIT:

I have a much better command that uses ssh

Code:
ssh HOST aplay < <(arecord -f cd)

Last edited by Sefyir; 09-13-2016 at 12:16 PM.
 
Old 09-06-2016, 03:05 PM   #3
af7567
Member
 
Registered: Nov 2012
Posts: 291

Rep: Reputation: 104Reputation: 104
Does your raspberry pi have pulseaudio installed too? If so look at the "Direct Connection" section here: https://www.freedesktop.org/wiki/Sof.../User/Network/

On your PC you should be able to set the $PULSE_SERVER environment variable to be the IP address of the pi, and on the pi load the module-native-protocol-tcp module so it accepts network connections. You can either load the module using pacmd or if you have X use paprefs. If you use pacmd you will have pass some options to load-module to specify the allowed IP addresses that can connect. If you use paprefs (which is what I used) then under the network server tab you just need to enable network access and don't require authentication.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Audio Streaming (server) BlackRabbit Linux - Software 9 12-25-2012 01:06 PM
[SOLVED] audio streaming in linux konsgia Linux - Newbie 1 05-19-2011 05:15 PM
how to grab audio amplitude from sound card in Linux for programming Linux app? bapigoo9 Programming 3 08-28-2008 07:15 PM
Audio/Video Streaming in Linux donaeux Linux - Software 2 11-21-2006 10:14 AM
Streaming audio in Linux? Van Gogh Linux - Newbie 8 12-30-2003 11:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration