Convolve Output Size

30 posts / 0 new
Last post
Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am
Convolve Output Size

I want to read in blocks of analogue audio from the jackplug on an STM32F769I Discovery card, convolve the audio with an impulse response, then output analogue audio from the second jackplug; but the Convolver will only permit an output size of 63, even when Shape is set to 2.  I need to be able to set the output size to be e.g. 4095, 8191...  How can I do this, please?

Axel Nilsson
Offline
Last seen: 6 days 8 hours ago
Joined: 12/19/2016 - 2:02pm

Hi Martin,

 

The output of the convolver is limited to (2*BS) - 1 samples, where BS is the input blockSize. So to increase the output of the convolver, you can increase the input blockSize to the module. One way to do this is to increase the blockSize at the hardware input pin by editing the blockSize field under the Build tab of the module's properties. 

 

Depending on your use case, you could also check out the FIR module, which has less constraints on the input block size and the impulse response length. 

 

Let us know if you have any other questions,

-Axel

 

Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am

My use-case is that I want to continuously read in analogue audio from a jackplug, convolve it with a 4096 length impulse response, then output result as analogue audio from the other jackplug.  I am not convinced that representing the convolution IR as an FIR filter will work in this case. Any advice on how to do this will be much appreciated.

Axel Nilsson
Offline
Last seen: 6 days 8 hours ago
Joined: 12/19/2016 - 2:02pm

Hi Martin,

 

Inserting your impulse response as the coefficients in the FIR filter should satisfy your use case. Have you tried this with an FIR module with length 4096?

 

-Axel

Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am

Thank you for your advice.  I have implemented my IR as an FIR filter, as you suggested.  The system is generated to read my test .WAV file, but when I click the Run button, I get an error: 'Starting audio failed  failed transmit error 0xffffd8f4'  What have I done wrong ?

Axel Nilsson
Offline
Last seen: 6 days 8 hours ago
Joined: 12/19/2016 - 2:02pm

How have you set up the system to read from the .wav file - using layout properties? Also, are you running on the native (aka. Windows) target? Playing audio from a file only works on Windows or Linux targets.

If you want to play a .wav file on your embedded hardware, try playing it with something like VLC on your PC while the STM USB audio device is selected and your layout is running in Designer. 

Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am

I am using Windows and the WAV file is OK.  I cannot see how to download the binary to my STM32F769 board; does my design have to have run correctly on the server first ?  If so, unless I can correct the error given above, AWE is not going to meet my Requirements.

Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am

Forget my last comment: I have found out what the error was.  The server was not seeing my soundcard; now it is, and my project runs correctly.  It would have been useful if the error message had been e.g. 'No Soundcard Detected' instead of 'Error 0xffffd8f4'. 

I have found the document 'STM32F769 Discovery Board Setup Guide' and followed its instructions.  I have created a new Project but it will not generate the output files.  I get the errors: 'module SYS_inter input pin 'in1' is not connected' and 'module SYS_inter input pin 'in2' is not connected'.  How do I fix this, please ?  Layout Properties is mostly greyed out.  Also, why is the sample rate for the STM32F769 fixed at 48KS/s, when the board can do 96 KS/s ?

Axel Nilsson
Offline
Last seen: 6 days 8 hours ago
Joined: 12/19/2016 - 2:02pm

Hi Martin,

 

The error you are getting while trying to generate the target files is pointing to an error in the layout you are using. Target files can only be generated for a layout that can be successfully built by Designer. Does the layout successfully build and run when you press the 'Run' button in Designer, or does it complain that some pins are not connected?

 

The sample rate for the STM32F769 is fixed at 48 KHz because that's what was chosen to be implemented in the reference BSP. If the hardware can support 96 KHz, then the BSP code can be updated to use that sample rate instead. 

 

 

 

Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am

I have solved the above problem.  The SYS_inter object was set to eight inputs; setting it to two and doing the same throughout the circuit permitted the system to Run and to generate the output files.  If the number of usable inputs is only two, 'Line In', then why was the layout defaulting to eight ?  I suggest that this be sorted out and that more meaningful error messages are given; this would improve usability for 'newbies' like myself.  Also, I prefer to run at 96 KS/s, not 48 KS/s.  Can this be changed by myself, or does this require new software from yourselves ?

Axel Nilsson
Offline
Last seen: 6 days 8 hours ago
Joined: 12/19/2016 - 2:02pm

Thanks for your feedback. For convenience, new layouts will default the number of input and output channels based on the currently connected target. Changing targets will not update the number of inputs and outputs in an existing layout. 

 

You can certainly change the reference STM32F769 BSP to use 96 KHz sampling rate rather than the 48 KHz. To this, you'll have to change the FIXED_SAMPLE_RATE definition in TargetInfo.h, and you will have to change the board configuration code to use the new sample rate. 

Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am

I have generated the target files and followed the instructions given in STM32F769 Discovery Board Setup Guide, but  I do not seem to have been able to write the code to the Discovery Board.  In the Flash Manager window, when the .AWB file is added, what do I do to put a bootable autonomously-running executable onto the Discovery board ?

 

Regards,

Martin Lawrence

Axel Nilsson
Offline
Last seen: 6 days 8 hours ago
Joined: 12/19/2016 - 2:02pm

Hi Martin,

 

The procedure for using the flash manager is documented in the 'Audio-Weaver--Flash-Manager-Guide.pdf' file, which is included in the Docs folder of your Designer installation. Have you followed these steps?

 

-Axel

 

Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am

Yes; I have this document.  Further inspection has shown that the flash memory is being amended, but no audio will pass through the board when restarted; I get the green flashing LED routine.  Something is either missing or wrong between the Flash Manager Guide and the STM32F769 Discovery Board Setup Guide documents.  If I erase the flash in STMLink but do not use Program and Verify, the STM32F769 board cannot be seen by AWE.  I have been using the SW4STM32.bin in STMLink Program and Verify.  Please advise.

Regards,

Martin Lawrence

Axel Nilsson
Offline
Last seen: 6 days 8 hours ago
Joined: 12/19/2016 - 2:02pm

When you say you erase the flash, do you mean you click the 'Full Chip Erase' option? Or do you mean you use the MX25L512G_STM32F769I-DISCO External Loader and do 'Sector Erase' to erase the external flash section? 

 

If you're using the Full Chip Erase, then that will erase the entire program from memory and you will need to Program and Verify with the provided .bin again to get the AWE Core to run on the target. 

 

The flash file system runs on the external flash on the target. It is recommended to use the External Loader and to do a 'Sector Erase' on your hardware to get a clean external flash before using the Flash Manager to add .awb's. 

Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am

The STM32F769 Discovery Board Setup Guide says to do a 'Full Chip Erase', so that is what I have been doing.  Given what you have stated above, this is wrong.  I will perform a 'Sector Erase' as you have recommended.

Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am

I have installed the External Loader, as you recommended, and performed a Sector Erase on the first seven sectors.  AWE no longer sees the target, so precisely how do I perform the Sector Erase ?

 

Regards,

Martin Lawrence

Axel Nilsson
Offline
Last seen: 6 days 8 hours ago
Joined: 12/19/2016 - 2:02pm

If AWE no longer sees the target, then the AWECore is not running. Have you flashed the .bin (Program and Verify) onto the hardware since the last Full Chip Erase?

 

 

Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am

After adding the AWB as a 'Compiled Script' and clicking on the 'Boot' radio button, the AWE Server message is : 'Successfully connected to target.  Waiting for script commands..'  CPU is 70.12%  There are no Errors reported on the AWE Server Errors tab.  The green LED keeps flashing but no audio passes through from Line In to Line Out.  Am I correct in assuming that both USBs do NOT have to be connected to the computer for my app. to run ?  I have to unplug one USB to plug in my external soundcard.

Regards,

Martin Lawrence

Axel Nilsson
Offline
Last seen: 6 days 8 hours ago
Joined: 12/19/2016 - 2:02pm

Hi Martin,

 

Does audio get passed through the layout if you run it form Designer instead of from the flashed .awb file? Debugging audio streaming issues is easier with Designer since you can monitor meters and sinks to see if audio is being passed in real time. You may also try putting a Sine Generation module in your layout to feed the output pin with a known audio signal, which might show you if there is an issue with the routing someplace. 

You are correct that you do not have to have both USB's connected to the target if you have a .awb flashed and bootable on the target. Only the power providing USB need be plugged in.

Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am

I tried your suggestion but with no result.  I have built a very simple layout that simply connects the two inputs to the outputs.  I went into STMLink and did a full erase of the flash, then Program & Verify.  I closed STMLink and opened AWE Designer.  The AWE server showed CPU usage at 70.16 %.  I added the .AWB of my test layout using AWE Sever Flash Manager.  CPU usage showed ' ---%' and '0' for all three heaps.  I connected Line In to an oscillator and plugged headphones into Line Out.  No sound was heard on the headphones.  I am using an external 5 volt power supply and both USBs were plugged into my PC.  The STM32F769 Discovery board was being seen by Windows, STMLink and AWE Server.   What am I doing wrong ?

Axel Nilsson
Offline
Last seen: 6 days 8 hours ago
Joined: 12/19/2016 - 2:02pm

Hi Martin,

 

Rather than flashing the .awb's onto the target using the Flash Manager, try just running a layout in Designer using the 'Run' button while the AWE Server is connected to your target. This will allow you to view inspectors in real time to see if audio is being passed into the system.

Using the router and multiplexor to update the audio routing, and looking at the Meter modules in a layout like the one below may help you find where the audio path is broken.

Binary Dataf769_audio_test.awd

 

Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am

I have just run f769_audio_test.awd as you suggested, but absolutely nothing appears to happen.  Please give me finely-detailed instructions of how to run this.

Regards,

Martin Lawrence

Axel Nilsson
Offline
Last seen: 6 days 8 hours ago
Joined: 12/19/2016 - 2:02pm

While the layout is running, you can double click on the meter modules in the .awd to see the audio level of each channel in the system. You can also open inspectors for the Router and Multiplexor modules the same way and manipulate the audio routing as desired. You can right click on each module and select help to get more understanding on how each of the modules work.

If the meter levels on the input channels are all muted, then either the audio routing in the BSP is broken or no audio is being sent to target. 

 

There is a 'Getting Started' section in the Audio-Weaver-Designer--Users-Guide.pdf file included in your Designer installation that you may find helpful, since it covers basic audio testing such as this. 

Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am

I have carried out your instructions given above.  Input from my oscillator is shown on channels 3 & 4.

Regards,

Martin Lawrence

Axel Nilsson
Offline
Last seen: 6 days 8 hours ago
Joined: 12/19/2016 - 2:02pm

Are you using the original .bin in the package, or have you modified the code and rebuilt new images with 96 KHz sampling rates?

Also, are you looking at all 8 input channels? See the STM32F769I Discovery Board User's Guide.pdf (p. 10) for details on what each channel contains. 

Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am

I am currently using the original .bin file, i.e. I am running at 48 KS/s.  I have managed to get my project working, analogue input to output, but the FIR convolution is causing the oscillator sinewaves to be turned into tonebursts.  If this cannot be 'cured', then the STM32F769 Discovery board with AWE Core is not suitable for my project.

Regards,

Martin Lawrence

Axel Nilsson
Offline
Last seen: 6 days 8 hours ago
Joined: 12/19/2016 - 2:02pm

Hi Martin,

 

Can you share the .awd file you are using?

-Axel

Martin Lawrence
Offline
Last seen: 1 week 3 days ago
Joined: 05/15/2019 - 8:55am

I have emailed two .AWDs to you.  Something else has just gone wrong: I wanted to add the file to the flash memory, but it no longer works; I just get a pulse on channel 1 of the input meter and the signal from my oscillator is not seen at all.

Regards,

Martin Lawrence

Axel Nilsson
Offline
Last seen: 6 days 8 hours ago
Joined: 12/19/2016 - 2:02pm

You can attach the .awd in your post, or you can email it to me directly.

 

Try doing a 'Format Flash' in the flash file manager to delete older files.