Shop OBEX P1 Docs P2 Docs Learn Events
playing musical notes — Parallax Forums

playing musical notes

justin weberjustin weber Posts: 36
edited 2009-01-18 14:36 in Propeller 1
Is there a simple way to play all the notes in a musical scale? I've tried HSS, but couldn't figure it out. and bs2.freqout is too loud and you couldn't build chords with it(no dual tone). I want to make a simple chord dictionary/metronome/tuner for a guitar. It should be possible to roughly tune an instrument using the built in microphone on the demo board. I don't know where to start. I do have the table of frequencies for the musical notes in a scale on page 605 in the hydra book, but almost all the examples in this book don't work with the demo board.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-01-16 19:12
    For the record, you can play dual-note chords with a BS2. The FREQOUT command can take one or two frequency arguments. Reducing the volume could be as simple as adding a pot or resistive divider. If you need microphone input, though, the Propeller would be the way to go.

    -Phil
  • RaymanRayman Posts: 14,826
    edited 2009-01-16 19:13
    I posted a dual tone generator a while ago, maybe that would help.

    You can find it on this page:
    http://www.rayslogic.com/propeller/Programming/dac/dac.htm

    ·
  • justin weberjustin weber Posts: 36
    edited 2009-01-16 19:14
    i have the propeller demo board, i bought the hydra book for reference, but alot of it doesn't work with a demo board, only the hydra. this is one of my problems. It seems simple to play a C or a C# or even a chord, but apparently it isn't. at least not for me.
  • RaymanRayman Posts: 14,826
    edited 2009-01-16 19:47
    justin:

    I've updated my previous post with a link to a code you might be interested in...
  • mparkmpark Posts: 1,305
    edited 2009-01-17 16:23
    Justin,

    It shouldn't be *that* hard to get Hydra code working on a demo board (says the guy without a demo board). Try this and report back:

    con
    _clkmode = xtal1+pll16x
    _xinfreq = 5_000_000
    SNDPIN = 10 ' I believe this is correct for a demo board
    
    obj
      snd   : "NS_sound_drv_052_11khz_16bit.spin"   'Sound driver
    
    pub Main
    
      snd.start( SNDPIN ) 
    
      snd.PlaySoundFM( 0, snd#SHAPE_SAWTOOTH, snd#NOTE_C4, snd#SAMPLE_RATE/1, 127, $37bf_ffff )
      waitcnt( clkfreq/4 + cnt )
      snd.PlaySoundFM( 1, snd#SHAPE_SAWTOOTH, snd#NOTE_E4, snd#SAMPLE_RATE/1, 127, $37bf_ffff )
      waitcnt( clkfreq/4 + cnt )
      snd.PlaySoundFM( 2, snd#SHAPE_SAWTOOTH, snd#NOTE_G4, snd#SAMPLE_RATE/1, 127, $37bf_ffff )
      waitcnt( clkfreq/4 + cnt )
      snd.PlaySoundFM( 3, snd#SHAPE_SAWTOOTH, snd#NOTE_C5, snd#SAMPLE_RATE/1, 127, $37bf_ffff )
    
    
    



    (Btw, fwiw, I couldn't figure out HSS either.)
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-01-17 17:11
    Change your SNDPIN to SNDPIN=7 if you are running that code with the Hydra.

    OBC

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

    Check out: Protoboard Introduction , Propeller Cookbook 1.4 & Software Index
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • kelvin jameskelvin james Posts: 531
    edited 2009-01-17 20:34
    Since i figured it already had all the basics, this is just a quick mod of Chip Graceys' seven demo. I commented out and changed values/ deleted some lines to generate a continuous tone. You can input the note from the CON listing on the basso line in the dat, and change the sound of the tone with the first set_formants of seven(pace).

    It was just an experiment to see if it would work, so if you wanted to spend some time, you could probably get the original program to do all sorts of things. I will see if i can figure out how to output a 4 note chord.

    For demo board. The vocal tract and stereo spat should be with the ide 1.2. Be careful with the ears if plugging direct to the demo board with headphones.


    Chip

    If you skim through this, the note " o3F " craps out for some reason. I haven't checked all of the them, just wondering why?
    And why with only the tenor track activted, that only the basso affects the note?

    **

    Post Edited (kelvin james) : 1/17/2009 10:59:11 PM GMT
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2009-01-18 14:36
    Justin,
    Raymond Allen has a lovely wav player http://obex.parallax.com/objects/324/ - plays wavs from an sd Card - it's pretty cool actually.


    Regards,
    John Twomey

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Necessity is the mother of invention'

    Those who can, do.Those who can’t, teach.
Sign In or Register to comment.