Jump to content
Wookie

Has anybody played around with digitized sound?

Recommended Posts

I just saw the youtube video showing the Simpson's digitized sound demo and I was wondering how it was done. Has anybody played around with digitized sound effects on the Lynx?

 

-wookie

Share this post


Link to post
Share on other sites

Not yet, but as far as i know HandyMusic supports streaming digitized sound directly from the cartridge. The HSPL offered the ability to include samples as well, but I believe that they are read in-memory. Not sure on this though. Check the samples I recently shared. One has digitized speech in it.

BTW, did you see this post: http://atariage.com/forums/topic/208856-simpsons-for-the-lynx/

Share this post


Link to post
Share on other sites

Yes, of course. This is only great (to me) since it is my code/player/converter :-)

I enjoy coding the most, when all parts are my own. So no external libs/tools (to some extent at least).

Share this post


Link to post
Share on other sites

 

And BLL contains playback routines for packed and unpacked digi sound.

 

What do you exactly mean by packed and unpacked? When playing digitalized sound in my game, I'm converting my samples to mono and the smallest bitrate I can (I think 8khz), and this is it (I keep a 8k buffer to dynamically load all sort of stuff, digi sound included... that means a maximum playing length of 2 top 3 seconds... :D).

 

But now you're saying there is the possibility to compress them? tell me more :) Thanks!

Share this post


Link to post
Share on other sites

I had a delta packer (lossy) for the samples using only 4 bit to define the delta between the current sample and the next one.

The problem is: I cannot find the packer anymore :( When packing the sound you have to take the error into account.

 

See sample.inc:

***************
* packed Mono-Sample
***************
PlayMono::    lda SmpSema
    bne .no_read
    dec SmpSema
    jsr ReadByte
    sta SmpTemp2
    REPT 4
    lsr
    ENDR
    tax
    clc
    lda tabelle,x
    adc SmpTemp
    sta SmpTemp
    sta $fd22

.cont1    inc DigiCount
    beq .next0
    END_IRQ
.next0    inc DigiCount+1
    beq .next1
    END_IRQ
.next1    inc DigiCount+2
    beq StopSampleIRQ
    END_IRQ

.no_read    stz SmpSema

    lda SmpTemp2
    and #$f
    tax
    clc
    lda tabelle,x
    adc SmpTemp
    sta SmpTemp
    sta $fd22
    END_IRQ

tabelle    DC.B 128,-64,-32,-16,-8,-4,-2,-1,0,1,2,4,8,16,32,64

Share this post


Link to post
Share on other sites

In Always winter, never Christmas you can choose Elvis in the bar. He will sing Jailhouse rock as digitized sound at 4kHz.

  • Like 1

Share this post


Link to post
Share on other sites

Can someone explain to me how to create sample at 4khz?

I can't go under 8khz mono, which leads to playing time of a just a couple of seconds with my 8kb buffer :(

Edited by LordKraken

Share this post


Link to post
Share on other sites

You can just type in 4000 in Resample. The lowes preset value is 8000.

 

When I make the Elvis tune I just wrote it all in C. If you want to know why I set isfrog=0 30 times so it is the delay for one sound value.

 

int Bl17()
{
    unsigned char *musa;
    unsigned int i;
    unsigned char j;
    unsigned char isfrog;
    musa = elvis;
    abc_samplemode(0);
    abc_setvolume(0, 255);
    for (i = 0; i < 21000; i++) {
       for (j = 0; j < 30; j++) {
           isfrog = 0;
       }
       abc_out(0, *musa);
       musa++;
    }
    abc_setvolume(0, 0);


    return 11;
}

And the ad-hoc audio modules:

 

void abc_setvolume(char chan, int volume)
{
        wanted_volume[chan] = (char) volume;
        VOLUME_REG(chan) = (char) volume;
}


void abc_out(char chan, char sample)
{
        OUT_REG(chan) = sample;
}


void abc_samplemode(char chan)
{
        // Disable count
        CTLB_REG(chan) = 0x0;
        CTLA_REG(chan) = 0x10;
        STEREO_REG = 0;
}
Edited by karri
  • Like 1

Share this post


Link to post
Share on other sites

Here is an updated version of WAV2LSF with source and Windows .exe.

 

Changes:

- Added "-c" option that outputs the "LSF" sound data as a C file (.h or .c) (for easier workflow)

- Made it a bit more user-friendly w.r.t usage "help" and error messages

 

TODO:

- Handle 16-bit WAV files (as some audio editors can't output 8-bit WAV)

- Output "packed" sample data as C code

- Include C and ASM code for packed sample player

 

If needed, I can put it on my github.

 

Coming soon: Final version of my Bezerk clone, faster and now with VOICE! (hence the detour into "updating" WAV2LSF).

 

Credits to Bastian for the original WAV2LSF.

wav2lsf_1.1.zip

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...