3-part harmony thru multitasking

erco

Senior Member
Is it possible to get 3 tunes playing harmony in sync using multitasking on a 20M2? 3 tasks, 3 pins, 3 speakers? Would they stay in sync as long as the tunes were laid out properly? I'm far from my PicAxes, otherwise I'd test it myself.
 

g6ejd

Senior Member
I would say it's possible, but there's only one CPU and so there will be a limit to the highest frequencies if the tones are not generated by discreet hardware, which their not.
 

westaust55

Moderator
As the PICAXE chips are single core, multi-tasking is in effect a time-slice process where one command in each task is processed before stepping to the next task in a round-robin method.
Some commands totally block the rotation between tasks (eg SERIN) while other commands (eg PAUSE) allow the processing to move immediately on to the next task.

For the tune command, to maintain consistency of the tune, the processor core must keep generating the tone/note.
Think of how the interrupt system functions where inputs are “checked between execution of each command line in the program, between each note of a tune command, and continuously during any pause command”.
You would tentatively be able to step to the next task at the end of a note but the likelihood is that there may be extended pauses between two notes within a single task.

Your question likely needs either you to “try and see” what happens or a clarification from Technical or hippy.
 

techElder

Well-known member
Spend your effort in keeping 3 picaxes in sync; each playing a different note in the tune. Picaxes are cheap ... buy more! :cool:
 

erco

Senior Member
Spend your effort in keeping 3 picaxes in sync; each playing a different note in the tune. Picaxes are cheap ... buy more! :cool:
Oh, that's cheatin'! :) I'll "have a play" at first opportunity. Not looking to delve as deeply as "One Bit Symphony" (which is amazing, BTW), but just looking at some simple Christmas tunes & harmony.
 
Top