Author
|
Matrix TSL
|
Version
|
1.0
|
Category
|
Audio Output
|
WAV Library File component
Allows WAV files to be played or recorded using a file component to provide the data. Complete with buffer to allow for uninterrupted playback when performing other tasks. Playback compatible with analogue outputs such as DAC or PWM. Recording compatible with analogue inputs such as a Microphone.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_WAV_Player_FAT.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_WAV_Player_FAT.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
EndOfFile
|
EndOfFile
|
A simple check to see if we are at the end of the file. Returns 0 if we and not yet at the end fo the file. Returns 1 if we are at the end of the file.
|
- BOOL
|
Return
|
GetBitsPerSample
|
GetBitsPerSample
|
Returns the number of bits per sample during playback.
|
- BYTE
|
Return
|
GetNextSample
|
GetNextSample
|
Retreives the value for the next sample and auto increments the file pointer. Ideally this function should be called as part of a timer interrupt at the sample rate. The value returned should be passed onto a means of analogue output e.g. a DAC or PWM.
|
- UINT
|
Return
|
GetNumChannels
|
GetNumChannels
|
Returns the number of audio channels stored in the WAV file during playback.
|
- BYTE
|
Return
|
ProcessBuffer
|
ProcessBuffer
|
When Playing a WAV File - Fills the local data buffer from the SD card. When Recording a WAV File - Writes the local data buffer to the SD card. Must be called often enough to maintain playback or recording. Returns 0 for buffer OK 1 for buffer overrun
|
- BYTE
|
Return
|
PutNextSample
|
PutNextSample
|
Writes the value for the next sample and auto increments the file pointer. Ideally this function should be called as part of a timer interrupt at the sample rate. The value written should be collected using an analogue input such as a Mic.
|
- UINT
|
Sample
|
|
- VOID
|
Return
|
StartPlayback
|
StartPlayback
|
Start playing a WAV file from the SD card. Use the GetNextSample and EndOfFile macros to read out the contents of the file. Use the ProcessBuffer macro to maintain the local buffer. Returns 1 if file found and opened, else returns 0.
|
- STRING
|
Filename
|
WAV Filename e.g. "Test.wav"
|
- BYTE
|
Return
|
StartRecording
|
StartRecording
|
Start recording a WAV file to the SD card. Use the WritetNextSample macro to write the contents of the file. Use the ProcessBuffer macro to maintain the local buffer. Returns 1 if file created and opened, else returns 0.
|
- STRING
|
Filename
|
WAV Filename e.g. "Test.wav"
|
- BYTE
|
BitsPerSample
|
Number of bits per sample - 8 or 16
|
- ULONG
|
SampleRate
|
Sample Rate in Hz e.g. 8000 for 8KHz
|
- BYTE
|
Return
|
StopRecording
|
StopRecording
|
|
- VOID
|
Return
|
Property reference
|
Properties
|
|
LinkTo
|
|
|
Buffer Size
|
The number of RAM bytes to allocate to the WAV buffer. The buffer must be big enough to store enough WAV audio samples to maintain playback or recording when doing other program tasks or performing SD card read/write operations.
|
|
Memory Type
|
|