Raspberry Pi Automatic Music Player (using a Read-Only System)

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ต.ค. 2019
  • Raspberry Pi: amzn.to/2PmPzYL (Amazon Affiliate)
    Raspberry Pi Initial Setup: • Raspberry Pi Raspbian ...
    Free Music Here: freemusicarchive.org/genre/Ha...
    Looping music original source: www.cenolan.com/2013/03/loopin...
    musicplayer.sh code: www.rickmakes.com/raspberry-p...
    Creating a Read-only System: learn.adafruit.com/read-only-...
    Please follow me!
    / rickmakes
    / rickmakes
    Visit my Amazon Storefront!
    www.amazon.com/shop/rickmakes
    www.amazon.co.uk/shop/rickmakes
    www.amazon.ca/shop/rickmakes
    Support my channel!
    www.rickmakes.com/paypal_dona...
    #raspberrypi
  • แนวปฏิบัติและการใช้ชีวิต

ความคิดเห็น • 32

  • @Gregtries
    @Gregtries 9 หลายเดือนก่อน

    Came here looking for halloween music ideas and boom you mentioned it!

  • @novellahub
    @novellahub 4 ปีที่แล้ว

    Thanks for the video! I was able to set up a headless Raspberry Pi 1 B+ using this method. I put it on my front porch to play Halloween music. Worked great!

    • @Rickmakes
      @Rickmakes  4 ปีที่แล้ว

      Cool. Great to hear!

    • @markliles4113
      @markliles4113 2 ปีที่แล้ว

      Thats exactly is what I want to do? did you do a tutorial?

  • @grxl10
    @grxl10 ปีที่แล้ว +1

    Thanks for the video Rick! Helped me set up exactly what I needed.
    For anyone doing this in 2023, here's a few notes I made along the way in case they help you. I'm using an OG Raspberry Pi Model B:
    - Use Raspberry Pi OS Lite (Legacy), based on Debian v10. It includes omxplayer. Debian 11 versions don't have it.
    - If your username is something other than 'pi', look out for path names you'll need to change like /home/pi/music
    - I couldn't get the loop script to work, but only needed it to play one file, so replaced the loop with a single omxplayer command
    - You can adjust omxplayer volume with the --vol argument
    - If the new raspi-config option doesn't work to make your system read only, the Adafruit script is here (you'll need edit out the warning) raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/read-only-fs.sh
    - Pairing this with a smart plug makes it easy to switch on/off!

  • @anthonydhaene
    @anthonydhaene 3 ปีที่แล้ว +2

    thanx man it work like a charme on my raspi!!! i think it'll be very hard but do you think that it's possible to make it randomise the tracks being played?

  • @BlackJar72
    @BlackJar72 2 ปีที่แล้ว +1

    Create a slightly more advanced program that loads the the song references into an array that can be repeatedly shuffled, maybe add a convenient on/off switch if you want to get fancy, and you'd have a great everyday music box -- and with a core feature I've not found a pre-made boomboxes and stereos. Of course, you'd need a writable file system to be attached where you can cache the sort order and random seed so the shuffle doesn't reset (and perhaps the music to facilitate adding new songs if you wanted).

  • @MesserAaron13
    @MesserAaron13 2 ปีที่แล้ว +1

    Is there a way to make is stop after reading only one MP3 file? I’m looking to make a module with a directory of MP3 files, have it select one randomly, play it once, then end until powered off and on again

  • @yekaesh
    @yekaesh 3 ปีที่แล้ว

    How can I set this up so that it automatically plays music on any flash drive that I plug in?

  • @georgefaulk2528
    @georgefaulk2528 4 ปีที่แล้ว

    Is it possible to setup Bluetooth and use a Bluetooth speaker? nice vid...

  • @petewright2283
    @petewright2283 3 ปีที่แล้ว +1

    Very cool. So is there a way to set a timer for turning the what’s played on and off. Say every 5 mins it plays the track? The rest of the setup the same?

    • @Rickmakes
      @Rickmakes  3 ปีที่แล้ว +1

      You could add a "sleep 300;" after the omxplayer line (300 equates to seconds). This should cause it to pause for 5 minutes between songs. I would first use a lower amount when testing and then change it to the actual time you want when you know it works.

    • @petewright2283
      @petewright2283 3 ปีที่แล้ว

      @@Rickmakes Hi Rick I’ve gotten it all working as per video. Hang over didn’t help. So where exactly and what exactly would add with a command to say wait then play again. Thank you.

  • @ghulsem
    @ghulsem 10 หลายเดือนก่อน

    omxplayer has been depreciated. Can you update using vlc instead?

  • @jakobmosburger2737
    @jakobmosburger2737 ปีที่แล้ว

    great video. Thanks
    problem: I install the omxplayer with your commmand apt-get......
    If I would like to start the OMX player on the RPI3 it was not installed. Do you have any ideas for this problem?

    • @Rickmakes
      @Rickmakes  ปีที่แล้ว +1

      I think the newest versions of Raspberry Pi OS might not come with omxplayer. I think they use VLC now. I should probably investigate this further and make some videos. In the mean time, if you are just trying to build this system, you can install an older version of Raspberry Pi OS (or Raspbian). I made this video in October of 2019 so the version that was out at that time should work. Alternatively, you can figure out how to do it with a different player.

    • @jakobmosburger2737
      @jakobmosburger2737 ปีที่แล้ว

      @@Rickmakes Thanks for the answer. I will try an older operating system.
      Meanwhile I tried IT with the RPI4 and it works perfect.
      Thanks again

  • @lowerstonetv1257
    @lowerstonetv1257 2 ปีที่แล้ว

    How can I make it play specific songs when the weather changes

    • @Rickmakes
      @Rickmakes  2 ปีที่แล้ว

      Not sure on that one. You would need to write some software that accesses some online weather service (or local weather sensors). Then plays music depending on the data. I'm guessing Python would be good for this but I'm not proficient in that language.

  • @TheParawakening
    @TheParawakening 3 ปีที่แล้ว +1

    Is there a way to shuffle the tracks?

    • @UnexpectedDanger
      @UnexpectedDanger 2 ปีที่แล้ว

      This

    • @UnexpectedDanger
      @UnexpectedDanger 2 ปีที่แล้ว

      I ended up using this code to play random songs from within a folder, this is python code so you'll need to do the command
      sudo nano [name].py
      ....(I think) to make the python script file, then copy and paste the code below but choose your own folder for the /home/pi/p3 or wherever your music is. You'll also want to change "omxplayer" to whatever music program you're using, I chose mpg123.
      #!/usr/bin/env python
      import os, random
      def rndmp3 ():
      randomfile = random.choice(os.listdir("/home/pi/mp3"))
      file = ' /home/pi/mp3/'+ randomfile
      os.system ('omxplayer' + file)
      rndmp3 ()
      while True:
      rndmp3 ()

  • @UnexpectedDanger
    @UnexpectedDanger 2 ปีที่แล้ว

    If I wanted to hook this up in my bathroom so it plays music when I hit the light switch, would it work?

    • @Rickmakes
      @Rickmakes  2 ปีที่แล้ว +1

      Yes, assuming you have an outlet that is powered by the light switch.

    • @UnexpectedDanger
      @UnexpectedDanger 2 ปีที่แล้ว

      @@Rickmakes Thanks again for the tutorial. Took me a month but I've completed the project, more or less. Teaching myself coding wasn't ideal or fun due to how few resources exist online, and while I didn't use your method for the music part, the inspiration and the read-only section helped tremendously.

    • @Super-gf7vx
      @Super-gf7vx 2 ปีที่แล้ว

      @@UnexpectedDanger how did you do it?

  • @jaapbaarends
    @jaapbaarends 4 ปีที่แล้ว

    Do you think it'll run on a raspberry pi 1 A+, 512 MB?

    • @Rickmakes
      @Rickmakes  4 ปีที่แล้ว

      I think this will work just fine with the A+. Playing music doesn't take a whole lot of processing power.

  • @sivakumaranbalasubramaniam3442
    @sivakumaranbalasubramaniam3442 6 หลายเดือนก่อน

    omxplayer not available , please let me know how to install

    • @Rickmakes
      @Rickmakes  6 หลายเดือนก่อน

      I would look for an older version of Raspberry Pi OS. I think "Buster" would work. You wouldn't be missing anything with the new versions when building something like this.

    • @sivakumaranbalasubramaniam3442
      @sivakumaranbalasubramaniam3442 6 หลายเดือนก่อน +1

      Thanks

  • @brendoderf4748
    @brendoderf4748 5 หลายเดือนก่อน

    I AM USING THIS TO MAKE A PORTAL RADIO