New sounds
Moderator: Moderators
New sounds
I read a text file some weeks ago, by viznut, in which he said that in 2003 some "new" sounds were discovered but it was not described how to hear them. So does anyone know what this discovery was all about?
- Mike
- Herr VC
- Posts: 4987
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
They have been described in the thread 'Music Theory on the VIC'. Take a look at there for a programming example.
Michael
Michael
- Mike
- Herr VC
- Posts: 4987
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Like, if it's really necessary to wait ~100 cycles to reset the waveform. For voice 3, something like this should suffice:
For voice 2, and voice 1, I'd use blocks of 2, or 4 STX/Y's to compensate for the octave shift. Here you'd only need 8 or 16 cycles to reset the waveform.
I'd interested if this routine would reliably reproduce these waveforms. As has been noted elsewhere, the waveform only needs to be resetted, when it should be changed, or there had been silence in between (MSB=0), but not when only the frequency is changed.
Michael
Code: Select all
SEI ; don't want an IRQ to mess up
LDA #desired frequency (MSB set)
LDX #$FE
LDY #$7E
STX $900C ; set a 0 bit to reset waveform (4 cycles)
STY $900C ; set a 1 bit
STX $900C or STY $900C ; depending on desired waveform
STX $900C or STY $900C
STX $900C or STY $900C
STX $900C or STY $900C
STX $900C or STY $900C
STX $900C or STY $900C
STX $900C or STY $900C
STA $900C ; establish desired frequency.
CLI
I'd interested if this routine would reliably reproduce these waveforms. As has been noted elsewhere, the waveform only needs to be resetted, when it should be changed, or there had been silence in between (MSB=0), but not when only the frequency is changed.
Michael
Yep. But remember that if you want to change the waveform while playing (e.g. PWM or at least change of "instrument"), you need the 100+ cycles of $7E, which in practise equals silence. For use in a tune, one would have to carefully consider how the tune is composed to afford those breaks. For a sound effect or just playing with one type of waveform, I'm sure its doable.
Anders Carlsson
- Mike
- Herr VC
- Posts: 4987
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
I've spotted an error in the routine, anyway. The highest frequency for voice 3 clocks in at 1 MHz/32, i.e. one needs to wait 32 cycles before applying another MSB. The output of the voices comes from a 8-bit linear shift feedback register. Suppose Bit 0 is shifted out as output this works similar to:
ROR register
and then either:
AND #$7F ; set MSB to 0, if MSB of voice register is 0,
or
EOR #$80 ; toggle MSB, if MSB of voice register is 1.
That means, to get the "polarity" right, it is necessary to flush the whole register ... , i.e. 8 times 32 cycles for voice 3. O.K., these *are* 128 cycles ..., and 256, or 1024 for voice 2, or 1. At first I thought it would suffice to stick a single 0-bit into the LSFR, but now I've disproved myself. Sigh.
ROR register
and then either:
AND #$7F ; set MSB to 0, if MSB of voice register is 0,
or
EOR #$80 ; toggle MSB, if MSB of voice register is 1.
That means, to get the "polarity" right, it is necessary to flush the whole register ... , i.e. 8 times 32 cycles for voice 3. O.K., these *are* 128 cycles ..., and 256, or 1024 for voice 2, or 1. At first I thought it would suffice to stick a single 0-bit into the LSFR, but now I've disproved myself. Sigh.
In the infamous first page of the 6562/63 datasheet, it says this chip (never produced) should have three waveforms and three amplitude modulators, programmable frequency (thank you) and programmable noise generator.
Dave Seiter seems to be the only person in the world who has a working 6562 chip, and according to the SWoC entry only the graphics capacities were improved?
In any case, I wonder if this pulse width anomaly observed and attempted to be controlled would be the basis for three waveforms? When it comes to amplitude modulators (volume?), I'd expect to see four of them unless the 6562 chip only was going to have three sound channels of which one alternated as noise, similar to how the later TED chip works.
Dave Seiter seems to be the only person in the world who has a working 6562 chip, and according to the SWoC entry only the graphics capacities were improved?
In any case, I wonder if this pulse width anomaly observed and attempted to be controlled would be the basis for three waveforms? When it comes to amplitude modulators (volume?), I'd expect to see four of them unless the 6562 chip only was going to have three sound channels of which one alternated as noise, similar to how the later TED chip works.
Anders Carlsson
-
- Vic 20 Hobbyist
- Posts: 143
- Joined: Thu Aug 25, 2011 10:04 am
I'm lost in the details... Would it be possible to set the waveform so it always outputs ones, allowing PWM on 36878 to be louder than modulating a small DC offset?Mike wrote:I've spotted an error in the routine, anyway. The highest frequency for voice 3 clocks in at 1 MHz/32, i.e. one needs to wait 32 cycles before applying another MSB. The output of the voices comes from a 8-bit linear shift feedback register. Suppose Bit 0 is shifted out as output this works similar to:
ROR register
and then either:
AND #$7F ; set MSB to 0, if MSB of voice register is 0,
or
EOR #$80 ; toggle MSB, if MSB of voice register is 1.
That means, to get the "polarity" right, it is necessary to flush the whole register ... , i.e. 8 times 32 cycles for voice 3. O.K., these *are* 128 cycles ..., and 256, or 1024 for voice 2, or 1. At first I thought it would suffice to stick a single 0-bit into the LSFR, but now I've disproved myself. Sigh.
Phil Ranger
-------------
"Don't eat the trees 2" for the VIC 20 : http://www.box.net/shared/u398kj0nr0lkauzm1k67
on line: http://www.mdawson.net/vic20chrome/vic2 ... otrees.prg
-------------
"Don't eat the trees 2" for the VIC 20 : http://www.box.net/shared/u398kj0nr0lkauzm1k67
on line: http://www.mdawson.net/vic20chrome/vic2 ... otrees.prg
- Mike
- Herr VC
- Posts: 4987
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
You could use two voices for this, which output the same frequency but are 180° off-phase. But this already works without resorting to the 'new' waveforms: you'd purge the LFSR of both voices first (to ensure a square wave is being output), enable the first voice, do a delay, and then enable the second voice exactly on the negative edge of the first voice.PhilRanger wrote:[...]set the waveform so it always outputs ones[...]
BTW, using the volume register in 36878 to output (4-bit) samples is PCM.
Back OT, the article 'VIC-I.txt' by Marko Mäkelä states, that the highest frequency in 36876 is f=Phi2/64. As the wave form repeats after 16 steps (8-bit LFSR with inverting feedback), this means one bit is output every 4 CPU cycles.
Which means, the first program I gave at the beginning of the thread is essentially correct, only 7 more STX $900C are necessary at the beginning to purge the LFSR. And this one:
... should also work.Mike wrote:For voice 2, and voice 1, I'd use blocks of 2, or 4 STX/Y's to compensate for the octave shift.
-
- Vic 20 Hobbyist
- Posts: 143
- Joined: Thu Aug 25, 2011 10:04 am
So I just need delay the launch of the 2nd oscillator just enough or do I need the more complex trick?Mike wrote:You could use two voices for this, which output the same frequency but are 180° off-phase. But this already works without resorting to the 'new' waveforms: you'd purge the LFSR of both voices first (to ensure a square wave is being output), enable the first voice, do a delay, and then enable the second voice exactly on the negative edge of the first voice.PhilRanger wrote:[...]set the waveform so it always outputs ones[...]
I'm thinking about trying PCM first (36878 full on then full off, controlling the duty cycle) then both PCM AND PWM to get better resolution than 4 bits...BTW, using the volume register in 36878 to output (4-bit) samples is PCM.
Phil Ranger
-------------
"Don't eat the trees 2" for the VIC 20 : http://www.box.net/shared/u398kj0nr0lkauzm1k67
on line: http://www.mdawson.net/vic20chrome/vic2 ... otrees.prg
-------------
"Don't eat the trees 2" for the VIC 20 : http://www.box.net/shared/u398kj0nr0lkauzm1k67
on line: http://www.mdawson.net/vic20chrome/vic2 ... otrees.prg
- Mike
- Herr VC
- Posts: 4987
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Yep. But first you need to disable both voices long enough to ensure their shift registers are cleared, and square waves are output after (re-)enabling them. If you don't do that, you might output a 'new' waveform by accident.PhilRanger wrote:So I just need delay the launch of the 2nd oscillator just enough ...
You'd possibly want to check with a scope, that the delay really puts both voices 180° off-phase.
Please take a look at Pulse Width Modulation and Pulse Code Modulation in Wikipedia: what you describe in parenthesis actually is PWM - provided you're using a fixed carrier frequency. A low-pass filter with a cut-off frequency well below the carrier frequency can then convert the duty cycle value into an analog level between the low and high level.I'm thinking about trying PCM first (36878 full on then full off, controlling the duty cycle) [...]
PCM however is not constrained to two output levels, also the output level is changed regularly at uniform intervals, there's no variant duty cycle involved.
You can combine both methods, sure - but before that, you should consider techniques like noise shaping. This method can easily add 1-2 bits (apparent) resolution to 4-bit samples, which have been dithered down from, say, 16-bit source samples; using PCM alone.
P.S. A related discussion can be found here in the thread 'Digitized sound + 2 spare channels possible?'.
-
- Vic 20 Hobbyist
- Posts: 143
- Joined: Thu Aug 25, 2011 10:04 am
Thanks
You are of course perfectly right, my fingers somehow disconnected from my brain. Should have been trying PWM first (I already did PCM before)I'm thinking about trying PCM first (36878 full on then full off, controlling the duty cycle) [...]
Already done that on a Journey song, posted the results here before...You can combine both methods, sure - but before that, you should consider techniques like noise shaping. This method can easily add 1-2 bits (apparent) resolution to 4-bit samples, which have been dithered down from, say, 16-bit source samples; using PCM alone.
[...]
PhilRanger wrote:GOT IT!!!
Some new sampling. It could have been anything, but I like Journey and this one is from 1983, so it fits
Needs 16kB RAM expansion. The main routine is 206 bytes, the rest is the highly compressed data. Keep in mind a standard mp3 file is typically several MB!!!
NTSC version:
http://www.box.net/shared/xt8zdtquo6iquixg5oqc
PAL version:
http://www.box.net/shared/ga3g2a2gfe93libhgzqj
Already read. Thanks again!P.S. A related discussion can be found here in the thread 'Digitized sound + 2 spare channels possible?'.
Phil Ranger
-------------
"Don't eat the trees 2" for the VIC 20 : http://www.box.net/shared/u398kj0nr0lkauzm1k67
on line: http://www.mdawson.net/vic20chrome/vic2 ... otrees.prg
-------------
"Don't eat the trees 2" for the VIC 20 : http://www.box.net/shared/u398kj0nr0lkauzm1k67
on line: http://www.mdawson.net/vic20chrome/vic2 ... otrees.prg