i am having trouble plugging the 6581 datasheet info into two example Processing sketchs that make sound on the chip. For example, what does it mean to say, "there are 29 eight-bit registers in SID which control the generation of sound"?
at least part of my problem comes from not understanding hex values and their relationship to a serial signal. The numbers i see in the datasheet don't look to be in the same format as the numbers in the sketch. I don't remember any 0x numbers in the data sheet like there are in the sketch. Is that just a hex prefix?
Since i am messing with the sketch without understanding, i am just barely scratching the surface of an increasing itch.
this is one of the examples i am playing with:
Code: Select all
import processing.serial.*;
Serial port;
int[] init = {
4, 0x11, 5, 0x88, 6, 0x84}; //Triangle Wave with ADSR set
/* note loop pattern written here */
int[] song = {
1, 0x08, 0, 0x93, 1, 0x0A, 0, 0xCD, 1, 0x0E, 0, 0x6B, 1, 0x08, 0, 0x93,1, 0x00, 0, 0x00,1, 0x00, 0, 0x00,1, 0x00, 0, 0x00 };
void setup(){
println(Serial.list()); //prints a list of serial ports in the terminal window
port = new Serial(this, "COM5", 9600); // You must change "COM5" to the port your FTDI cable is using
for (int i=0; i<init.length;i++){
port.write(byte(init[i]));
}
}
void draw(){
for (int i=0; i<song.length;i=i+2){
port.write(byte(song[i])); //writes song note
port.write(byte(song[i+1]));
delay(10);
port.write(byte(4)); //sets ADSR gate
port.write(byte(0x11));
delay(10);
delay(90);
port.write(byte(4)); //releases ADSR gate
port.write(byte(0x10));
delay(40);
}
}