I'm looking for a better way to play audio, but for now will proceed with pygame.mixer.
I have a post which may bring some alternatives.
here's the simple test:
I have a post which may bring some alternatives.
here's the simple test:
import BiblePaths from pygame import mixer import json import os class PlayAudio: def __init__(self): self.bpath = BiblePaths.BiblePaths() with self.bpath.IndexedBible.open() as f: self.bible = json.load(f) def play_chapter(self, volume, book, chapter): mp3loc = self.bible[volume][book][chapter]['mp3path'] # found a bug, this is a hack until I fix the create program mp3loc[1] = str(mp3loc[1]).replace(' ', '_') mp3path = self.bpath.KingJamesAudiopath / mp3loc[0] / mp3loc[1] newpath = (mp3path.resolve()).as_posix() mixer.init() mixer.music.load(newpath) results = mixer.music.play() print('Press enter to quit') input() def testit(): pa = PlayAudio() pa.play_chapter('Old Testament', 'Jeremiah', '45') if __name__ == '__main__': testit()