Jump to content

i have a raspberry pi model B. I would like the setup as following, my pi in my car tucked away somewhere idk. i have an aux cable coming from the pi into my radio in my car, the problem is i dont want a keyboard and mouse and a screen to carry to play music and have to turn it on every time. the solution? have it so when it turns on it automattically plays music. i dont know how to do that which is why i am asking LTT community. open to all suggestions

Link to comment
https://linustechtips.com/topic/619729-pi-audio-system/
Share on other sites

Link to post
Share on other sites

you could solder two pins in the RUN holes (next to the two LEDs I think), connect these two to a push button which will be used to turn on the Pi. For playing music you'll have to write a script which runs at boot

Computer Case: NZXT S340 || CPU: AMD Ryzen 5 1600 || Cooler: CM Hyper212 Evo || MoBo: MSI B350 Mortar || RAM Vengeance LPX 2x8GB 3200MHz || PSU: Corsair CX600 || SSD: HyperX Fury 120GB & 240GB || HDD: WD Blue 1TB + 1TB 2.5'' backup drive || GPU: Sapphire Nitro+ RX 580 4GB

Laptop 1 HP x360 13-u113nl

Laptop Lenovo z50-75 with AMD FX-7500 || OS: Windows 10 / Ubuntu 17.04

DSLR Nikon D5300 w/ 18-105mm lens

Link to comment
https://linustechtips.com/topic/619729-pi-audio-system/#findComment-7998201
Share on other sites

Link to post
Share on other sites

16 minutes ago, Cryosec said:

you could solder two pins in the RUN holes (next to the two LEDs I think), connect these two to a push button which will be used to turn on the Pi. For playing music you'll have to write a script which runs at boot

fair enough turning it on but i was looking for the specific code and possibly a tutorial on how to do it?

Link to comment
https://linustechtips.com/topic/619729-pi-audio-system/#findComment-7998252
Share on other sites

Link to post
Share on other sites

If you carry your phone with you alot you could add a wifi dongle to the pi, broadcast a wifi signal, then use something like ampache, Rune audio, or Mopidy to host a WebUi.

You could also just buy one of those tiny keyboards, that are like palm sized and $15

There is also a number touch screens that set atop the Pi, same size so its not space consuming and most run off less power or power from the gpio.

                     .
                   _/ V\
                  / /  /
                <<    |
                ,/    ]
              ,/      ]
            ,/        |
           /    \  \ /
          /      | | |
    ______|   __/_/| |
   /_______\______}\__}  

Spoiler

[I5-12600k | 32gb DDR5 6000 | RTX5070 | 2x1tb M.2]

 

[Ryzen 5 1600 | 16gb DDR4 3200 | GTX1030 | 4x 8tb HDD] 

 

Link to comment
https://linustechtips.com/topic/619729-pi-audio-system/#findComment-8000489
Share on other sites

Link to post
Share on other sites

On 2/7/2016 at 11:13 AM, xXD4RZOXx said:

fair enough turning it on but i was looking for the specific code and possibly a tutorial on how to do it?

sorry for the late answer, had stuff to do. I can't give you specific code, but if you'd like to learn stuff and try it yourself (it still is your project with the RPi), you could code with Python (always the best choice with a Pi) and the VLC Python module and start with something like this:

 

>>> import vlc
>>> p = vlc.MediaPlayer("file:///path/to/track.mp3")
>>> p.play()
>>> p.stop()

then find your way for creating a code which autoruns at every boot and plays randomly throu a set of mp3s

 

EDIT: I tried this out myself, just for the sake of it. Looks like the vlc.MediaPlayer doesn't include the start() function. So I looked for a workaround and it seems that a simple command will make vlc play all the files in a folder. Just type

 

"cvlc /path/to/folder/"

 

Be sure to put in the folder only the mp3 files you want played, otherwise it will try to show images and videos too. For autoplaying stuff after boot, you can write a shell script and place it in the /etc/init.d/ folder.

 

As said in this thread on Stack Overflow, if you want to execute the file at every startup, you have to set it as an executable with

 

"chmod +x /etc/init.d/name_of_file"

 

if it still won't execute, you must add a symlink to the rc.d folder:

 

"ln -s /etc/init.d/name_of_file /etc/rc.d/"

 

 

sorry if I didn't use code boxes as before, but in edit mode it doesn't seem I can do it

Edited by Cryosec

Computer Case: NZXT S340 || CPU: AMD Ryzen 5 1600 || Cooler: CM Hyper212 Evo || MoBo: MSI B350 Mortar || RAM Vengeance LPX 2x8GB 3200MHz || PSU: Corsair CX600 || SSD: HyperX Fury 120GB & 240GB || HDD: WD Blue 1TB + 1TB 2.5'' backup drive || GPU: Sapphire Nitro+ RX 580 4GB

Laptop 1 HP x360 13-u113nl

Laptop Lenovo z50-75 with AMD FX-7500 || OS: Windows 10 / Ubuntu 17.04

DSLR Nikon D5300 w/ 18-105mm lens

Link to comment
https://linustechtips.com/topic/619729-pi-audio-system/#findComment-8006167
Share on other sites

Link to post
Share on other sites

I'm all for weird Pi uses like this, but is there some reason you can't/don't want to use something like a phone or iPod to play music in your car?  It would be much simpler than the Pi setup.

 

On 7/3/2016 at 5:10 PM, Cryosec said:

 

snip

A few quick additions to this: wherever you point cvlc at, it will play all audio files both in that directory itself and in all of its sub-folders, so you can keep your music on the Pi organized in whatever way you want.  You can also use the option -Z to play randomly from all files in whatever folder you point it at, and -L to turn on the "repeat all" option, which may be things you want.

Link to comment
https://linustechtips.com/topic/619729-pi-audio-system/#findComment-8012754
Share on other sites

Link to post
Share on other sites

12 hours ago, Azgoth 2 said:

I'm all for weird Pi uses like this, but is there some reason you can't/don't want to use something like a phone or iPod to play music in your car?  It would be much simpler than the Pi setup.

 

A few quick additions to this: wherever you point cvlc at, it will play all audio files both in that directory itself and in all of its sub-folders, so you can keep your music on the Pi organized in whatever way you want.  You can also use the option -Z to play randomly from all files in whatever folder you point it at, and -L to turn on the "repeat all" option, which may be things you want.

i chose to do it with the rbpi because i could really, i wanna learn and do different things with it and i though why not

Link to comment
https://linustechtips.com/topic/619729-pi-audio-system/#findComment-8015433
Share on other sites

Link to post
Share on other sites

9 hours ago, xXD4RZOXx said:

i chose to do it with the rbpi because i could really, i wanna learn and do different things with it and i though why not

Okay.  I wasn't sure if the main purpose was to be able to play music in your car (in which case the Pi is super cumbersome) or if you wanted to get some tinkering/DIY experience in, in which case, power to you.

Link to comment
https://linustechtips.com/topic/619729-pi-audio-system/#findComment-8018105
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×