Thread: Playing samples
View Single Post
Old 18 June 2011, 00:06   #3
Codetapper
2 contact me: email only!
 
Codetapper's Avatar
 
Join Date: May 2001
Location: Auckland / New Zealand
Posts: 3,187
Here's a little from Mapping the Amiga:

Most sound-digitizing software specifies the waveform frequency by the number of samples per second, not by the period value that the Amiga's hardware expects. The equation for converting the samples-per-second to period value is:

Period = 3579564 / Samples-Per-Second

So, if you want to play a sound that was sampled at 12 kHz, use a period value of 3579546 / 12000 = 298

To calculate the period value for a note, use the equation

Period = 3579546 / (Length * Frequency)

where Length is the size of the waveform in bytes and Frequency is the note's frequency value obtained from the table:

A = 440
A# or Bb = 466
B = 494
C = 523
C# of Db = 554
D = 587
D# or Eb = 622
E = 659
F = 699
F# or Gb = 740
G = 784
G# or Ab = 831

To raise a note by an octive, divide the period value by 2.

It also states the lowest value you should ever use is 124, since this is about as fast as the Amiga can go. If you use a value less than 124, you run the risk of having the same 2 bytes of data output twice in a row.
Codetapper is offline  
 
Page generated in 0.05163 seconds with 11 queries