Shop OBEX P1 Docs P2 Docs Learn Events
Simple and Fast audio driver for propeller - 44.1KHz 2 channel 16 bit — Parallax Forums

Simple and Fast audio driver for propeller - 44.1KHz 2 channel 16 bit

aempireiaempirei Posts: 6
edited 2008-04-08 15:54 in Propeller 1
heres an audio driver that i wrote.

the sample rate playback is adjustable and tested up to 44100 Hz

it takes in 2 channel 16 bit unsigned PCM data

it plays back on 2 adjacent pins

this demo also requires the setup of a SD card

its based on SPIN WAV Player Ver. 1a (Plays only mono WAV at 16ksps) by Raymond Allen


- aempirei

AIM: ambient empire

Comments

  • drazmodrazmo Posts: 21
    edited 2008-04-08 04:16
    Do you have a sample clip to use? I get lots of static using 16 bit unsigned 44100Hz stereo file.
  • hippyhippy Posts: 1,981
    edited 2008-04-08 15:54
    Haven't tried it but it looks interesting. Looking at your PASM DAC code ...

            rdword val, ptr         ' get new channel 1 frequency
            wrword zero, ptr
    
            shl val, #13
            add val, nominal  
    
            mov frqa, val
    
            add ptr, #2             ' increment to channel 2
    
            rdword val, ptr         ' get new channel 2 frequence
            wrword zero, ptr
    
            shl val, #13
            add val, nominal  
    
            mov frqb, val
    
    
    



    Although minor points and may not affect or improve operation here, consecutive hub accesses aren't speed efficient, it's better to interleave instructions between them when you can, updating FRQA and FRQB simultaneously would be preferable from a purist viewpoint.

    Something like ..

            rdword vala, ptr         ' get new channel 1 frequency
     
            shl vala, #13
            add vala, nominal  
    
            wrword zero, ptr
    
            add ptr, #2             ' increment to channel 2
    
            rdword valb, ptr         ' get new channel 2 frequence
     
            shl valb, #13
            add valb, nominal  
    
            wrword zero, ptr
    
            mov frqa, vala
            mov frqb, valb
    
    
    



    Also ... Is zero the best value to write to word[noparse][[/noparse]ptr] ? Can that not be a valid data item ?

    Post Edited (hippy) : 4/8/2008 4:03:14 PM GMT
Sign In or Register to comment.