예제 #1
0
note_t transpose_note(transpose_t transpose, note_t note) {
  note_tone_t tone = (note_tone(note) + transpose_tones(transpose)) % 12;
  note_letter_t letter = (note_letter(note) + transpose_letters(transpose) - 1) % 7 + 1;
  note_accidental_t accidental = NOTE_ACCIDENTAL_NATURAL + (tone + 18 - note_letter_tone(letter)) % 12 - 6;

  return note_create(letter, accidental);
}
예제 #2
0
static PyObject *cboodle_create_note(PyObject *self, PyObject *args)
{
  sample_t *samp;
  char *sampstr;
  int samplen;
  double pitch;
  double volume;
  stereo_t pan;
  long starttime;
  long retval;
  PyObject *channel, *removefunc;

  if (!PyArg_ParseTuple(args, "s#ddddddlOO:create_note", 
    &sampstr, &samplen,
    &pitch, &volume, 
    &pan.scalex, &pan.shiftx, &pan.scaley, &pan.shifty,
    &starttime, &channel, &removefunc))
    return NULL;

  if (!sampstr || samplen != sizeof(sample_t *)) {
    PyErr_SetString(PyExc_TypeError, 
      "create_note: argument must be a string returned by new_sample");
    return NULL;
  }

  samp = *((sample_t **)sampstr);
  retval = note_create(samp, pitch, volume, &pan, starttime, channel, removefunc);

  return Py_BuildValue("l", retval);
}