Dotted notes and Triplets

If I use

play_note(pitch,volume,note length)

Then the note length is the note in beats.
So for a piece in 4/4 the 1 represents a quarter note duration.
A note length of 4 would be a whole note and a note length of 2 would be a half note.
0.50 would be an eight note and 0.125 a sixteenth note.
A dotted quarter would be 1.5
How would one represent a triplet? I assume it would be with a duration of 2/3 or 0.6666 for a quarter-note triplet and 1/3 for an eight-note triplet or 0.33333.

Hi, Drake.

I’m an absolute beginner with SCAMP. But from my experimentation so far, I think that a SINGLE note of an 8th note triplet would be 0.3333333, as you said. And 0.66666 for a quarter-note triplet.

Then if you wanted to play a complete 8th note triplet, you’d just loop the play_note statement 3 times.

SCAMP makes it so easy for us to play any division of a beat. I’ve been experimenting by placing a random # of notes in a measure, each at a random location, and the total rests between each randomly chosen so that together they all add to 4.0 for a complete measure. Set against a regular pulse on the beat, it sounds quite nice. Certainly something that us humans couldn’t play (easily, anyway) :smiley_cat:

Best to you!

David Collett
Seattle

1 Like

Thanks, David,
How do you represent a rest? Do you just use the wait call? So, for example, a sequence:

for pitch in [60, 64, 0, 72]:
    if(pitch == 0):
        wait(1)   
    else:    
        violin.play_note(pitch, 1, 1)

Where the pitches of 0 are rests and assuming these are all quarter notes

I think that is correct. Use wait for rests. See this example
If you want to use 0 to represent a rest, this code will make more sense:

if pitch:
  violin.play_note(pitch, 1, 1)
else:
   wait(1)

As people have said, rests are created using wait. If you want you can also call play_note with a pitch of None. (If you do a pitch of 0, you won’t hear anything, but the notation would still show a ridiculously low note.)