We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Basically, I have an imported string where the code reads the individual letters of text. When a specific letter appears, it acts as a variable to trigger an action
if string = = 'a' {
fill(#00000);
}
or something to that effect.
I'm trying to make specific letters trigger imported mp3 files. But when I use the minim library's function player.play("note.mp3"); I get an error "the method of play(int) is the type AudioPlayer is not applicable for the arguments (String)"
Can anyone help?
Answers
First, to compare strings you should use: StringOne.equals(StringTwo)
Second, the AudioPlayer.play() method, as the error message states clearly, does not take a String as an input parameter. See the javadocs: http://code.compartmental.net/minim/javadoc/ddf/minim/AudioPlayer.html
If you want to play different tracks, you need to load them separately, then play/pause accordingly.
I'm not necessarily comparing strings, more of using a method to analyze what is in a string and act accordingly. It works on it's own without involving the sound library.
I have an octave (a-g) of notes loaded all separately as files. Does this mean that this audio player doesn't work with strings at all? Or is there a work around needed?
The loading of the mp3 file is SEPARATE from the playing of the sound in the file