Playing audio files repeatedly using minim.
in
Core Library Questions
•
11 months ago
Hi,
I've written some code that interfaces to an Arduino board which is monitoring two metal objects for touch.
When one of the objects is touched the processing program plays one sound and when the other is touched it plays a different sound.
The sounds are stored as mp3 files and played using minim.
The sounds are played every time an object is touched.
To do this I was originally using,
noise = minim.loadfile("note.mp3");
noise.play();
The sound played fine and it felt like an instant response but it led to memory problems as the audio file was being loaded repeatedly. So I changed the code and used the .rewind() function/class instead of reloading the file. This cured the memory problems but introduced a noticeable delay.
Can anyone recommend a way to do this that won't lead to memory problems or introduce a delay?
Regards and thanks,
Dave.
1