How to add a rest/empty note in pattern?

I’m just starting out with FoxDot. I want my player to play a pattern that I defined in a list, but I don’t want to fill up every note of the bar. In this example I only want notes to play on the 1st, 3rd and 4th beat.

This line sounds right, but it gives me an error message (Error in Player b1: float() argument must be a string or a number, not ‘NoneType’):

b1 >> bass([0, None, 0, 5], dur = [1/2])

Is there a value that I can replace None with in this example to indicate an empty note/rest?

1 Like

Try something like:

b1 >> bass([0, 1, 0, 5], dur =[1/2,rest(1/2),1/2,1/2])

Using rest in the dur or setting amp to 0 are the best ways of doing this at present but I quite like the idea of using None as a rest actually and could be used in other attributes too

I’ve added the ability to use None as an empty pitch in Players to the GitHub version and will add to pip soon. You can even nest the None in patterns and PGroups like so:

p1 >> pluck([0, 1, P*(0, None), 3])

I’ve also set underscore to None so you do p1 >> pluck([0, 1, _, 3])

1 Like

Awesome! Thanks for the responses and the implementation, I’ll be sure to give it a try. Underscore was also one of the things I tested when trying to accomplish this :slight_smile: