I use mathematica to play the Inventions No8 by Bach. I want to play the two parts (by right and left hands )at the same time. But I don't know how to do it. Can you help me? Thank you!
- Clear["`*"]
{a, b, c, d} = 0.8*{1, 0.5, 0.25, 0.125};
{c4, d4, e4, f4, g4, a4, b4} = {0, 2, 4, 5, 7, 9, 11};
{c5, d5, e5, f5, g5, a5, b5} = {c4, d4, e4, f4, g4, a4, b4} + 12;
b\[Flat] = 10;
time1 = Join[ConstantArray[b, 7], ConstantArray[c, 10],
ConstantArray[b, 6]];
note1 = {None, f4, a4, f4, c5, f4, f5,
e5, d5, c5, d5, c5, b4,
a4, b4, a4, g4,
f4, a4, c5, a4, f5, c5} /. {b4 -> b\[Flat]};
Sound@MapThread[SoundNote[#1, #2, "Piano"] &, {note1, time1}]
Sound@MapThread[
SoundNote[#1, #2, "Piano"] &, {Join[
ConstantArray[None, 4], (note1 - 12) /. {None - 12 -> None}],
Join[ConstantArray[b, 4], time1]}]