This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Control pitch and speed of a sample in Famitone

Control pitch and speed of a sample in Famitone
by on (#239199)
Is it possible to change the famitone code in order to control the speed and/or pitch of a DPCM sample?
The idea is to pass the speed and/or pitch in registers X/Y as parameters of the subroutine FamiToneSamplePlay.
Thanks in advance.
Re: Control pitch and speed of a sample in Famitone
by on (#239204)
DPCM doesn't have a pitch adjustment. It does have a sample rate adjustment (which affects pitch).

If you want specific pitches, you probably need a separate sample for each pitch.

Famitone usually loads from a table called "samples"

You could make the rate a variable. Instead of

FamiToneSamplePlay:
...

lda (FT_TEMP_PTR),y ;pitch and loop
sta APU_DMC_FREQ

have

lda variable
sta APU_DMC_FREQ
Re: Control pitch and speed of a sample in Famitone
by on (#239221)
Works like a charm!

The value on the table 'samples' generated by text2data for frequency and loop is at high value for frequency ($0f) so I could only low the frequency...below $0d the audio becomes just noise...but works anyway.

Thank you so much for the help.