I kept searching the web and this forum for hours now, but found no satisfactory answer to this "problem".
In Python 3 I would like to call a function like
Code: Select all
someObject.playSine( frequency, duration)Code: Select all
someObject.playRect(frequency,duration)The reason why I want to have this, is that frequency and duration are calculated during run-time of my program and if I need to prepare an array first with all the waveform data, it often takes too long. There should be very little latency from calling the command until the tone is played.
Maybe I could use a GPIO and a timer and connect a piezo speaker, but I also want to play other audio via the audio jack. The I would have two speakers which seems a bit of an overkill to me.
On Windows there's the winsound module, which provides just that functionality, but I found nothing similar that would work on my Pi running Raspbian.
Thanks a lot for any help!
Regards, Gerhard