Amen brother ~ 6 bit audio @ 16.3kHz

Basic and Machine Language

Moderator: Moderators

User avatar
pixel
Vic 20 Scientist
Posts: 1353
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Amen brother ~ 6 bit audio @ 16.3kHz

Post by pixel »

Drank some window cleaner and out came this: ;) http://hugbox.org/pixel/external/denial/amenbrother.prg

Untested on real hardware and VICE spoils the show probably due to a missing low-pass filter.

Rock'n rumble!
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
armypavarmy
Vic 20 Hobbyist
Posts: 107
Joined: Wed Oct 02, 2013 1:54 am
Location: Italy

Re: Amen brother ~ 6 bit audio @ 16.3kHz

Post by armypavarmy »

Hello,
Tested on my real vic20 PAL and NTSC

WORK OK....No Problem

Armando
User avatar
pixel
Vic 20 Scientist
Posts: 1353
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: Amen brother ~ 6 bit audio @ 16.3kHz

Post by pixel »

armypavarmy wrote:Hello,
Tested on my real vic20 PAL and NTSC

WORK OK....No Problem

Armando
Awesomest! :D
Thanks a bunch! Video anybody to show off?
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
armypavarmy
Vic 20 Hobbyist
Posts: 107
Joined: Wed Oct 02, 2013 1:54 am
Location: Italy

Re: Amen brother ~ 6 bit audio @ 16.3kHz

Post by armypavarmy »

Hello
as soon as I can I prepare videos.
With vic 20 NTSC raster bar
they are very beautiful and colorful.
The sound is ok ... just the volume a bit 'low.
Armando.
User avatar
pixel
Vic 20 Scientist
Posts: 1353
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: Amen brother ~ 6 bit audio @ 16.3kHz

Post by pixel »

Seems to be the trade-off. And it's already boosted with a HF carrier.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
User avatar
pixel
Vic 20 Scientist
Posts: 1353
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: Amen brother ~ 6 bit audio @ 16.3kHz

Post by pixel »

And here's the code. Don't hate me. I'm an open-source guy and that cannot be fixed.

Code: Select all

restart:                                                                                                                                                                      
    lda #<sample
    sta @(+ 1 +l)
    lda #>sample
    sta @(+ 2 +l)
    ldx #0
l:  ldy sample,x
    nop
    lda vals0,y
    sta $900e
    inx
    beq +n
    nop
    bit $ea
    lda vals3,y
    sta $900e
    cpy #$00
    beq -restart
    nop
    bit $ea
    lda vals1,y
    sta $900e
    inc $900f
    bit $ea
    lda vals2,y
    sta $900e
    jmp -l

n:  nop
    nop
    lda vals3,y
    sta $900e
    cpy #$fe
    beq -restart
    nop
    bit $ea
    lda vals1,y
    sta $900e
    inc @(+ 2 -l)
    bit $ea
    lda vals2,y
    sta $900e
    jmp -l

mkval:
    tya
    beq +r
    cmp #16
    bcs +l
    ldy #0
    rts
l:  sec
    sbc #16
    tay
    lda #15
r:  rts

;    fill @(- 256 (mod *pc* 256))

main:
    sei
    lda #$7f
    sta $912e       ; Disable and acknowledge interrupts.
    sta $912d
    sta $911e       ; Disable restore key NMIs.

    lda #0
    sta $9002

    lda #<generated_code
    sta ptr_code
    lda #>generated_code
    sta @(++ ptr_code)

fast6:
    jsr audio_boost
    ldx #0
l:  txa
    lsr
    lsr
    tay
    jsr mkval
    sta vals0,x
    jsr mkval
    sta vals1,x
    jsr mkval
    sta vals2,x
    jsr mkval
    sta vals3,x
    inx
    bne -l

    jmp -restart

    fill @(- 256 (mod *pc* 256))
sample:
@(@ [? (== 0 _) 1 _] (@ #'char-code (string-list (subseq (fetch-file "amen.wav") 44 (* 26 1024)))))
    $00

    fill @(- 256 (mod *pc* 256))
vals0:  fill 256
vals1:  fill 256
vals2:  fill 256
vals3:  fill 256
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: Amen brother ~ 6 bit audio @ 16.3kHz

Post by groepaz »

what funky assembler is that? :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
pixel
Vic 20 Scientist
Posts: 1353
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: Amen brother ~ 6 bit audio @ 16.3kHz

Post by pixel »

groepaz wrote:what funky assembler is that? :)
Well… https://github.com/SvenMichaelKlose/bender It sucks. Not sure why I'm using it.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
User avatar
pixel
Vic 20 Scientist
Posts: 1353
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: Amen brother ~ 6 bit audio @ 16.3kHz

Post by pixel »

Dad's dangling at the Fukitol pump. Nothing doesn't matter shite anymore. Am relieved.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
tonyrocks
Vic 20 Hobbyist
Posts: 118
Joined: Mon Jan 04, 2016 10:17 pm
Website: http://www.tonyrocks.com
Location: Pittsburgh
Occupation: IBM Watson Engr

Re: Amen brother ~ 6 bit audio @ 16.3kHz

Post by tonyrocks »

awe man, can't somebody youtube this for me? :)
Tom
Vic 20 Amateur
Posts: 63
Joined: Mon Jun 06, 2016 9:07 am

Re: Amen brother ~ 6 bit audio @ 16.3kHz

Post by Tom »

I used it to fix a bug in my emulator; my low-pass filter wasn't actually taking effect due to a two-line error. So this is how it'll sound in the next release, and I think it's probably accurate.

So: Youtube link.

It's very quiet though, as mentioned above. Turn your speakers up.
User avatar
pixel
Vic 20 Scientist
Posts: 1353
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: Amen brother ~ 6 bit audio @ 16.3kHz

Post by pixel »

Tom wrote:I used it to fix a bug in my emulator; my low-pass filter wasn't actually taking effect due to a two-line error. So this is how it'll sound in the next release, and I think it's probably accurate.

So: Youtube link.

It's very quiet though, as mentioned above. Turn your speakers up.
Lovely!
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
User avatar
pixel
Vic 20 Scientist
Posts: 1353
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: Amen brother ~ 6 bit audio @ 16.3kHz

Post by pixel »

Tom wrote:I used it to fix a bug in my emulator; my low-pass filter wasn't actually taking effect due to a two-line error. So this is how it'll sound in the next release, and I think it's probably accurate.

So: Youtube link.

It's very quiet though, as mentioned above. Turn your speakers up.
Which emulator is it, BTW?
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
User avatar
Noizer
Vic 20 Devotee
Posts: 297
Joined: Tue May 15, 2018 12:00 pm
Location: Europa

Re: Amen brother ~ 6 bit audio @ 16.3kHz

Post by Noizer »

How can it work with 6bit resolution? Volume register 900E has only 4bits available. Please explain the function
Valid rule today as earlier: 1 Byte = 8 Bits
-._/classes instead of masses\_.-
User avatar
pixel
Vic 20 Scientist
Posts: 1353
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: Amen brother ~ 6 bit audio @ 16.3kHz

Post by pixel »

Noizer wrote: Fri Sep 04, 2020 4:54 am How can it work with 6bit resolution? Volume register 900E has only 4bits available. Please explain the function
Four pulses for each sample which add up. Doesn't give you 6 bits with 64 values really but more like 61 values. Close enough.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
Post Reply