Offline
california

Does anyone know where there might be some code for simple c64 sound programs? Ya know like they used to have in magazines and books and stuff. I just want to play with my commie a little, while waiting for the Mssiah to arrive. I'm anxious.

Offline

For a start you can mess around with the SID registers using POKEs.  As you know SID has 3 channels, each is mapped to 7 registers in sequence starting at 54272.  The registers after that control the global filter and volume.

For example try this to play some noise on channel 1.

10 POKE 54296,15
20 POKE 54277,0
30 POKE 54278,255
40 POKE 54276,129
50 POKE 54273,40

Explanation:

10 Set volume register (54296) to 15 (maximum)
20 Set Attack/Decay on channel 1 to 0 (no attack or decay)
30 Set Sustain/Release on channel 1 to 255 (full sustain and release)
40 Set Waveform on channel 1 to Noise (128) with Gate on so it doesn't fade out (+1 = 129)
50 Set raw pitch on channel 1 to 40.

Quick run down for channel 1:

54272 = Pitch low-bits (0-255)  (think of this as fine tune of the note)
54273 = Pitch high-bits (0-255)  (think of this as raw pitch of the note)
54274 = Pulse width modulation low-bits (0-255)
54275 = Pulse width modulation high-bits (0-15)  8 = Pure pulse wave
54276 = Waveform (17 = Triangle , 33 = Saw, 65 = Pulse, 129 = Noise)
54277 = Attack/Decay
54278 = Sustain/Release

Add 7 to the channel registers to play with channel 2 (eg: POKE 54276+7,129 to set waveform there) and 14 to play with channel 3 (eg: POKE 54273+14,40 to set the pitch on channel 3)

To activate the 'release' of a sound subtract 1 from the waveforms I listed above.  For example POKE54276,32 to turn the gate off on a saw wave on channel 1.

Best idea is to try out the programs in The Programmers Reference .  You want Chapter 4 which is all sound programs, including how the filters work.  Chapter 7 (the Appendix) has the pitch table for notes.

Offline
california

Thanks 4mat, that did clear up a few things actually. In case anyone cares, I found an archive of old C64 books. http://www.bombjack.org/commodore/books.htm

Offline
New York City

The C64 user manual has programs.
I also recommend Compute!'s Gazette type-ins. I bet you can find them somewhere online.