May 16, 2024, 11:00:27 AM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


Sound System

Started by Karl Fields, April 07, 2011, 10:30:16 PM

Previous topic - Next topic

Karl Fields

Again a big thanks to EFX for this one!

We have been a member of an antigue cooperative for 20+ years. Each of us works a couple days a month and one of the never ending battles is sound. Whoever is working tends to put the various radios on their music selection, not what's best for the shop. Nothing like shopping for antiques and having the Beastie Boys blaring out front and AC/DC in the back rooms! Really sets the atmosphere, you know? :)

Well I put in an AP16+ randomly playing 15 tunes on it. worked fine unless you were working for more than an hour. The repeats were driving us crazy.

Put in a prop1 controlling the AP16+ with a program Jon wrote. It takes 100 songs and plays then in a pseudo random fashion. Then I put it all in a project box, hardwired it to AC (of course I used a fuse ;D) and left the volume controls and speaker connections inside the box.

So now it turns on with power to the shop, plays for about 5 hours before a repeat and nobody can mess with it!! Life is better in the shop....
Thanks Jon!!
' =========================================================================
'
'   File...... KF_AP16_Randomizer.BS1
'   Purpose... Randomizes up to 100 files (for Karl Fields)
'   Author.... Jon Williams, EFX-TEK
'   E-mail....
'   Started...
'   Updated... 26 JAN 2011
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Sio             = 7                     ' SETUP = UP; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN


' -----[ Constants ]-------------------------------------------------------

SYMBOL  Baud            = OT2400                ' baud jumper out

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  FILES           = 100                   ' SFX00.WAV - SFX99.WAV


' -----[ Variables ]-------------------------------------------------------

SYMBOL  status          = B0                    ' status (B0 for bit access)
SYMBOL   Playing        = BIT7                  ' 0 = idle, 1 = playing

SYMBOL  filenum         = B2
SYMBOL  last            = B3
SYMBOL  ch10            = B4
SYMBOL  ch01            = B5

SYMBOL  lottery         = W5


' -----[ Initialization ]--------------------------------------------------

Reset:
  PINS = %00000000                              ' clear all outputs
  DIRS = %00000000                              ' make P0-P5 outputs

  last = -1
  lottery = 1031

  DEBUG CLS, "Karl Fields Randomizer", CR, CR


' -----[ Program Code ]----------------------------------------------------

Main:
  RANDOM lottery                                ' randomize
  filenum = lottery // FILES                    ' 0 to FILES-1
  IF filenum = last THEN Main                   ' no repeats
    last = filenum                              ' save for next time

  ch10 = filenum / 10 + "0"                     ' 10s digit
  ch01 = filenum // 10 + "0"                    '  1s digit

  SEROUT Sio, Baud, ("!AP16", %00, "PW", "SFX", ch10, ch01, 13, 1)

  DEBUG "Playing file: ", #filenum, CR

Check_Status:
  PAUSE 1000                                    ' don't crowd buffer
  SEROUT Sio, Baud, ("!AP16", %00, "G")         ' get status
  SERIN  Sio, Baud, status

  IF Playing = Yes THEN Check_Status            ' let song finish

  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------



' -----[ User Data ]-------------------------------------------------------