Shop OBEX P1 Docs P2 Docs Learn Events
Bs2 Music Listen to this... — Parallax Forums

Bs2 Music Listen to this...

metron9metron9 Posts: 1,100
edited 2005-09-19 20:34 in BASIC Stamp
Using a capacitor, a resistor, a pizao speaker and an op amp with 14 lines of pbasic code I made a music machine.
Mind you its a bit gritty but with only 2000 instructions per second on the bs2 I think it's pretty good.
Recorded in sound forge using a RODE Mic and a jomeeki compressor. Could be used for some robot dance music perhaps?

Here are 4 short samples out of well actually about 65535 different pattarns you can play, and with only 14 lines of code and NO DATA, generated using simple math addition and subtraction. (I'm no good at that higher math stuff anyway)

www.stickerpub.com/bs2sound.wav

Comments

  • doggiedocdoggiedoc Posts: 2,239
    edited 2005-09-19 02:54
    That's got a Blues Funkish sound, huh! LOL! Reminds me of the old days with my Apple IIc and the "cricket" voice box.

    Could you post your code? I'd like to see how you did that.


    Thanks,
    Doc
  • metron9metron9 Posts: 1,100
    edited 2005-09-19 13:38
    If you play with this, post your DAC and amplifier circuit, I think that could be much better.

    Main:
     x=x+1
     ' change the value of z only after 2000 samples played
     ' Note, Try playing longer the patterns create fills etc...
     IF x=2000 THEN
      z=z+1
      x=0
      ' Beep inbetween samples
      FOR x=1 TO 100
       HIGH 15
       i=1
       LOW 15
      NEXT
      ' Wait 1/2 sec before next sample
      PAUSE 500
    
      x=0
     ENDIF
     lum=lum+z       'here the 16 bit pattern changes by adding Z
    SHIFTOUT 15,14,MSBFIRST,[noparse][[/noparse]lum\16]
    GOTO main
    
    
  • doggiedocdoggiedoc Posts: 2,239
    edited 2005-09-19 20:34
    Thanks - I'll try it.

    About the circuit. I've got some schematics for and LM386 amplifier circuit that I can do. I don't have a DAC circuit. Any pointers?

    Thanks!
    Doc
Sign In or Register to comment.