0

I'm working on a translator from text to Nato alphabet. I'm using tkinter to make a basic interface. I have a wav file for every letter of the Nato alphabet. I want it to play the file, but I can't find a good way to. I have a mac, so winsound doesn't work. Does anyone know a reasonably simple method to play those files?

2

1 Answer 1

2

I would use PyGame on Mac, because of its portability.

If you really want to use mp3 try this code:

import pygame

pygame.mixer.pre_init(44100, -16, 2, 2048) # setup mixer to avoid sound lag
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load('your_mp3_file.mp3')
pygame.mixer.music.play(-1)

But, if I were you, I would prefer this simpler approach on a Mac:

from os import system
system('say Hello world!')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.