November 26, 2024, 09:10:38 PM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


AP-8 Docs Link (Includes Audacity Info)

Started by JonnyMac, August 14, 2007, 08:20:45 AM

Previous topic - Next topic

JonnyMac

August 14, 2007, 08:20:45 AM Last Edit: August 17, 2007, 11:36:07 AM by JonnyMac
-- http://www.efx-tek.com/downloads/ap-8_docs.pdf

Don't forget to try Audacity, our favorite freeware audio editor:
-- http://audacity.sourceforge.net

Good information here:
-- http://www.audacityteam.org/wiki/index.php?title=Main_Page

Our [basic] Audacity training document:
-- http://www.efx-tek.com/downloads/essential_audacity.pdf

... and training files for the document above:
-- http://www.efx-tek.com/downloads/audacity_demos.zip
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

Here's an AP-8 test program.

' =========================================================================
'
'   File....... AP-8_Test.BS1
'   Purpose.... AP-8 Features Test
'   Author..... EFX-TEK
'   E-mail..... teamefx@efx-tek.com
'   Started....
'   Updated.... 01 JUN 2006
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Demonstration program for the AP-8 Audio Player Board.  All commands are
' send to the AP-8 through a serial link at 2400 baud (OT2400 baudmode).
' The use of the open baudmode allows boards to be daisy-chained for up to
' 32 sounds from one I/O pin.
'
' Command syntax: "!AP8", address, cmd {, data}
' -- where 'address' is %00 to %11
' -- 'cmd' is a single character
' -- optional 'data' is a byte
'
' Valid commands:
'
'   "!AP8", address, "V"
'     -- requests version string from AP-8
'     -- should be followed by SERIN to receive three-byte string
'
'   "!AP8", address, "G"
'     -- retrieves current AP-8 status
'     -- should be followed by SERIN to receive one-byte status
'     -- status byte is bit-mapped:
'        * BIT7 : 1 = playing, 0 = idle
'        * BIT6 : 1 = soft looping (version 1.2+)
'        * BIT5 : 1 = single-shot play, 0 = hard loop select
'        * BIT4 : 1 = Record mode, 0 = Play mode
'        * BIT3 : reserved
'        * BIT2 : Segment switch 2
'        * BIT1 : Segment switch 1
'        * BIT0 : Segment switch 0
'
'   "!AP8", address, "P", segment
'     -- plays selected segment (0 - 7)
'     -- returns status (same as "G" command) -- may be ignored
'
'   "!AP8", address, "X"
'     -- stops AP-8 (if playing) at selected address
'
'
' Note: If ULN2803 interferes with serial transmission to RC-4, remove and
'       replace with ULN2003 (7 channels), leaving P7 contacts open.


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


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

SYMBOL  Sio             = 7


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

SYMBOL  Baud            = OT2400
SYMBOL  Addr            = %00


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

SYMBOL  id0             = B0                    ' also used to status
SYMBOL  id1             = B1
SYMBOL  id2             = B2
SYMBOL  segment         = B3                    ' loop control
SYMBOL  switches        = B4                    ' board switch settings
SYMBOL  ctrlChar        = B5                    ' used for Debug Home


' -----[ EEPROM Data ]-----------------------------------------------------


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

Reset:
  DEBUG CLS
  ctrlChar = 1                                  ' home


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

Main:
  SEROUT Sio, Baud, ("!AP8", Addr, "V")         ' get version
  SERIN  Sio, Baud, id0, id1, id2               ' receive ID string

Chec_Version:
  IF id2 = "2" THEN Demo_Error                  ' check version

Show_Version:
  DEBUG "AP-8 Version ", #@id0, #@id1, #@id2    ' display it
  PAUSE 2000
  DEBUG CLS

  FOR segment = 0 TO 7
    SEROUT Sio, Baud, ("!AP8", Addr, "P", segment)
    SERIN  Sio, Baud, id0                       ' clear auto status byte

Get_Status:
    SEROUT Sio, Baud, ("!AP8", Addr, "G")       ' get status
    SERIN  Sio, Baud, id0

    IF BIT4 = 1 THEN Mode_Error                 ' AP-8 in record mode

    switches = id0 & %00000111                  ' isolate switch bits
    IF switches <> %111 THEN Switch_Error       ' error if any closed

Show_Status:
    DEBUG #@ctrlChar                            ' home cursor
    DEBUG "Segment #", #segment, CR             ' show board status
    DEBUG CR
    DEBUG "Playing / Idle... ", #BIT7, CR
    DEBUG "Single / Loop.... ", #BIT5, CR
    DEBUG "Record / Play.... ", #BIT4, CR
    DEBUG "Segment Sw2...... ", #BIT2, CR
    DEBUG "Segment Sw1...... ", #BIT1, CR
    DEBUG "Segment Sw0...... ", #BIT0, CR

    IF BIT7 = 1 THEN Get_Status                 ' allow to finish
    PAUSE 1000
  NEXT

  DEBUG CLS, "Demo complete."
  END


Switch_Error:
  DEBUG CLS
  DEBUG "Please set AP-8 segment select", CR
  DEBUG "switches to OPEN, then restart", CR
  DEBUG "the program."
  END


Mode_Error:
  DEBUG CLS
  DEBUG "AP-8 is set to Record mode; please", CR
  DEBUG "move PLAY/REC jumper to PLAY."
  END


Demo_Error:
  DEBUG CLS
  DEBUG "Please use AP-8_Test_v1x2.BS1"
  END
Jon McPhalen
EFX-TEK Hollywood Office