Mod Archive Forums Mod Archive Forums
Advanced search  

News:

Please note: Your main modarchive.org account will not work here, you must create a forum account to post on the forums.

Pages: [1]   Go Down

Author Topic: how to use some of the audio capability of Nintendo DS to play sound?  (Read 8800 times)

0 Members and 1 Guest are viewing this topic.

charles0111

  • Guest

Seening follow example:
     Given a pointer to an 8bit sample, recorded at 22,050Hz, where 'sample' is the start of the data, and 'sample_end' is the end, the following would set things up to play on channel 0:

  SCHANNEL_TIMER(0) = SOUND_FREQ(22050);
  SCHANNEL_SOURCE(0) = (uint32)sample;
  SCHANNEL_LENGTH(0) = ((int)sample_end - (int)sample) >> 2;
  SCHANNEL_CR(0) = SCHANNEL_ENABLE | SOUND_ONE_SHOT | SOUND_8BIT |     SOUND_VOL(0x3F);

the details you may click follow link:http://www.double.co.nz/nintendo_ds/nds_develop4.html


my question is:
    we should oppoint what value for the SOUND_FREQ(?) and SOUND_BIT(?) is the fittest effect when to play a sound which format is such a mod or raw format.



 
Logged

sverx

  • Newbie
  • Offline Offline
  • Posts: 54
    • View Profile

we should oppoint what value for the SOUND_FREQ(?) and SOUND_BIT(?) is the fittest effect when to play a sound which format is such a mod or raw format.

Playing a XM/MOD on a DS is a matter of giving these commands with the right values in the right moment. In easy words: if you play a sample at the same SOUND_FREQ() it has been sampled, you play the same sample -at the same pitch- that you recorded. To make a different note you need to use a different value of SOUND_FREQ(), and it's all about math. For instance if your sample is 22k sample per seconds playing it at 44k samples per second will make the same note one octave above and playing it at 11k samples per second will reproduce the same note one octave below.

SOUND_*BIT macro is needet to tell the DS about the 'format' of the sample. It can be 8 or 16 bits PCM, or 4 bits ADPCM

Logged

charles0111

  • Guest

hi sverx, :)thank you very much!
Logged
Pages: [1]   Go Up