Python Forum
Playing mp3 file to specific device
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Playing mp3 file to specific device
#1
I'm new to python but want to try converting an ESP32 project to work on a Raspberry pi and most suggestions say python is the way to go for IoT development on a Pi.

One of the things my project deals with is playing sound effects based on various triggers and events. I would prefer to store the files in mp3 format as they are smaller and the tags allow me to include details on what the files contain. (I'm pulling them -- with the author's permission -- out of an audiobook. so I try to keep track of what page/chapter they come from, who the speaker is, what the basic context is, etc)

The problem is that on a Pi, I ended up getting an external board for the DAC playback which means it isn't necessarily going to be the default system playback device. Also, since this is being built on a Pi Zero, I have the option to use bluetooth connections. I would like to be able to select which device is going to be the target for the playback of the sounds. (possibly even the default HDMI audio output as a potential option)

I will likely use some kind of a web interface in addition to scripts that will be running at boot-up to handle the various behaviors and settings. So it would read device information (current chosen playback device) from some kind of a data file (probably json data or an .ini format)

I can find examples on playback using any number of libraries or system calls. I can find examples of device selection using sounddevice. But I can't seem to find any mp3 specific playback examples that target a specific alsa device. (the dac board is seeedstudio voicecard which uses an alsa driver and shows up as device 2)

Thanks in advance for any assistance.
Reply
#2
try looking here: https://pypi.org/
Reply
#3
Thanks, I've been looking for a link like that. I have been wondering if there was anything equivalent to Arduino Playground for Pi/Python
Reply
#4
Pypi.org can be searched like google.
You can search yourself as there are 173,453 projects.
Ok to ask as well, because some moderators may have used some of the packages, but look first.
Search for 'Arduino Playground' brings up: https://pypi.org/search/?q=Arduino+Playground

One thing to look at is last date updated.
If this date is really old, that means the code is out of date, and probably was abandoned.
Anyone can post a package to PyPi, so sometimes are abandoned/ Nevertheless, There are some excellent packages available.
You can choose 'Trending' in order by pull-down. To see what's being downloaded the most.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Extracting specific file from an archive tester_V 4 423 Jan-29-2024, 06:41 PM
Last Post: tester_V
  Input network device connection info from data file edroche3rd 6 912 Oct-12-2023, 02:18 AM
Last Post: edroche3rd
  Reading Specific Rows In a CSV File finndude 3 936 Dec-13-2022, 03:19 PM
Last Post: finndude
  How to extract specific data from .SRC (note pad file) Shinny_Shin 2 1,224 Jul-27-2022, 12:31 PM
Last Post: Larz60+
  Extracting Specific Lines from text file based on content. jokerfmj 8 2,856 Mar-28-2022, 03:38 PM
Last Post: snippsat
  playing .wav sound file with sounddevice shift838 5 2,318 Mar-11-2022, 07:58 PM
Last Post: menator01
  [Solved] Trying to read specific lines from a file Laplace12 7 3,473 Jun-21-2021, 11:15 AM
Last Post: Laplace12
  Extract specific sentences from text file Bubly 3 3,338 May-31-2021, 06:55 PM
Last Post: Larz60+
  Find specific file in an archive tester_V 8 3,400 Feb-13-2021, 06:13 PM
Last Post: tester_V
  Writing to file in a specific folder evapa8f 5 3,333 Nov-13-2020, 10:10 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020