Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Scaled vibrato strategies?
2014-05-16 19:58
tlr

Registered: Sep 2003
Posts: 1790
Scaled vibrato strategies?

Do anyone of you have any good fast/compact vibrato strategies to share?

I'm aware of the basic difference from the neighbouring note technique but that is usually implemented in a slow way.

I'd like some pointers for more efficient stuff.
(Object code is fully acceptable)
2014-05-16 21:21
Stone

Registered: Oct 2006
Posts: 172
In the Prosonix player I use extended frequency tables (5 octaves below c#0). It's quite fast, but takes up more memory. The code gives about the same perceived vibrato level across the scale and looks something like this:

; x - voice
; y - instrument#
lda note,x
lsr
adc instrument_vib,y
tay
lda vib_lo,y
adc current_frq_lo,x
sta current_frq_lo,x
lda vib_hi,x
...

(The vib_lo table continues into the ordinary frq_lo table)

This code was written around 1988, so I'm sure somebody has come up with something better. I think Søren (Jeff) has done something similar though.
2014-05-17 06:53
Hein

Registered: Apr 2004
Posts: 954
For my musicroutine vibrato is part of the glissando/portamento subroutine.

So a vibrato table could look something like:

00 dpth 03
01 up   02
02 down 04
03 up   02
04 loop 01


Then the portamento subroutine does something like:

	;x=channel ($00,$07,$0e)
	;c=1 down / c=0 up
	
	lda v1_porta_lfo_depth,x
	and #$7f
	beq porta_program_set_values
	
	php	
	
	clc	;needs to be cleared, else vibo will not equalize
	adc v1_note_base,x	
	tay
	cpy #96
	lda #0
	bcc +
	lda freq_table_hi-96,y
+
	plp
	bcc +
	eor #$ff
+
	sta zp_idx_hi

	lda freq_table_hi,y
	bcc +
	eor #$ff
+	
	adc v1_freq_lo_buffer,x
	sta v1_freq_lo_buffer,x
	
	lda v1_freq_hi_buffer,x
	adc zp_idx_hi
	sta v1_freq_hi_buffer,x
	
	;... Do more freq stuff like finetune ...


With frequency tables:

freq_table_hi
	.byte $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01
	.byte $02,$02,$02,$02,$02,$02,$02,$03,$03,$03,$03,$03
	.byte $04,$04,$04,$04,$05,$05,$05,$06,$06,$06,$07,$07
	.byte $08,$08,$09,$09,$0a,$0a,$0b,$0c,$0d,$0d,$0e,$0f
	.byte $10,$11,$12,$13,$14,$15,$17,$18,$1a,$1b,$1d,$1f
	.byte $20,$22,$24,$27,$29,$2b,$2e,$31,$34,$37,$3a,$3e
	.byte $41,$45,$49,$4e,$52,$57,$5c,$62,$68,$6e,$75,$7c
	.byte $83,$8b,$93,$9c,$a5,$af,$b9,$c4,$d0,$dd,$ea,$f8
freq_table_lo
	.byte $07,$17,$27,$39,$4b,$5f,$74,$8a,$a1,$ba,$d4,$f0
	.byte $0e,$2d,$4e,$71,$96,$be,$e8,$14,$43,$74,$a9,$e1
	.byte $1c,$5a,$9c,$e2,$2d,$7c,$cf,$28,$85,$e8,$52,$c1
	.byte $37,$b4,$39,$c5,$5a,$f7,$9e,$4f,$0a,$d1,$a3,$82
	.byte $6e,$68,$71,$8a,$b3,$ee,$3c,$9e,$15,$a2,$46,$04
	.byte $dc,$d0,$e2,$14,$67,$dd,$79,$3c,$29,$44,$8d,$08
	.byte $b8,$a1,$c5,$28,$cd,$ba,$f1,$78,$53,$87,$1a,$10
	.byte $71,$42,$89,$4f,$9b,$74,$e2,$f0,$a6,$0e,$33,$20



It has the benefit that the vibrato table can be configured in any way, with different types of commands. The drawbacks are the memory usage of the vibrato table, and the fact that portamento programms are not available at the same time as vibrato. The latter can be circumvented by creating table entries like:

00 dpth 03
01 up   02
02 down 08
03 up   02
04 loop 01
2014-05-17 08:48
tlr

Registered: Sep 2003
Posts: 1790
Both are interesting.

If I understand hein correctly from my quick look he calculates the add value from the table msb.
$00-$5f = 00<msb>, $60-$bf = <msb>00.

Assuming that gets close to the desired widths it's very clever.

I'm a bit confused about what the optimal tracking for width would be. Is it proportional to the difference to the neighbouring note or is it proportional to the actual frequency?

Also, what do you do if the note changes during the vibrato? An add/sub approach with scaling can get lost in such cases?

I've also gone for a vibrato table approach btw, though mine is a bit more focused on flexibility than speed/size.
2014-05-17 12:54
Mixer

Registered: Apr 2008
Posts: 452
One strategy is to use single octave extended note table. Not the most efficient, but solves some problems.

Assume a frequency table of one octave of 0xc0 length where each 12-tet note is subdivided to 0x10 steps.

The note index will be the high nybble and low nybble will select the detune within one semitone another byte will contain the octave information.

One can then add together arpeggio offset, vibrato offset and portamento offset to that noteindex. And with that number as index - select the frequency value from the frqtable. Once the note frequency within one octave is found - the 16 bit value can be LSR'd or ASL'd to target octave.

To make portamento, one would add a constant value on the portamento offset until target is reached. Vibrato would alternate the vibrato offset between + and - deltas at given periods.

The advantage is that portamento and vibrato will scale right automatically over that exponential notescale.

The disadvantage is that it is slow. Example code is at http://6581.fi/sidwiki/doku.php?id=SID-Knowledge

I apologize that the code-example is missing the required frqtable and octavetable lists, however the idea is there for anyone to improve.

I'd be happy to add other discussed methods to the page as well.
2014-05-17 14:56
tlr

Registered: Sep 2003
Posts: 1790
Interesting solution. One problem is that the slide resolution is (only?) 16 steps per half tone. Another is that the vibrato will be slightly asymmetric as the positive half will be wider than the negative half. This might be perceived as a slight frequency shift upwards during vibrato.
2014-05-17 15:03
Soren

Registered: Dec 2001
Posts: 547
My later routines also use a finetune lookup method, by using extended notefreqtables. Got some additional routines to increase/decrease depth, in case I need that. But the lookup method is pretty fast as you only need to add the finetune values to the freqs of the note before storing in the sid registers.
I usually have a simple routine to handle the finetune values... something like 00,08,10,18,10,08,LOOP-CMD (direction changes after each time the loop happens, BUT one can also use nagative finetune values (over #$80)...
Something in that direction, afair :)
2014-05-17 15:25
Mixer

Registered: Apr 2008
Posts: 452
tlr: Interesting thought that bias, but I don't think that the vibrato will be perceived upward biased. It is the nature of frequency scale to be exponential. c4 to c#4 halftonedelta as register values is bigger than b3 to c4 halftone delta. If anything, this vibrato afaik can be more correct than the constant-delta addition-types.
2014-05-17 16:55
Stone

Registered: Oct 2006
Posts: 172
A classical guitar vibrato stretches the string along its length and so the vibrato centers around the note's frequency. When playing electric guitar, the string moves sideways and the vibrato will generally be biased toward higher frequencies, without it sounding out of tune, so I think that the shape of the waveform that the vibrato produces also matters. I have thought about experimenting with other vibrato shapes than the triangle waveform you get from alternately adding and subtracting a constant value. Haven't gotten around to it yet though.. Interesting topic!
2014-05-17 17:06
chatGPZ

Registered: Dec 2001
Posts: 11386
imho you *want* the vibrato being slightly out of tune - as that greatly contributes to the sound. its somewhat like tuning a 12 string guitar... with the secondary string being perfectly in tune with the first, it just sounds dull and non interesting :=P
2014-05-17 17:08
Soren

Registered: Dec 2001
Posts: 547
Oh yes, reminds me. My simple look-up method also allows me to shape the vibrato, if that wasn't clear from what I wrote.
Sometimes a square shaped vibrato can be a nice thing. Afair some of the grand old computergame composers also did that.
Normally I try to shape vibratos a bit towards a sine wave.
 
... 8 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
LordCrass
Guests online: 84
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.059 sec.