Binary modulation - part 2
utz
translated by Lord Vader
Table sound effects
Table effects (such as arpeggio
or envelopes) are made quite simply and
educational - and you should learn about it.
Let's look at how the note counter usually changes
in the sound cycle:
(example 8)
loop
... ;sound output
dec bc ;BC - length counter
ld a,b
or c ;reached 0?
jr nz,loop
Although usually the sound loop
'must' contain a constant number like this─
tov, changing the note length counter to two
reception usually gets away with:
(example 9)
loop
... ;sound output
dec c ;low byte of note length
jr nz,loop
(...) ;here you can use some more code
djnz loop;note length high byte
In this way we speeded up the internal process a little─
early sound cycle, and as a bonus
now you can do different tricks before
decreasing the high byte of the counter - ska─
Well, change the fill factors fromat─
measure 7. Or anything else. But don't be impudent:
50-80 cycles here is a reasonable maximum.
This works because the period from ko─
which executes this additional code,
is approximately 61 Hz for audio
cycle in224 cycles - almost inaudibly─
in the infrasound range. Even from a large distance
our bass speakers modulate with such frequency─
you are unlikely to hear it. However, if your
the sound cycle is much faster than the notorious ones
224 clock cycles, this approach can ruin
sound.
Noise
I already mentioned that in Squeeker plus up to─
turned up the noise. Now the noise is quite rare─
occurs in beeper engines,and musicians─
they complain that they can’t do it because of this
good drums. This is a mess, because the semi─
It's pretty easy to make noise. Are you thinking about the service─
tea values from ROM? Even easier! Here
how to get noise in just8 clock cycles:
(example 10)
add hl,de;update the channel adder
;(as usual)
rlc h ;RNG for the poor in 8 clock cycles
...
Yes,RLC H after updating the adder
channel - quite enough for more or less
decent semblance of white noise. Of course
we need a suitable constant inDE, but it
easily selected. For example, for224-tacto─
of the second engine with a frequency table, built
at 440 Hz, note frequencies in the range C-4..
C-6 give suitable constants for DE.
The disadvantage of this method is that it is impossible to
produce a noticeable change in noise pitch, but
still better to havesuch noise as no noise,
really?
Of course, if you try, you can
change the noise level, at the cost of higher consumption─
yes bars. The main idea is with the help of pre─
scaler skip adder updates:
(example 11)
ld b,mask;skip mask:
;#AA - skip every 2nd update
loop
rlc b
jp nc,_skip
add hl,de
rlc h
_skip
...
Doesn't look very good. Still looking for a way
Better yet, if you have any ideas, please share!
Phasers and shimomania
After creating my Squeeker Plus, I
became interested in the Shiru Phaser engine. me
I was wondering if it was possible to combine the technique
this engine with my Squeeker.
Phaser's technique is as follows:
(example 12)
loop
add hl,de;update the adders
ld a,h ;and compare them with
cp #80 ;fill factor
sbc a,a ;(as usual)
ld ixl,a ;save the result
add iy,bc;another adder
ld a,iyh ; everything as usual
cp #80
sbc a,a
xor ixl ;xorim 2 results
out (#fe),a
...
jr loop
Depending on the relationship between de─
liters in DE and BC there are different
'phase' effects that can be heard in
Shiru "Phaser1" engine. Later it turned out
that by replacingXOR with OR or AND, you can semi─
read another set of original tones.
This modification has already been used in traffic─
kah Phaser2 and PhaserZ.
Obvious disadvantagePhaser's consists of
that it eats a lot of cycles and takes
many registers. Fortunately, my Squeeker is not
very picky about bars, and even the registrar─
We managed to save the files into buffers in memory.
Surprisingly, the total effect of both me─
Todov exceeded expectations! The result was
new engine called PhaseSqueek. He
has wide sound capabilities
(for example, it has table effects for
all sound parameters), but in practice
it's almost useless since it's the only one
method of writing music in it - with numbers in IS─
walker. Maybe someday there will be a re─
dactor supporting this engine.
Inspired by the PhaseSqueek engine, I
began to find out what else could be achieved from
Phaser method. Working on HoustonTracker2
(my tracker for graphing calculators
TI:http://irrlichtproject.de/houston ), I
came up with some tricks for modulating co─
fill factor and now decided com─
combine them with the Phaser method. So,
Meet "Earth Shaker"!
(example 13)
ld b,#80 ;fill factor
loop
add hl,de ; it’s clear that
ld a,#4 ;modulation coefficient
;filling
xor b ;called "Earth Shaker"
ld b,a;new coefficient!
cp h; apply this coefficient as
sbc a,a;usually
out (#fe),a
...
jr loop
In most cases this 'modulation'
will give a disgusting parasitic tone. But when
very small modulator values (for example,
1..3), you get chords! This modulation
I called it "Earth Shaker" because... similar mo─
Dulation is the basis of the beeper of the same name─
new engine. Of course, in this engine things
things are a little more complicated (due to which it seems─
It appears that2 almost independent cameras appear─
nal). More specifically, modulators with
effective value less than unity. This
quite expensive in cycles and not suitable
for the "channel alternation" method (see above).
Playing further with such modulators, I
discovered another trick that gives a very ori─
ginal sound. The point issynchronization
duty cycle modulation c basic─
distinct frequency (tone) that is played in
modulated channel, like this:
(example 14)
ld b,#10;see. example 13
loop
add hl,de
sbc a,a;synchronize with tone
;channel
and #20;so coefficient modulation
xor b ;will happen once
;for tone period
... ;then again as in example 13
As a result, hearing appears in the sound─
subharmonics (half the tone frequency,
quarter, etc.), and the sound resembles
Hammond organ. The larger the value of the mode─
lations for the fill factor, the si─
flatter effect. I ended up combining it
with Phaser and got an engine called
PhaserX, another fun sounding engine,
not applicable in practice. In this engine I
did another trick that I've already used─
called earlier, namely SIDsound. The point is
that in the above codexor b changes
onadd a,b and modulator 1 or is used
2. Almost the same effect is achieved in
Phaser during installationBC=DE+/-1.
By the way, you can adjust the coefficient
filling and in the Phaser method (without comparison
coefficients), for this frequency
channels are set to the same weight─
identity(BC=DE) , but the adders have different
initial values(HL, IY) .
Simplified tone generation
After I learned about spo from Shiru─
set the phase fill factor─
In this way, I began to think about the differences─
important things around and around sound synthesis.
The end of these reflections was marked by this
code:
(example 15)
add hl,de
ld a,h
out (#fe),a
How? What does such a strange code give? Otherwise,
that by setting the divisor inDE to less than #1000, we
we obtain some symmetric meander in
beat the beeper. It turns out thatresolution
such synthesis is only12
bit (exactly the same resolution in AY, so
that everything is fine). If every note is
the track directly stores this divisor
(and this is exactly what you should do, because lookup
according to the table it takes time and adds no─
which noise), then we have4 additional─
new (yet) unused bits for side─
no information. What if you adapt them
to store the duty cycle?
(example 16)
add hl,de
ld a,h
add a,#8;offset 0..#10
;(cf. IY/HL in example 12)
xor h ;make 'phase' xor
out (#fe),a
This method allows you to set the coefficient─
filling rate using the phase method (as
described in the previous chapter). What matters is that
the second divider and the second adder are from─
are present, with the missing second
the divisor “coincides” with the first one, but is absent─
the second adder “has” always constant─
a clear offset relative to the first one.
Let's add controlover harmonic─
mi, even with more flexibility than in the method
"Earth Shaker"?
rrca ;subharmonic,
;1st harmonic with rlca, etc.
or h
Let's play some more with different nepos─
with clear Z80 commands?
daa
and h
Go for it.
It became clear to me that in such a simplified way─
a new generator can be added practically
any algorithm that is possible
strike, and it will give some interesting effect─
fekt. At the end of2016 I did just that -
wrote the wtbeep engine, which offers
32 algorithms switchable on the fly. In us─
Currently I continue to develop such
'simplified' approach, also playing with the control system─
advanced digital engine(see example 5).
Conclusion
Quite a long time in the past 1-bit─
This music was in the shadow of the 'real' chip-
music. Beeper has always been considered inferior─
a kind of "poor man's game". By
analogy we can say that Squeeker is
"poor man's guitar", and zbmod - "amizh─
Poor man's Paula." Next
step,which I was striving for, should have
become "the poor man's FM synthesis". However,
after writing wtbeep, I realized one thing: finally─
Well, 1-bit music has matured (about─
the process of growing up began with Tritone engines,
Phaser and the like). I think it's a beeper─
music has already reached such a level that
there is no need to repeat any other things in it─
goy synthesis method. She deserved her own─
natural name - binary modulated
synthesis.
Links
http://www.randomflux.info/1bit
('1-bit' beepers forum)
https://github.com/utz82/
ZX-Spectrum-1-Bit-Routines
(all my engines)
https://soundcloud.com/irrlicht-project
(sound of beeper engines)
https://utz82.github.io/bintracker/
(open cross-platform tracker
with low level audio drivers
and front-end for Music Data Abstraction
Language (MDAL))
Share your thoughts about the article