PDA

View Full Version : playing musical notes



justin weber
01-17-2009, 02:51 AM
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.

Phil Pilgrim (PhiPi)
01-17-2009, 03:12 AM
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

Rayman
01-17-2009, 03:13 AM
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 weber
01-17-2009, 03:14 AM
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.

Rayman
01-17-2009, 03:47 AM
justin:

I've updated my previous post with a link to a code you might be interested in...

mpark
01-18-2009, 12:23 AM
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)
01-18-2009, 01:11 AM
Change your SNDPIN to SNDPIN=7 if you are running that code with the Hydra.

OBC

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

Check out: Protoboard Introduction (http://jeffledger.googlepages.com/Protoboard_Introduction.pdf) , Propeller Cookbook 1.4 (http://ucontroller.com/Propeller%20Protoboard%20Designs%20for%20the%20Beg inner.pdf) & Software Index (http://forums.parallax.com/showthread.php?p=770318)
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us (http://propeller.warrantyvoid.us)
Got an SD card connected? - PropDOS (http://www.orrtech.net/propdos/)

kelvin james
01-18-2009, 04:34 AM
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

QuattroRS4
01-18-2009, 10:36 PM
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.