I'm just starting out with Connect IQ and thought this might be something cool to try. I've created app watch project targeting the Fenix 6 series and started out practicing with playTone. Since you can create arrays of ToneProfile entries and play them in succession, I decided to try and play a chord. I've tried a few things, neither have quite worked.
Idea 1: Call playTone twice.
var concertC = [ new Attention.ToneProfile(523, 1000) ]; var concertG = [ new Attention.ToneProfile(784, 1000) ]; Attention.playTone({:toneProfile=>concertC}); Attention.playTone({:toneProfile=>concertG});
If you do this, the second playTone call "wins". You never hear the first. So this is some sort of async operation where as soon as playTone is called, execution continues, and any subsequent playTone call takes over.
My next tactic was to see if I could play a few tones in quick succession using an array. Maybe we can fool the human ear by playing a little bit of each note back-to-back, so fast that it blends together to us?
public function playCMajor(milliseconds as Integer) { var toneProfile = [ new Attention.ToneProfile( 523, milliseconds), new Attention.ToneProfile( 659, milliseconds), new Attention.ToneProfile( 784, milliseconds), ]; Attention.playTone({:toneProfile=>toneProfile}); }
In this code example I only add three new ToneProfiles, but in practice I added maybe 100. I called this method with different lengths... 20ms, 10ms, 5 ms, etc. At 20ms, it sounds like a musical trill. At 10ms and at 5ms it starts to sound like buzzing. You can hear the notes... but there's other artifacts in the sound that are lower pitch that start to take over. Does not sound good.
I've tested this in the Simulator on Windows and on my watch. It actually sounds much better on the watch than in the simulator, but still doesn't sound good.
If we can figure this out, my next step would be to try and write and play a short song with chords. Why? Well, why not?