element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum MP3 Playback on PI Pico
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 12 replies
  • Subscribers 664 subscribers
  • Views 10216 views
  • Users 0 members are here
  • pico
  • mp3
Related

MP3 Playback on PI Pico

scottiebabe
scottiebabe over 4 years ago

Soft 404

  • Sign in to reply
  • Cancel
  • neuromodulator
    neuromodulator over 4 years ago

    Cool project, I've played a bit with that using FPGAs. I've never tried with MCUs, but FPGAs give you very tight timing control. I wonder if you can broadcast the audio signal.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • DAB
    DAB over 4 years ago

    Nice project.

     

    The sinewave file scared my dog.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • bobross427
    bobross427 over 3 years ago

    Hey I'm new to this and can follow the wiring diagrams just fine, copy and paste just fine.

     

    I have tried a couple of the code examples for mp3 playback that seem to work good, with the intent to make a noise or rain machine, but cant get the files to play in a loop.

     

    ------- original example -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    """

    CircuitPython multiple MP3 playback example for Raspberry Pi Pico.

    Plays two MP3 files consecutively, once time each.

    """

    import board

    import audiomp3

    import audiopwmio

     

     

    audio = audiopwmio.PWMAudioOut(board.GP0)

     

     

    mp3files = ["rain1.mp3", "rain2.mp3"]

     

     

    mp3 = open(mp3files[0], "rb")

    decoder = audiomp3.MP3Decoder(mp3)

     

     

    for filename in mp3files:

        decoder.file = open(filename, "rb")

        audio.play(decoder)

        print("Playing:", filename)

        while audio.playing:

            pass

     

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

     

    Thanks if you have a working idea.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • scottiebabe
    scottiebabe over 3 years ago in reply to bobross427

    .

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • robogary
    robogary over 3 years ago

    Saweet. Did you need to load the MP3 files also to the Pico ?

     

    Will you add a LM386 to drive a 8 ohm - ish speaker ? 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • scottiebabe
    scottiebabe over 3 years ago in reply to robogary

    .

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • bobross427
    bobross427 over 3 years ago in reply to scottiebabe

    Thanks that worked after about half hour, when I realized the T in true needed to be True, per your example.

     

    Thanks again.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • robogary
    robogary over 3 years ago in reply to scottiebabe

    Thanks for the good explanation. I learned alot and have alot to learn.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • robogary
    robogary over 3 years ago in reply to scottiebabe

    Alot of times I'll just get 5W or 15W class D amp boards  https://www.amazon.com/Ximimark-1-8-12V-TDA2822M-Amplifier-Channel/dp/B07KC1CZWY/ref=sr_1_4?dchild=1&keywords=12v+amplif…

    I cant build them nearly as cheap as buying them.

    I have built LM386 boards and 5V relay cards, once, then found just the parts cost 2-3X as much as buying a prebuilt surface mount one.   

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • jc2048
    jc2048 over 3 years ago in reply to scottiebabe

    Won't you need to close the files when they're no longer being used, or does Python handle that kind of thing for you?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube