Sine/DTMF Generator for VS1053?

Writing software that inputs and/or outputs audio and performs DSP algorithms such as filters, new codecs or audio effects.
Post Reply
winix
Senior User
Posts: 22
Joined: Thu 2014-01-09 9:55

Sine/DTMF Generator for VS1053?

Post by winix »

Hi all, I am trying to modify the Sine/DTMF Generator for VS1053, but the source code is actually for VS1003, is there a project for VSIDE that I could download? Or is there instruction for building for VS1053 using the command line tools?
winix
Senior User
Posts: 22
Joined: Thu 2014-01-09 9:55

Re: Sine/DTMF Generator for VS1053?

Post by winix »

Got it compiling and seems to be working. However, when I try to use the example from the VS1063 programming gude to output samples from the input, I don't get anything. Here is the code:

Code: Select all

#include <string.h>
#define STANDALONE
#include "vs1003.h"
#include <stdio.h>
#include <stdlib.h>

int count=0;
s_int16 testData[48]={0,391,776,1148,1499,1826,2121,2380,2598,2771,2897,2974,3000,2974,2897,2771,2598,2380,2121,1826,1499,1148,776,391,0,-391,-776,-1148,-1499,-1826,-2121,-2380,-2598,-2771,-2897,-2974,-3000,-2974,-2897,-2771,-2598,-2380,-2121,-1826,-1500,-1148,-776,-391};

s_int16 ApplAddr(register __i0 s_int16 **data, register __a1 s_int16 mode,
		 register __a0 s_int16 n) {
	static u_int16 multL, multR;
	switch(mode) {
		case APPL_RESET:
			multL = 32768;
			multR = 32768;
			return 0;
			
			break;
		case APPL_AUDIO:
			{
				int i;
				s_int16 *d = *data;
				for(i=0; i<n; i++)
				{
					count++;
					if(count==48)
					{
						count=0;
					}
				
					*d = testData[count];
					d++;
					*d = ((s_int32)(*d) * multR)>>15;
					d++;
				}
			}
			break;		
	}
    return n;
}
The test sine wave I make using the testData array is actually outputting, but it seems there is no input data. Am I missing some interrupt or anything like that?
winix
Senior User
Posts: 22
Joined: Thu 2014-01-09 9:55

Re: Sine/DTMF Generator for VS1053?

Post by winix »

Just wondering for this plugin to work and receive audio data, should the SCI_MODE set to PCM recording or something? I tried removing the plugin code and then put the SCI_MODE to SM_RESET | SM_ADPCM | SM_LINE1 I can hear the audio source. But when I enable the plugin again, it would just become sine wave again on one side, and nothing on the other.

Again, I don't need the source audio to go to output, this is just a test. What I want to do is to use the input and analyze it, and the output different sine waves accordingly.
User avatar
pasi
VLSI Staff
Posts: 2123
Joined: Thu 2010-07-15 16:04

Re: Sine/DTMF Generator for VS1053?

Post by pasi »

There are audio processing examples in VSIDE. Select a VS1053 solution template, then for example VS10X3 Audio Effects project template.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
winix
Senior User
Posts: 22
Joined: Thu 2014-01-09 9:55

Re: Sine/DTMF Generator for VS1053?

Post by winix »

Tried that sample, but have the same problem as this post, which is also going no where:
viewtopic.php?f=11&t=1153&start=20

The program would run normally on the prototype board and send from VSIDE, but when converted to C array from COFF file, and feed via SPI from an STM32 MCU, it would not run. The same feeding code is used for the EQ plugin, which works on both cases.

Very very frustrating...
User avatar
pasi
VLSI Staff
Posts: 2123
Joined: Thu 2010-07-15 16:04

Re: Sine/DTMF Generator for VS1053?

Post by pasi »

When the code is started by writing to the AIADDR register, your code starts with interrupts disabled. While loaded and started using VSIDE/vs3emu the code starts with interrupts enabled. So, you need an additional Enable(); to allow interrupts when loaded through SCI. The additional Enable() does not hurt when loaded through UART, so you can have it always.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Post Reply