Jump to content
IGNORED

who, of you here have a foot in both the a8 and c64 camps


carmel_andrews

Recommended Posts

Isn't the big win the fact that if you get an 8 bit sample using the oscillator on the c64 - this is then run through the ADSR . Wouldn't that give you 12 bits? Take 2 voices and you almost match some of the earliest CD players :)

The ADSR circuit isn't that easy to control since it's performing the ADSR-envelope automatically. You can only use it to apply ADSR to a sample you play, for example: A new waveform played as sample.

 

I've not looked at Pokey in detail, are there any noise settings that would give PWM effects when played at high frequency? ( >64KHz )

PWM doesn't sound too good anyway.

 

( When I did audio for the 8 bit originaly I never thought about trying for better than 4 bit samples :) - the A/D on replay was 8 bit, but 4 bits was trimmed in the software as samples took so much memory )

I'd go for a 6 bit mixer which does the output at the 4 channels simultanously similar to this (X containing the current mixed sample value):

 

LDA table1,X
STA $D201
LDA table2,X
STA $D203
LDA table3,X
STA $D205
LDA table4,X
STA $D207

 

And inbetween sample updates there would be mixing which can be "n-channels, 8 bit". A few fractional bits never hurt anyone :)

Link to comment
Share on other sites

I've not looked at Pokey in detail, are there any noise settings that would give PWM effects when played at high frequency? ( >64KHz )

 

Yes, effects like the sawtooth and triangle wave are produced using super-sonic clocks. Listen to delta.rmt that comes with Raster Music Tracker to hear sawtooths on the Atari.

Link to comment
Share on other sites

4 bits + 4 bits + 4 bits + 4 bits = ~6 bits

 

And:

 

6 bits + 6 bits + 6 bits + 6 bits = ~8 bits

 

I don't know where you are getting 6bits + 6bits+6bits+6bits. If you merge samples in software, you have to then map the result to the hardware which is 4-bit volume register with other bits being simulated by a NON-DAC component that affects the volume level.

4 bits = range 0...15

6 bits = range 0...63

 

15+15+15+15 = 60 = ~6 bits

 

So the four 4 bit channels added to one channel result in one "almost 6 bit" channel.

 

If you invert that calculation on the 8 bit channel used for the tune I mentioned, you get four channels of atleast 6 bit (range 0...63) accuracy if the output channel is 8 bits (0...255).

 

Atari 8-bit can play samples at >20Khz easily w/screen off, and it is an option if you are streaming the data from an I/O port or reading from RAM disk.

20 kHz replay is not a problem if you only play one channel. Btw, the 2nd part of "Vicious Sid" is streaming sample data from disk.

 

So you are already assuming you are going to get 8-bit accuracy out of one C64 channel. The C64 software has to achieve the 8-bit DAC simulation since hardware does not have built-in features for microsecond accuracy.

 

You can simulate a 5-bit volume register using one 4-bit DAC.

Link to comment
Share on other sites

Isn't the big win the fact that if you get an 8 bit sample using the oscillator on the c64 - this is then run through the ADSR . Wouldn't that give you 12 bits? Take 2 voices and you almost match some of the earliest CD players :)

 

I've not looked at Pokey in detail, are there any noise settings that would give PWM effects when played at high frequency? ( >64KHz )

 

( When I did audio for the 8 bit originaly I never thought about trying for better than 4 bit samples :) - the A/D on replay was 8 bit, but 4 bits was trimmed in the software as samples took so much memory )

 

All those other programmable envelopes are only programmable in millisecond accuracy so you have to have software turn off/on those registers.

Link to comment
Share on other sites

Isn't the big win the fact that if you get an 8 bit sample using the oscillator on the c64 - this is then run through the ADSR . Wouldn't that give you 12 bits? Take 2 voices and you almost match some of the earliest CD players :)

 

I've not looked at Pokey in detail, are there any noise settings that would give PWM effects when played at high frequency? ( >64KHz )

 

( When I did audio for the 8 bit originaly I never thought about trying for better than 4 bit samples :) - the A/D on replay was 8 bit, but 4 bits was trimmed in the software as samples took so much memory )

 

All those other programmable envelopes are only programmable in millisecond accuracy so you have to have software turn off/on those registers.

 

I guess you can still implement a form of block floating point - 12 bit range, but only 8 bit precision at any single sample. Probally something one of the c64 experts would know more about

Link to comment
Share on other sites

4 bits + 4 bits + 4 bits + 4 bits = ~6 bits

 

And:

 

6 bits + 6 bits + 6 bits + 6 bits = ~8 bits

 

If I understand that correctly, you'd still have to do software volume before mixing all channels into a single 8bit DAC output. So unless the samples are played at max volume all the time, they'll loose fidelity due to the downward multiplication LUT for linear volume. Or right shifts for LOG volumes.

 

Is the A8 4bit DAC method using the hardware volume in conjunction with a waveform state to get 4bit output, or is the hardware volume mechanism free to change? Is the hardware volume of each channel on the POKEY LOG? What's the resolution of the volume levels?

 

You can mix channels by addition and clip the volume rather than do shifts-- that usually gives the best results. Or sometimes, you can go for the root-mean-square algorithm.

 

The POKEY DACs in volume mode are outputting exactly the value you put into lower 4-bits of a register like 53761. So to set speaker to half-way between on/off, you would do POKE 53761,16+8. Now when you combine multiple DACs, there's some merging going on by the hardware (not software). So if you play some musical tone in one of the channels and DAC output on another, the hardware will merge them for you and you don't have to worry about truncation errors. The upper 3 bits of the DAC registers are don't care so good for optimizing stuff when you are playing stereo samples or other cases:

 

LDA Sample

TAY

LDX SHR4ORWITH0XF0,Y

ORA #$F0

STA 53761 ;Play right channel

STX 53763 ;Play left channel

Link to comment
Share on other sites

Isn't the big win the fact that if you get an 8 bit sample using the oscillator on the c64 - this is then run through the ADSR . Wouldn't that give you 12 bits? Take 2 voices and you almost match some of the earliest CD players :)

 

I've not looked at Pokey in detail, are there any noise settings that would give PWM effects when played at high frequency? ( >64KHz )

 

( When I did audio for the 8 bit originaly I never thought about trying for better than 4 bit samples :) - the A/D on replay was 8 bit, but 4 bits was trimmed in the software as samples took so much memory )

 

All those other programmable envelopes are only programmable in millisecond accuracy so you have to have software turn off/on those registers.

 

I guess you can still implement a form of block floating point - 12 bit range, but only 8 bit precision at any single sample. Probally something one of the c64 experts would know more about

 

I think you need to find someone NOT expert on C64 to tell us there's a 8-bit hardware DAC in the machine.

 

Also, you stated: "( That's how we tested the Replay tables on the ST )". What was the replay tables all about -- for simulating higher than 8-bit DACs on ST?

Link to comment
Share on other sites

You can mix channels by addition and clip the volume rather than do shifts-- that usually gives the best results. Or sometimes, you can go for the root-mean-square algorithm.

Uh what? Clipping is one of the most horrible things you can do to a sound.

 

Now when you combine multiple DACs, there's some merging going on by the hardware (not software).

The "merging" is just a simple addition.

 

So if you play some musical tone in one of the channels and DAC output on another, the hardware will merge them for you and you don't have to worry about truncation errors.

There is no truncation if you choose the right sample value range.

Link to comment
Share on other sites

You can mix channels by addition and clip the volume rather than do shifts-- that usually gives the best results. Or sometimes, you can go for the root-mean-square algorithm.

Uh what? Clipping is one of the most horrible things you can do to a sound.

 

Now when you combine multiple DACs, there's some merging going on by the hardware (not software).

The "merging" is just a simple addition.

 

So if you play some musical tone in one of the channels and DAC output on another, the hardware will merge them for you and you don't have to worry about truncation errors.

There is no truncation if you choose the right sample value range.

 

Clipping works better than doing shifts (I am using it currently in all of my multimedia CDs to simulate 4 voices):

 

Mov AL,Sample1

Mov AH,Sample2

Add AL,AH

Jnc GoodValue

Mov AL,255 ;clip to max value

GoodValue: Out DX,AL ;play sample (thru Sound Blaster or whatever 8-bit DAC you have)

 

If you do shifts or even scale with multiplies, it drops the overall volume of the sample:

 

Mov AL,Sample1

Mov AH,Sample2

Add AL,AH

Rcr AL,1

Out DX,AL

 

You can also see truncation effects using above two examples: the first has less truncation errors as most samples will end up not being clipped (I guess the root-mean square probability applies). The 2nd example has truncation error of 1 bit (LSB) as opposed to if you had two channels to play the sound on which would give 0% truncation. You can't choose the sample value range as you are playing two streams of 8-bit data so each sample can be 0..255.

Link to comment
Share on other sites

This was sort of an interesting thread before. Why couldn't you guys have started a new thread for all this tech stuff?

 

Feel free to continue with the topic; some prefer the "o" in "who" to a "y":

 

why, of you here have a foot in both the a8 and c64 camps

 

It could easily be misread if we had two long topic names that only differed by one letter.

Link to comment
Share on other sites

This was sort of an interesting thread before. Why couldn't you guys have started a new thread for all this tech stuff?

 

Feel free to continue with the topic; some prefer the "o" in "who" to a "y":

 

why, of you here have a foot in both the a8 and c64 camps

 

It could easily be misread if we had two long topic names that only differed by one letter.

 

You're obviously intelligent enough to have formulated a different sentence instead of hijacking a thread so thoroughly.

Link to comment
Share on other sites

Mov AL,Sample1

Mov AH,Sample2

Add AL,AH

Jnc GoodValue

Mov AL,255 ;clip to max value

GoodValue: Out DX,AL ;play sample (thru Sound Blaster or whatever 8-bit DAC you have)

 

There are two definitions of clipping: one means to stop at a point(ceiling) and the other means a value wraps around. I always used the word 'clipping' because in the music/audio world it means the value flattens out for either position or negative phase. I don't use the word "clipping" for samples anymore because some people misinterpret it. I just refer to it as saturation (there's another term too, but I forget what it is at the moment).

 

But my question was, about POKEY, if the volume (attenuation) is digital as in it's applied to the sample before going to the DAC or if it's external to the DAC (applied after the sample is sent to the DAC)?

Link to comment
Share on other sites

If you look at an oscilloscope or sound card sampling...

 

Normal "square" waves aren't as such. You have a near instantaneous "attack" as you would with a normal square/pulse.

Then, a decay back towards zero, which begins steeply and flattens out.

 

Then repeat with reverse-phase for the remainder of the cycle.

 

|\
|  \ 
|	\
|	  -   
	 |	   -
	 |	 /
	 |  /
	 |/

 

Not a great illustration, but kinda close... I can put a proper pic up later.

Link to comment
Share on other sites

This was sort of an interesting thread before. Why couldn't you guys have started a new thread for all this tech stuff?

 

Feel free to continue with the topic; some prefer the "o" in "who" to a "y":

 

why, of you here have a foot in both the a8 and c64 camps

 

It could easily be misread if we had two long topic names that only differed by one letter.

 

You're obviously intelligent enough to have formulated a different sentence instead of hijacking a thread so thoroughly.

 

Believe it or not I never started a topic on AtariAge ever. I just try to contribute wherever I could. I don't call it hijacking if someone is claiming things that are obviously wrong and I speak out against it (that's when I first joined this thread).

Link to comment
Share on other sites

Mov AL,Sample1

Mov AH,Sample2

Add AL,AH

Jnc GoodValue

Mov AL,255 ;clip to max value

GoodValue: Out DX,AL ;play sample (thru Sound Blaster or whatever 8-bit DAC you have)

 

There are two definitions of clipping: one means to stop at a point(ceiling) and the other means a value wraps around. I always used the word 'clipping' because in the music/audio world it means the value flattens out for either position or negative phase. I don't use the word "clipping" for samples anymore because some people misinterpret it. I just refer to it as saturation (there's another term too, but I forget what it is at the moment).

 

But my question was, about POKEY, if the volume (attenuation) is digital as in it's applied to the sample before going to the DAC or if it's external to the DAC (applied after the sample is sent to the DAC)?

 

Okay, I never used that meaning for clipping. I use it for clipping to -128..127 for signed samples and 0..255 for unsigned. There's actually a higher quality version of the saturation algorithm (than the one posted above) that equalizes the samples around the zero-point but not as fast. Perhaps, MMX would be useful here as they have those clipping/saturation instructions built-in and work on 8 bytes at a time.

Link to comment
Share on other sites

Believe it or not I never started a topic on AtariAge ever. I just try to contribute wherever I could. I don't call it hijacking if someone is claiming things that are obviously wrong and I speak out against it (that's when I first joined this thread).

 

Wasn't necessarily just saying you... I've just never seen a thread go this far off the original point pretty much permanently... I can see where trying to correct some incorrect points can lead off-topic pretty quickly.

Edited by Mirage1972
Link to comment
Share on other sites

Believe it or not I never started a topic on AtariAge ever. I just try to contribute wherever I could. I don't call it hijacking if someone is claiming things that are obviously wrong and I speak out against it (that's when I first joined this thread).

 

Wasn't necessarily just saying you... I've just never seen a thread go this far off the original point pretty much permanently... I can see where trying to correct some incorrect points can lead off-topic pretty quickly.

 

I kind of agree...

 

I put my comment in and I haven’t understood a word since. :ponder:

Link to comment
Share on other sites

I agree with myself too :) , but at the same time, I have to admit I was in a bit of a bad mood last night (or the past few days actually), so... normally I wouldn't have said anything to begin with. Sorry guys, carry on then.

Edited by Mirage1972
Link to comment
Share on other sites

This was sort of an interesting thread before. Why couldn't you guys have started a new thread for all this tech stuff?

 

Feel free to continue with the topic; some prefer the "o" in "who" to a "y":

 

why, of you here have a foot in both the a8 and c64 camps

 

It could easily be misread if we had two long topic names that only differed by one letter.

 

So, aside of attacking other users personally, you even lack basic reading abilities?

 

 

Thorsten

Edited by Thorsten Günther
Link to comment
Share on other sites

If you look at an oscilloscope or sound card sampling...

 

Normal "square" waves aren't as such. You have a near instantaneous "attack" as you would with a normal square/pulse.

Then, a decay back towards zero, which begins steeply and flattens out.

 

Then repeat with reverse-phase for the remainder of the cycle.

 

|\
|  \ 
|	\
|	  -   
	 |	   -
	 |	 /
	 |  /
	 |/

 

Not a great illustration, but kinda close... I can put a proper pic up later.

 

That is the look of a square wave passed through a high-pass filter (capacitor). The rapid rising and falling edges pass through fine, but the flat parts (which look like DC for a period of time) get filtered out and fall toward ground. Does it look like that on Pokey's output pin or the audio output on the back?

Link to comment
Share on other sites

If you look at an oscilloscope or sound card sampling...

 

Normal "square" waves aren't as such. You have a near instantaneous "attack" as you would with a normal square/pulse.

Then, a decay back towards zero, which begins steeply and flattens out.

 

Then repeat with reverse-phase for the remainder of the cycle.

 

|\
|  \ 
|	\
|	  -   
	 |	   -
	 |	 /
	 |  /
	 |/

 

Not a great illustration, but kinda close... I can put a proper pic up later.

 

 

That's a "return to 0" system. Every "audio" device I know of uses it (supposedly you can damage a speaker if it's held in one spot too long and this prevents that. I have no idea what amount of duration is considered damaging though).

 

My guess is: POKEY volume is a DAC which controls an amplifier transistor directly. in DAC-mode the volume register simply amplifies a constant voltage while in normal mode it amplifies the waveforms.

 

My guess is that it's like the NES audio. Each channel has a 4bit DAC. The waveform is square/duty cycle so the volume mechanism is digital, i.e. the phase of the waveform is shifted(multiplied) according to the linear 'volume' level. It has a triangle channel, but the triangle waveform uses all 4bit levels of the DAC and therefore has no volume control. I take it POKEY works like this too.

 

Wiki says four 8bit channels, but it looks like it's referring to the resolution of the frequency divider register and not the DAC itself. It wouldn't make any sense to have 8bit DACs and only 4 volumes for 1bit noise/square waveforms. It also doesn't mention anything about being able to change the duty cycle of the square wave - is that correct?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...