Shop OBEX P1 Docs P2 Docs Learn Events
Multichannel Wavetable Music Player — Parallax Forums

Multichannel Wavetable Music Player

RaymanRayman Posts: 14,597
edited 2008-12-14 16:58 in Propeller 1
Here's a little music player that I ported from this page:
http://elm-chan.org/works/mxb/report.html

It was not exactly easy to convert the code...

Anyway this plays his demo song with 4-channels of wavetable sound.

Actually, only the attack phase is wavetable, the rest is just decaying sine...

It sounds pretty good... Give it a try!

Update:· Here's a new version (xmasmusic7a.spin) that adds the other two demo songs from the above website...

Post Edited (Rayman) : 12/12/2008 2:23:04 AM GMT

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-12-11 18:34
    Made my day.. [noparse]:)[/noparse]

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with a Propeller Protoboard?
    Check out: Introduction to the Proboard & Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • JetfireJetfire Posts: 34
    edited 2008-12-11 18:56
    This looks cool. Two questions though.

    What is fullduplexserial doing?

    How do you define what you want to play?
  • RaymanRayman Posts: 14,597
    edited 2008-12-11 19:37
    You can delete the fullduplexserial... That was just for early stage debugging...

    The song is defined in the "melody" byte table. Just a cut and paste job from the code found on the page from the link in my first post.
    It's just a simple series of word time stamps followed by bytes of notes with a bit to indicate the last note of the current time stamp...
  • RaymanRayman Posts: 14,597
    edited 2008-12-12 02:21
    I've just added a newer version to the first post that adds 2 new songs (and removes fullduplexserial dependence).
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-12-12 02:26
    Hey Ray, Now you just need to add the midi object from OBEX and have it read .mid files from SD. [noparse]:)[/noparse]

    Neat player!

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with a Propeller Protoboard?
    Check out: Introduction to the Proboard & Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • mparkmpark Posts: 1,305
    edited 2008-12-13 06:34
    Anyone get this to work on the HYDRA yet? I changed

    CON _clkmode = xtal1 + pll8x
    _xinfreq = 10_000_000 '80 MHz

    and in Main I changed the pins

    Player(7,17)

    but I'm hearing nothing. What am I missing?
  • RaymanRayman Posts: 14,597
    edited 2008-12-13 11:36
    I think I have the output pins hardcoded in this section:

    'setup parameters
    DMaskR long 0 'right output mask
    OPinR long 10 'right channel output pin # ' <
    Change Right pin# here !!!!!!!!!!!!!!
    DMaskL long 0 'left output mask
    OPinL long 11 'left channel output pin # ' <
    Change Left pin# here !!!!!!!!!!!!!!
  • william chanwilliam chan Posts: 1,326
    edited 2008-12-13 13:46
    Is this player supposed to sound like piano or some other instruments?

    Can I set both left and right to the same pin? ( I have only one speaker )

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.fd.com.my
    www.mercedes.com.my
  • RaymanRayman Posts: 14,597
    edited 2008-12-13 14:41
    I think it was meant to sound like a music box...

    just comment out this line:

    OR DIRA, DMaskL

    to just use the right pin...
  • mparkmpark Posts: 1,305
    edited 2008-12-13 16:11
    Thanks Ray, it's working now.
  • tpw_mantpw_man Posts: 276
    edited 2008-12-14 16:21
    Cool! I've wanted to make one, but never really figured out how to change the pitch without changing the playback time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I am 1011, so be surprised!


    Advertisement sponsored by dfletch:
    Come and join us on the Propeller IRC channel for fast and easy help!
    Channel: #propeller
    Server: irc.freenode.net or freenode.net
    If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-12-14 16:52
    @tpw_man:
    Yup, thats is exactly the problem I ran into with waveplayer too...

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with a Propeller Protoboard?
    Check out: Introduction to the Proboard & Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • tpw_mantpw_man Posts: 276
    edited 2008-12-14 16:58
    I am thinking of averaging, but I'm not sure how to magically average it just right. Averaging is easy, but figuring out how to recursively average to achieve the desired result is the hard part.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I am 1011, so be surprised!


    Advertisement sponsored by dfletch:
    Come and join us on the Propeller IRC channel for fast and easy help!
    Channel: #propeller
    Server: irc.freenode.net or freenode.net
    If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
Sign In or Register to comment.