Apple Newton Utilities Guia do Utilizador Página 563

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 942
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 562
CHAPTER 14
Sound
Using Sound 14-9
Pitch Shifting 14
In general, you can set the value of a sound frame’s samplingRate slot to any
oat value less than that specied by the
kFloat22kRate constant. However, this
usually results in poor sound quality. What generally works best is to take an 11
kHz sound and play it at some higher rate. Of course, 22 kHz sound resources
cannot be played at any higher sampling rate.
You can experiment with pitch shifting by playing sounds in the Inspector using
the
PlaySoundSync function. You can use any of the ROM sounds or your own
custom sounds. The following example shows how to shift a sound’s pitch by
altering the value of the sound frame’s
samplingRate slot. Remember when
setting this slot that
samplingRate must be a value of type float.
// keep a copy of original for future use
origSound := clone(ROM_simpleBeep);
// make a copy to modify
mySound := Clone(origSound);
// play the original sound
PlaySoundSync(mySound);
// play at half original pitch
mySound.samplingRate := origSound.samplingRate/2;
PlaySoundSync(mySound);
// note how easily we can return to normal pitch
mySound.samplingRate := origSound.samplingRate;
// play at twice speed
mySound.samplingRate := origSound.samplingRate*2;
PlaySoundSync(mySound);
By using the output from a control view to alter the value of the sound frame’s
samplingRate slot, you can allow the user to interactively modify the pitch of
playback. The following example code changes the value of the
samplingRate
slot according to the setting of a
protoSlider view:
theSlider.changedSlider := func()begin
if viewValue = maxValue then
mySound.samplingRate := originalRate
else mySound.samplingRate := (viewValue*1.01);
PlaySoundSync(mySound);
end
Vista de página 562
1 2 ... 558 559 560 561 562 563 564 565 566 567 568 ... 941 942

Comentários a estes Manuais

Sem comentários