Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- << Music`
- f2m[f_] := IntegerPart[Log[2, f/440.0]*12 + 69]; (* freq\[Rule]midi*)
- freqs[notes_, scale_] := With[{
- cents =
- scale[[1 + Mod[#, Length[scale]]]] +
- 1200 Quotient[#, Length[scale]] & /@ notes},
- 440 (1 + cents/1200.0)
- ]; (* convert notes to freqs in a scale *)
- arp[s1_, s2_] :=
- s1 + # & /@ s2 //
- Flatten; (* repeat on seq of numbers on top of another *)
- playfreqs[freqs_, duration_] :=
- Sound[SoundNote[f2m[#] - 69, duration] & /@ freqs]; (* play notes *)
- seq = Table[{0, 2, 4, 2}, {i, 0, 2}] // Flatten;
- playfreqs[
- freqs[arp[{0, 2, 4}, seq], TemperedMajor]~Join~
- freqs[arp[{0, 2, 4}, seq], TemperedMinor]~Join~
- freqs[arp[{0, 2, 6}, seq], TemperedMajor]~Join~
- freqs[arp[{0, 2, 4}, seq], TemperedMinor],
- 0.125
- ]
Advertisement
Add Comment
Please, Sign In to add comment