programming sound on vic easier than on 64?

Basic and Machine Language

Moderator: Moderators

Post Reply
vic user
VicGyver
Posts: 1401
Joined: Thu Mar 25, 2004 9:40 am

programming sound on vic easier than on 64?

Post by vic user »

last night i very briefly looked at the chapter on sound, in the basic book supplied with the 64c.

i know that the 64's sound capabilities are superior to the vic's, but perhaps due to the increased capability one also gets increased compexity in programming?

is programming sound on the 64 a pain compared to the vic?

chris
User avatar
Schema
factor
Posts: 1439
Joined: Tue Mar 23, 2004 7:07 am
Website: http://www.jammingsignal.com
Location: Toronto, Ontario

Post by Schema »

It is definitely more complicated on the C64.

On the VIC, you set the master volume and the desired frequency for each of the four voices. Pretty simple.

On the C64, you have to set the master volume, setup the waveform (sine/sawtooth/pulse/noise), and define the attack-decay-sustain-release wave shape and pulse duty cycle. But there still won't be any sound, you still need to "trigger" the note. These steps need to be done for each voice independently too!

But the examples in the book are pretty good, it's not that bad once you get into the mindset.
vic user
VicGyver
Posts: 1401
Joined: Thu Mar 25, 2004 9:40 am

Post by vic user »

holy smokes!

guess i will stick with the vic ')

chris
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Actually, you define and trigger the waveform at the same time. Each voice has a frequency resolution of 16-bit (compared to 7 bits on the VIC), so you have to put two values into the frequency registers to get a nice note.

VIC-20 example:
POKE 36878,15
POKE 36876,200
FOR I=15 TO 0 STEP -1:POKE 36878,I:NEXT
POKE 36876,0

C64 example:
POKE 54296,15 : REM volume
POKE 54277,0:POKE 54278,249 : REM envelope (ADSR)
POKE 54272,0:POKE 54273,200 : REM frequency (low/high)
POKE 54276,33 : REM trigger note, sawtooth waveform
POKE 54276,32 : REM release note, still with sawtooth

If you require pulse waveform, two more registers have to be set to give the pulse width. Actually, different pulse width may be possible to simulate on the VIC-20 too, by careful timing and send the right values to the oscillator. This is something I still haven't tested.

There are more values to fill out, but things like pulse width and envelope only needs to be set once (per voice) unless you wish to constantly change it, like the advanced C64 music routines do. All the extra features, like individual envelope, waveforms, better frequency resolution, filter, various effects as ring modulation and synchronization and so on may be worth the extra amount of work if one is after a musical experience.
Anders Carlsson

Image Image Image Image Image
vic user
VicGyver
Posts: 1401
Joined: Thu Mar 25, 2004 9:40 am

Post by vic user »

for musically inept people like myself, i think the vic is more than i need.

hey, i guess i could pop those two examples in vice, and hear how different they are :)

chris
aneurysm
not your PAL
Posts: 178
Joined: Sat Mar 06, 2004 11:06 pm

Post by aneurysm »

the VIC also has 4 voices over the C64's 3
that is - unless you hard wire a signal to the SID chip's input pin and then you can run the SID's filters on it
i've been too scared to try it
but i've got ideas if i did... 8)
User avatar
Schema
factor
Posts: 1439
Joined: Tue Mar 23, 2004 7:07 am
Website: http://www.jammingsignal.com
Location: Toronto, Ontario

Post by Schema »

It's possible to add a second SID to the 64 - either directly hacked in, a SID Symphony cartridge, or a StereoInSid daughterboard. That gives you six voices.

Is there an analogous 'hack' possible for the VIC, to get eight voices?
6502dude
megacart
Posts: 1581
Joined: Wed Dec 01, 2004 9:53 am

Post by 6502dude »

Vic sound is created from 6560/6561 (video chip).

I have found these that chips are a common point of failure in many Vic-20s.

6560 is no longer in production :cry: and seem to be scarce.

As a hack, it would likely be better to build a cart based sound system than to try to add second 6560/6561 to existing main board.
aneurysm
not your PAL
Posts: 178
Joined: Sat Mar 06, 2004 11:06 pm

Post by aneurysm »

I rembemer reading about using the RS-232 to output an oscilated square wave. That makes 5 VIC voices.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Yes, you can get a square wave from the userport. It used to be a classic PET hack to get sound from it. Actually, I think the frequency resolution is better in that square wave than what the VIC-I chip can generate.

Aleksi Eeben just released a four channel sample player (no SID voices) for the 64. Apart from the memory requirements, I wonder how much more difficult it would be to port it to VIC.

The Battleships game I posted some time ago, seems to include support for a SID cartridge for the VIC-20. This is something I've almost never heard of, but clearly possible to achieve. If one was going to make a hardware sound expansion for the VIC, I suggest using a slightly better chip than the VIC-I once you are onto it. Either a SID, an AY, maybe a POKEY or even a SN76489.

http://www.answers.com/topic/sound-chip
Anders Carlsson

Image Image Image Image Image
6502dude
megacart
Posts: 1581
Joined: Wed Dec 01, 2004 9:53 am

Post by 6502dude »

An article to generate music from 6522 port appeared in 6502 Notes #16 (Kim Notes 1976). - www.bjlyons.com/kim/kimvol16.pdf

As a project hack, I have thought about porting this over to Vic-20 or a 6502SBC.
otherside
Vic 20 Newbie
Posts: 7
Joined: Sun Sep 11, 2005 4:16 pm

Post by otherside »

carlsson wrote: Aleksi Eeben just released a four channel sample player (no SID voices) for the 64. Apart from the memory requirements, I wonder how much more difficult it would be to port it to VIC.
Could you provide a link to his sample player?

Thank you.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

http://www.kolumbus.fi/aleksieeben/pollytracker/

As you can see, there is an ongoing compo for demo tunes to be included with the editor. About one week left to go, if anyone is interested.
Anders Carlsson

Image Image Image Image Image
aneurysm
not your PAL
Posts: 178
Joined: Sat Mar 06, 2004 11:06 pm

Post by aneurysm »

i know - ive been soooo busy i haven't even loaded the thing up yet :roll:
Post Reply