Another Noise Generator

Algorithm development and general DSP issues

Moderator: frank

Post Reply
amz-fx
Posts: 38
Joined: Wed Sep 06, 2006 7:06 am
Location: Louisiana, USA
Contact:

Another Noise Generator

Post by amz-fx »

I have written a 24-bit pseudorandom noise generator for the FV-1. It is a little different than the one that Frank posted and uses fewer instructions.

It should run for over 8.5 minutes without repeating.

Code: Select all

; 24 bit maximal period Galois LFSR
; Example by Jack Orman
; http://www.muzique.com
; March 5, 2015

; REG 0 : LFSR NOISE REGISTER
; REG 1 : OUTPUT BIT
;
EQU LFSR REG0
EQU TEMP REG1
;
; SEED THE LFSR WITH A NON-ZERO VALUE
SKP RUN,START
SOF 0,0.666   	; JUST TO ENSURE IT IS REALLY NON-ZERO
WRAX LFSR,0
;
;
START:
LDAX LFSR  		; GET LFSR REGISTER
AND 0x000001 	 ; GET LSB OF THE NOISE REGISTER
WRAX TEMP,0   	; SAVE BIT
RDAX LFSR,0.5    ; GET LFSR REG AND SHIFT RIGHT 1 PLACE
AND 0x7FFFFF     ; CLEAR MSB
WRAX LFSR,0   	; SAVE RESULT
LDAX TEMP   	  ; GET THE OUTPUT BIT
SKP ZRO,SHFTZRO	; IF 0 THEN JUMP
; IF LSB WAS SET THEN PROCESS
CLR      		  ; CLEAR ACC
LDAX LFSR   	  ; GET THE SAVED LFSR
XOR 0xD80000     ; TOGGLE THE MASK BITS
WRAX LFSR,0   	 ; SAVE IT
;
SHFTZRO:
LDAX LFSR
WRAX DACL,0 
For a REALLY long period before repeats, you could run a pair of these number generators and then combine the outputs in an alternating stop-and-go configuration to make the noise output.

Best regards, Jack
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Post by Digital Larry »

Thanks Jack! I'll see how this works out. It will be interesting to see if it works in my program's simulation mode.

DL
MacroMachines
Posts: 71
Joined: Fri Dec 12, 2014 10:45 pm
Location: Detroit,MI
Contact:

Post by MacroMachines »

@Digital Larry, it would rock to have a few options for noise generating in spin cad, also the SAH block would be a bit more useful if you could supply any trigger (noise trigger, noise sample, could get some reallllly nice granular chorus going)
http://MacroMachines.net
Digital Control for your Analog Soul.
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Post by Digital Larry »

Wait, I thought you were handling all block development from here on out!

:D
MacroMachines
Posts: 71
Joined: Fri Dec 12, 2014 10:45 pm
Location: Detroit,MI
Contact:

Post by MacroMachines »

Ive been mainly compiling loads of things in asm that I plan to port once I understand how to do the conversion into blocks and update my git. I have a bunch of potential blocks ready but still not sure I understand the process, or what questions to ask for clarification yet.
http://MacroMachines.net
Digital Control for your Analog Soul.
knutolai
Posts: 65
Joined: Wed Nov 23, 2016 9:43 am
Location: Bergen, Norway

Re: Another Noise Generator

Post by knutolai »

This noise generator has been so useful to me. Thank you so much Jack! I found a more efficient way to execute the same function that some of you may find useful. The benefits of this alternative method is that you only require one register (the LFSR reg) and that the new LFSR value is stored in the accumulator once the function has been computed. Remember to initialize the LFSR reg to a non-zero value on startup.

Code: Select all

ldax	LFSR		; Read LFSR reg 
AND	0x000001	; Get LSB of noise reg 
skp	ZRO, shiftzero	; if zero : don't toggle mask bits

clr			; clr acc (non-zero acc)
rdax	LFSR, 0.5		; Get LFSR, shift right 1 place
AND	0x7FFFFF		; Clear MSB
XOR	0xD80000	; Toggle MASK bits 

skp	NEG|GEZ, nwrite	; uncond. skp to storage
shiftzero:
rdax	LFSR, 0.5		; (acc = 0) Get LFSR, shift right 1 place
AND	0x7FFFFF		; Clear MSB
nwrite:
wrax	LFSR, 0		; store, clr
Post Reply