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


Messages In This Thread
Playing mp3 file to specific device - by treii28 - Mar-25-2019, 09:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Extracting specific file from an archive tester_V 4 566 Jan-29-2024, 06:41 PM
Last Post: tester_V
  Input network device connection info from data file edroche3rd 6 1,118 Oct-12-2023, 02:18 AM
Last Post: edroche3rd
  Reading Specific Rows In a CSV File finndude 3 1,019 Dec-13-2022, 03:19 PM
Last Post: finndude
  How to extract specific data from .SRC (note pad file) Shinny_Shin 2 1,299 Jul-27-2022, 12:31 PM
Last Post: Larz60+
  Extracting Specific Lines from text file based on content. jokerfmj 8 3,111 Mar-28-2022, 03:38 PM
Last Post: snippsat
  playing .wav sound file with sounddevice shift838 5 2,440 Mar-11-2022, 07:58 PM
Last Post: menator01
  [Solved] Trying to read specific lines from a file Laplace12 7 3,608 Jun-21-2021, 11:15 AM
Last Post: Laplace12
  Extract specific sentences from text file Bubly 3 3,460 May-31-2021, 06:55 PM
Last Post: Larz60+
  Find specific file in an archive tester_V 8 3,540 Feb-13-2021, 06:13 PM
Last Post: tester_V
  Writing to file in a specific folder evapa8f 5 3,490 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