Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NOT AN ISSUE, QUESTION] How to transmit the audio of the raspberry (not a file, not a microphone) #144

Closed
ghost opened this issue Jul 28, 2021 · 5 comments

Comments

@ghost
Copy link

ghost commented Jul 28, 2021

Hi so I'm using a music bot that plays songs from youtube into the raspberry, so if I plug headphones to it I can listen songs. Is there any way I can transmit the audio played in the raspberry to fm? I could't find any parameters to do that.

@hydranix
Copy link

hydranix commented Aug 4, 2021

Here's what I do.

First I load the alsa loopback module.

modprobe snd-aloop

This creates a loopback audio device.

Then I use the arecord program. (part of alsa-utils package if you use ArchLinux)

I pipe the output of arecord to fm_transmitter like this:

arecord -D hw:0,1,0 -c 1 -d 0 -r 44100 -f S16_LE|fm_transmitter -f 102.5 -

Now just play your audio through the loopback device. Be sure to use subchannel 0

aplay -D hw:0,0,0 -c 1 -r 44100 -f S16_LE /path/to/audio.file

Or you use arecord your microphone and pipe it into aplay to loopback device. You can also do some more interesting things like mix your mic into the playing audio file. Kind of like a live DJ...

@markondej
Copy link
Owner

I've added these informations in readme file

@fuadxtps23
Copy link

fuadxtps23 commented Jun 22, 2023

Here's what I do.

First I load the alsa loopback module.

modprobe snd-aloop

This creates a loopback audio device.

Then I use the arecord program. (part of alsa-utils package if you use ArchLinux)

I pipe the output of arecord to fm_transmitter like this:

arecord -D hw:0,1,0 -c 1 -d 0 -r 44100 -f S16_LE|fm_transmitter -f 102.5 -

Now just play your audio through the loopback device. Be sure to use subchannel 0

aplay -D hw:0,0,0 -c 1 -r 44100 -f S16_LE /path/to/audio.file

Or you use arecord your microphone and pipe it into aplay to loopback device. You can also do some more interesting things like mix your mic into the playing audio file. Kind of like a live DJ...

not working for me, but working for me is this command
arecord -c 2 -f S16_LE -r 44100 | sudo ./fm_transmitter -f 100.6 -d 255 -

@alheyne
Copy link

alheyne commented Nov 15, 2023

So if I wanted to play a movie file(for projection mapping to my house) how might I re-direct the audio out from vlc media player to fm_transmitter? Any help would be greatly appreciated. thanks in advance.

@hydranix
Copy link

hydranix commented Nov 23, 2023

So if I wanted to play a movie file(for projection mapping to my house) how might I re-direct the audio out from vlc media player to fm_transmitter? Any help would be greatly appreciated. thanks in advance.

It's pretty simple. Scroll up to my comment about using an alsa loopback device.

Then just point VLC's audio output to the loopback device and thats it.

vlc --alsa-audio-device hw:0,0,0 --alsa-audio-channels 2 <rest of your vlc commandline>

I haven't tested the above command, but that should give you enough info to get it going.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants