Example #1
0
    def config_graphics_context(self, gc):
        """
        Configure displacement and scale for the given wx.GraphicsContext, so
        that (0,0) is the starting grid coords, and "1" is the tile
        width/length, centralizing the game board.
        """

        # Finds the max tile size ...
        width, height = self.GetSize()
        fw = DSIZE["FrameWidth"]
        self.tile_size = max(
            MIN_TILE_SIZE,
            lz.rint(min(
                width  / (self.game.cols + 2 * fw),
                height / (self.game.rows + 2 * fw)
            ))
        )

        # ... and the game displacement
        self.gamewidth = self.tile_size * self.game.cols
        self.gameheight = self.tile_size * self.game.rows
        self.xleft = (width - self.gamewidth) / 2 # Corner to draw tiles
        self.ytop = (height - self.gameheight) / 2

        # Adjust axis for unitary tile size starting from (0,0)
        gc.Translate(self.xleft, self.ytop)
        gc.Scale(self.tile_size, self.tile_size)
Example #2
0
    "æ": [820, 1530],
    "ɑ": [750, 940],
    "ɒ": [700, 760],
    "ʌ": [600, 1170],
    "ɔ": [500, 700],
    "ɤ": [460, 1310],
    "o": [360, 640],
    "ɯ": [300, 1390],
    "u": [250, 595],
}

# Initialization
rate = 44100
s, Hz = sHz(rate)
inertia_dur = 1 * s
inertia_filter = maverage(rint(inertia_dur))

api = sys.argv[1] if sys.argv[1:] else None  # Choose API via command-line
chunks.size = 1 if api == "jack" else 16

with AudioIO() as player:
    first_coeffs = formants[vowels[0]]

    # These are signals to be changed during the synthesis
    f1 = ControlStream(first_coeffs[0] * Hz)
    f2 = ControlStream(first_coeffs[1] * Hz)
    gain = ControlStream(0)  # For fading in

    # Creates the playing signal
    filt = CascadeFilter([
        resonator.z_exp(inertia_filter(f1).skip(inertia_dur), 400 * Hz),
Example #3
0
  "ɑ": [750, 940],
  "ɒ": [700, 760],
  "ʌ": [600, 1170],
  "ɔ": [500, 700],
  "ɤ": [460, 1310],
  "o": [360, 640],
  "ɯ": [300, 1390],
  "u": [250, 595],
}


# Initialization
rate = 44100
s, Hz = sHz(rate)
inertia_dur = .5 * s
inertia_filter = maverage(rint(inertia_dur))

with AudioIO() as player:
  first_coeffs = formants[vowels[0]]

  # These are signals to be changed during the synthesis
  f1 = ControlStream(first_coeffs[0] * Hz)
  f2 = ControlStream(first_coeffs[1] * Hz)
  gain = ControlStream(0) # For fading in

  # Creates the playing signal
  filt = CascadeFilter([
    resonator.z_exp(inertia_filter(f1).skip(inertia_dur), 400 * Hz),
    resonator.z_exp(inertia_filter(f2).skip(inertia_dur), 2000 * Hz),
  ])
  sig = filt((saw_table)(100 * Hz)) * inertia_filter(gain)
Example #4
0
  "ø": [370, 1900],
  "ɛ": [610, 1900],
  "œ": [585, 1710],
  "a": [850, 1610],
  "æ": [820, 1530],
  "ɑ": [750, 940],
  "ɒ": [700, 760],
  "ʌ": [600, 1170],
  "ɔ": [500, 700],
  "ɤ": [460, 1310],
  "o": [360, 640],
  "ɯ": [300, 1390],
  "u": [250, 595],
}

inertia_filter = maverage(rint(.5 * s))

with AudioIO() as player:
  f1, f2 = ControlStream(0), ControlStream(pi)
  gain = ControlStream(0)
  filt = CascadeFilter([
    resonator.z_exp(inertia_filter(f1), 400 * Hz),
    resonator.z_exp(inertia_filter(f2), 2000 * Hz),
  ])
  sig = filt((saw_table)(100 * Hz)) * inertia_filter(gain)

  player.play(sig)

  vowels = "aɛiɒu"
  for vowel in vowels:
    coeffs = formants[vowel]
Example #5
0
    "ø": [370, 1900],
    "ɛ": [610, 1900],
    "œ": [585, 1710],
    "a": [850, 1610],
    "æ": [820, 1530],
    "ɑ": [750, 940],
    "ɒ": [700, 760],
    "ʌ": [600, 1170],
    "ɔ": [500, 700],
    "ɤ": [460, 1310],
    "o": [360, 640],
    "ɯ": [300, 1390],
    "u": [250, 595],
}

inertia_filter = maverage(rint(.5 * s))

with AudioIO() as player:
    f1, f2 = ControlStream(0), ControlStream(pi)
    gain = ControlStream(0)
    filt = CascadeFilter([
        resonator.z_exp(inertia_filter(f1), 400 * Hz),
        resonator.z_exp(inertia_filter(f2), 2000 * Hz),
    ])
    sig = filt((saw_table)(100 * Hz)) * inertia_filter(gain)

    player.play(sig)

    vowels = "aɛiɒu"
    for vowel in vowels:
        coeffs = formants[vowel]