VS1010 RecPlayExample

Designing hardware and software for systems that use the VS1010 MP3 Audio DSP Microcontroller.
Post Reply
User avatar
Henrik
VLSI Staff
Posts: 1201
Joined: Tue 2010-06-22 14:10

VS1010 RecPlayExample

Post by Henrik » Fri 2019-07-26 14:55

Hello!

I present you with the first pre-release of a new VS1010 program collection, the VS1010 RecPlayExample.

The RecPlayExample shows an example of an Voice / MP3 player that can also record voice files in 8 kHz IMA ADPCM WAV format to SD cards. If connect to a PC through USB, the player shows up as a High-Speed USB disk. The demo software is intended to be run on the VS1010 Developer Board, where it uses buttons B0 through B3, as well as the Green LED1 and Red LED3.

Instructions on use are below:

Code: Select all

RecPlayExample is collection of programs that can play back MP3 music files
and WAV voice files, and record WAV voice files at 8 kHz IMA ADPCM WAV files
at 32 kbit/s. The example is designed to run on the VS1010 Developer Board.

To use, copy all .dlx files in this package to your S:SYS folder, then
create a S:CONFIG.TXT file with the three following lines:
TreePlayer2
RecADPCM
@

The software has four modes. Button B0 switches between modes 0-3. Mode 4 is
activated by connecting the board to a PC through USB.
1) Voice playback mode (.WAV files)
2) MP3 playback mode (.MP3 files)
3) Voice recording mode (.WAV files)
4) Computer file copy USB mode

1) Voice playback mode, indicated by Green Led LED1:

When in pause mode, LED1 is lit, when playing LED1 blinks.

Control buttons are:
- B0 short: Next mode
- B1 short: Pause on/off
- B2 short: Previous file
- B2 long: Volume up
- B3 short: Next file
- B3 long: Volume down

If the board is connected to a PC through UART, USB mode is activated.


2) MP3 playback mode, indicated by Green Led LED1:

When in pause mode, LED1 is lit, when playing LED1 blinks.

Control buttons are the same as in Voice playback mode.

If the board is connected to a PC through UART, USB mode is activated.


3) Voice recording mode, indicated by Green and Red Leds LED1 & LED3.

Voice recorder starts in pause / monitoring mode.

Control buttons are:
- B0 short: Next mode
- B1 short: Record / Stop
The playback part of RecPlayExample uses Aleksi's Music Player from here as its basis:
viewtopic.php?f=15&t=2430

I hope this piece of software is useful, or at least a good starting point for your own projects!

Kind regards,
- Henrik
Attachments
RecPlayExample001.zip
VSIDE solutions with binaries. Copy all .dlx files to S:SYS/
(178.65 KiB) Downloaded 178 times
REC0011.WAV
Example file recorded with VS1010 RecPlayExample
(18.31 KiB) Downloaded 161 times
Good signatures never die. They just fade away.

User avatar
Henrik
VLSI Staff
Posts: 1201
Joined: Tue 2010-06-22 14:10

Re: VS1010 RecPlayExample v0.10

Post by Henrik » Tue 2019-08-06 13:26

Hi!

Back from the holidays with a new version 0.10 of RecPlayExample, the Voice Recorder / Voice/MP3 player for the VS1010 Developer Board. There are several new features and changes to this version:
  • The Voice Recorder has now an option to record at 16 kHz instead of 8 kHz. 16 kHz is the new default.
  • There is a new Project, RecPlay.dlx, which acts as a Master Control Program for the other Solutions. A looping config.txt is no longer required.
  • All the VSIDE Solutions are collected to one big Solution with several Projects.
  • Some cleanup of the code.
The relevant part of the README.TXT provided in the package is quoted below:

Code: Select all

                  RecPlay 0.10
                  ------------
                   for VS1010
            2019-07-26 VLSI Solution



INTRODUCTION

RecPlay is a collection of projects that can play back MP3 music files and
WAV voice files, and record WAV voice files at 8 kHz IMA ADPCM WAV files
at 32 kbit/s. The example is designed to run on the VS1010 Developer Board.

To use, copy all six .dlx files in this package to your S:SYS/ folder. If
you want the project to start automatically, create a S:CONFIG.TXT file with
the following line:
RecPlay

Alternatively, you can start the project by booting the VS1010 Developer
Board, then pressing Enter to get to the command mode, then giving the
following command to the prompt:
VS1010>RecPlay

When you start RecPlay, you will be greeted with the following message:
*** RecPlay v0.10, welcome! ***
followed by more messages.



HOW TO USE

The software has four modes. Button B0 switches between modes 0-3. Mode 4 is
activated by connecting the board to a PC through USB.
1) Voice playback mode (.WAV files)
2) MP3 playback mode (.MP3 files)
3) Voice recording mode (.WAV files)
4) Computer file copy USB mode

1) Voice playback mode, indicated by Green Led LED1:

When in pause mode, LED1 is lit, when playing LED1 blinks.

Control buttons are:
- B0 short: Next mode
- B1 short: Pause on/off
- B2 short: Previous file
- B2 long: Volume up
- B3 short: Next file
- B3 long: Volume down

If the board is connected to a PC through UART, USB mode is activated.


2) MP3 playback mode, indicated by Green Led LED1:

When in pause mode, LED1 is lit, when playing LED1 blinks.

Control buttons are the same as in Voice playback mode.

If the board is connected to a PC through UART, USB mode is activated.


3) Voice recording mode, indicated by Green and Red Leds LED1 & LED3.

Voice recorder starts in pause / monitoring mode.

Control buttons are:
- B0 short: Next mode
- B1 short: Record / Stop


To exit the RecPlay software, push Esc at any time.



SELECTING VOICE RECORDING SAMPLE RATE AND BIT RATE

This version records by default at 16 kHz, which creates ADPCM files of
approximately 65 kbit/s. Alternatively, the software can record at 8 kHz,
halving the file sizes. To select between these two options, you may
change the definition of the symbol HIGH_SAMPLE_RATE in the RecAdpcm
project file main.c. The ramifications are as follows:

If HIGH_SAMPLE_RATE is set:
- Use 16 kHz recording sample rate.
- Recording bit-rate is approximately 64.9 kbit/s.
- Example file: docs/Recording_16kHz.wav.

If HIGH_SAMPLE_RATE is not set:
- Use 8 kHz recording sample rate.
- Recording bit-rate is approximately 32.4 kbit/s.
- Example file: docs/Recording_08kHz.wav.

The example files are actual RecPlay recordings made in normal office
conditions using the on-board MEMS microphone provided on the VS1010
Developer Board. No post-processing or other tricks have been applied.



PROJECTS IN THE RECPLAY SOLUTION

There are several projects in this solution, all needed to get RecPlay
working properly. They are listed below:
- RecPlay.dlx: Wrapper calling TreePlayer2 and RecAdpcm
- TreePlayer2.dlx: A player program for voice .WAV and MP3 playback
- RecAdpcm.dlx: An IMA ADPCM .WAV recorder program
- ums.dlx: Usb Mass Storage device driver for when connected to PC
- USBPROBE.dlx: Probe what is connected to USB
- USBHDD.dlx: USB Host driver for a situation where a USB stick is inserted
To get an idea of the bit-rates, if using a small 8 GB SD card, and recording at 16 kHz, the total voice recording time is over 11 days. At 8 kHz, total voice recording time is over 22 days.

As usual, I hope this software package is useful to you!

Kind regards,
- Henrik
Attachments
RecPlayExample010.zip
RecPlay v0.10. Read the README.TXT for instructions on how to use.
(224.4 KiB) Downloaded 159 times
Recording_08kHz.wav
An example IMA ADPCM recording made with the 8 kHz option.
(21.81 KiB) Downloaded 161 times
Recording_16kHz.wav
An example IMA ADPCM recording made with the new 16 kHz option.
(50.06 KiB) Downloaded 156 times
Good signatures never die. They just fade away.

User avatar
Henrik
VLSI Staff
Posts: 1201
Joined: Tue 2010-06-22 14:10

Re: VS1010 RecPlayExample v0.20

Post by Henrik » Wed 2019-09-18 12:05

Hello!

Attached to this message is version 0.20 of RecPlayExample, the Voice Recorder / Voice/MP3 player for the VS1010 Developer Board. This version contains the following enhancements:
  • Added 24 kHz recording option to the older 8 and 16 kHz options, and made it the default mode.
  • Enhanced low frequency reproduction of 16 kHz recording.
  • Moved sample rate configuration to RecAdpcm/configure.h.
  • Included newest versions of TreePlayer2, USBPROBE, and USBHDD. This greatly enhances compatibility with different USB memory stick brands.
  • Re-recorded example audio samples, and added 24 kHz to the collection. Tehy are also separately attached to this message.
A summary of the recording sample rate options and their file sizes is presented in the table below.
Adpcm.png
Adpcm.png (16.68 KiB) Viewed 3860 times

I hope this version provides useful to you!

Kind regards,
- Henrik
Attachments
RecPlayExample020.zip
RecPlay v0.10. Read the README.TXT for instructions on how to use.
(295.65 KiB) Downloaded 173 times
Recording_08kHz.wav
An example IMA ADPCM recording made with the 8 kHz option.
(17.06 KiB) Downloaded 147 times
Recording_16kHz.wav
An example IMA ADPCM recording made with the 16 kHz option.
(39.06 KiB) Downloaded 133 times
Recording_24kHz.wav
An example IMA ADPCM recording made with the all-new 24 kHz option.
(54.31 KiB) Downloaded 138 times
Good signatures never die. They just fade away.

User avatar
Henrik
VLSI Staff
Posts: 1201
Joined: Tue 2010-06-22 14:10

Re: VS1010 RecPlayExample v0.30

Post by Henrik » Thu 2020-10-29 19:41

Hello!

Here is a new and updated version of the VS1010 Recorder / Player.

There was a significant bug in the old version, namely that it could only be run from the SD card. This new version can also be run from SPI Flash. Note that if running any software from SPI Flash, it is highly recommended you first install the SPI Flash Writing Patch from http://www.vsdsp-forum.com/phpbb/viewto ... =15&t=2620!

The project contains a README.TXT file which you should read if interested in the project as well as a few recording examples to demonstrate how it sounds. The audio recordings are also available as direct links in the previous message.

Kind regards,
- Henrik
Attachments
RecPlayExample030.zip
(271.42 KiB) Downloaded 44 times
Good signatures never die. They just fade away.

krdarrah
User
Posts: 4
Joined: Tue 2021-01-19 19:39

Re: VS1010 RecPlayExample

Post by krdarrah » Yesterday 3:37

Hello, I am trying to get this example to work on MEMS Channel 0 - MD0/MCO which is preparation for for testing on the 48-pin IC. I have simply air wired a MEMS microphone to these pins on the demo board and changed the code in the StartMicrophone() function
from this:

Code: Select all

  
GpioSetAsPeripheral(0x09); //MD1
GpioSetAsPeripheral(0x0a); //MC1
PERIP(MEMSMIC_CF) = MEMSMIC_CF_SELIO | MEMSMIC_CF_ENA;
PERIP(PERIP_CF) |= (1 << 2); //Enable MC1 clock generation
to this:

Code: Select all

GpioSetAsPeripheral(0x01); //MD0
GpioSetAsPeripheral(0x1E); //MC0
PERIP(MEMSMIC_CF) |= MEMSMIC_CF_ENA;
PERIP(PERIP_CF) |= (1 << 1); //Enable MC0 clock generation
But I wonder if this line should also change?

Code: Select all

PERIP(FAUDIO_SEL) = 2; //Route MEMS mic to fast audio read register
maybe something else in this example needs to change?

Couple observations to note:
- I do see the 3MHz signal on the MC0 pin and also what looks like data on MD0
- Powering MEMS from IOVDD ~3.2V and this is the same mic used on demo board: CMM-4737DT-26186-TR with L/R pulled low as well
- It does record files with length and size that appears to be right, but there is no audio.

Also in the IntAdIntC(void) function, I added a debug printf just before this line:

Code: Select all

printf("%i\n", *p);
ApplyMicGainAndLimit(p, samples);

With the idea that maybe we can see if the audio data is correctly being passed into FAUDIO_L from the MEMS mic. Interestingly, on the existing example using MD1/MC1, the data is random and reacts as expected when speaking into the demo board mic. When running with modified code using MD0/MC0 and the air-wire mic, the data is pinned at -4, so seems that either the data is not being read from the microphone, or it is failing to route through the FAUDIO registers.

User avatar
Henrik
VLSI Staff
Posts: 1201
Joined: Tue 2010-06-22 14:10

Re: VS1010 RecPlayExample

Post by Henrik » Yesterday 8:29

krdarrah wrote:
Yesterday 3:37
Hello, I am trying to get this example to work on MEMS Channel 0 - MD0/MCO which is preparation for for testing on the 48-pin IC.
To me it looks that you have tried the correct things. Or, at least, I cannot find any outright errors in what you have done.

One thing that you could still try, with combinations of the other things you've done, it do modify IntAdIntC() to read from register FAUDIO_R instead of FAUDIO_L.

If this doesn't help, we will verify the situation with a board of our own, to see how to get the system working.

Kind regards,
- Henrik
Good signatures never die. They just fade away.

krdarrah
User
Posts: 4
Joined: Tue 2021-01-19 19:39

Re: VS1010 RecPlayExample

Post by krdarrah » Yesterday 9:18

Thanks Henrik,
Yes tried those combinations as well with no success... also tried just for fun setting PERIP(FAUDIO_SEL) = 0; and that results in reading all 0's instead of -4. Just thinking this might be related. If any other ideas, just let me know - will try in the morning. Thanks

Post Reply