electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » Microcontrollers and Programmable Logic
STM32F746G Discovery Board from STmicroelectronics
Post new topic   Reply to topic Moderators: State Machine
Page 5 of 5 [113 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: Previous 1, 2, 3, 4, 5
Author Message
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 22430
Location: The Netherlands, Enschede
Audio files: 216
G2 patch files: 319

PostPosted: Sun Dec 10, 2017 5:22 am    Post subject: Reply with quote  Mark this post and the followings unread

Delete, why?

They seem interesting examples still of what can be done.

But it is all up to you :-)

_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1585
Location: West Red Spot, Jupiter
Audio files: 190

PostPosted: Wed Dec 13, 2017 7:55 am    Post subject: Reply with quote  Mark this post and the followings unread

My MIDI Karplus-Strong synth operates at 16 voices with the following features:

- 16 Voices of polyphony EDIT: now 32 voices
- Loop filter control
- Precision tuning across it's 8 octaves of range (8 octaves when bender is used at +12 / -12 semitones).
- Automatic sustain extension for higher notes
- Sustain extension for all notes controlled with a CC
- Pluck pulse filter control
- Pluck pulse length control as a ratio of wave length from 0.2 to 0.5
- Pitch bend up to +12 / -12, allows non symmetrical settings such as up 3 and down 2.
- Mix raw KS signal with wave shaper produced frequency doubler. This actually adds an octave to the range making it a 9 octave instrument. The frequency doubled signal may be used alone and it carries a very similar waveform to the source signal so it still sounds like what your timbre settings are.
- Three "voice" sine LFO modulated chorus effect with speed and depth controls
- An age (since pluck) and pitch create an estimate a rough amplitude for each voice playing. The largest number determines the voice that is stolen and it will more likely be the voice that has the least actual amplitude. This hides a lot of voice theft.

I will be posting some samples later.

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima

Last edited by JovianPyx on Tue Dec 19, 2017 2:43 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1585
Location: West Red Spot, Jupiter
Audio files: 190

PostPosted: Thu Dec 14, 2017 8:07 pm    Post subject: Reply with quote  Mark this post and the followings unread

Here is a sample of me keyboardsturbating (it's not good...) but there are timbre changes in it so it shows a bunch of what the instrument can sound like. If you played it, I'm sure it would sound better Very Happy

The file started out as a 23 minute recording that I edited (out the crap) down to about 13 minutes. Feel free to skip forward, there are timbre changes every so often.

Yes I know I need to filter pitch messages (I can hear that).

Anyway, this is what it sounds like. I'll do a more appropriate demo in a bit.

ADMINISTRATORS - PLEASE DO NOT PUT THIS ON THE RADIO.


ks16_demo-01.mp3
 Description:
This is a demo of what this synth can sound like. Musically, not so good... sorry.

Download
 Filename:  ks16_demo-01.mp3
 Filesize:  12.69 MB
 Downloaded:  69 Time(s)


_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1585
Location: West Red Spot, Jupiter
Audio files: 190

PostPosted: Fri Dec 15, 2017 4:06 pm    Post subject: Reply with quote  Mark this post and the followings unread

For 2 recordings of Mozart's Rondo a'la Turk using this instrument go here:

http://electro-music.com/forum/topic-69449-0.html&postdays=0&postorder=asc&highlight=

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1585
Location: West Red Spot, Jupiter
Audio files: 190

PostPosted: Tue Dec 19, 2017 2:39 pm    Post subject: Reply with quote  Mark this post and the followings unread

The synth now operates with 32 voices configured.

I'd had some problems with optimization flags and just now got it working with -O3 (previous best was -Og and -O1,-O2 and -O3 didn't work (that is, no sound, no MIDI LED).

Once I found the problem in my C code, -O3 began to work and then I was able to increase the voice count to 36. Backed off to 32 so that the MIDI controller can provide lower latency.

The .bin file is 56548 bytes.

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1585
Location: West Red Spot, Jupiter
Audio files: 190

PostPosted: Wed Jan 03, 2018 8:22 am    Post subject: Reply with quote  Mark this post and the followings unread

I am back on the warpath regarding the use of ARM Cortex-M7 DSP instructions. I was digging through the ST stuff I downloaded and noticed HTML documentation of CMSIS drivers. There are library files (.lib) there as well. Looking at 06_DSP_theory.pdf, there are references to DSP instructions such as the MAC. I'm getting the impression that by using the proper library and it's functions, many DSP operations can be accelerated.

I will do some experiments with different simple DSP functions like linear interpolation or simple IIR filters and then examine the binary file to see if MAC instructions are actually found.

Is anyone else using these libraries - such as arm_cortexM7lfsp_math.lib (Little endian and Single Precision Floating Point Unit on Cortex-M7)?

I'll post back here with results of this.

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1585
Location: West Red Spot, Jupiter
Audio files: 190

PostPosted: Wed Jan 03, 2018 11:21 am    Post subject: Reply with quote  Mark this post and the followings unread

I couldn't figure out how to use the .lib file with gcc, but I found libarm_cortexM7lfsp_math.a and was able to get a simple benchmark working to compare the performance of the standard sqrt function and the one supplied by the above library file. The standard sqrt is 19.5 times slower (optimization set to -O3), so there is a definite advantage to using this library. In a disassembly, I do find the vsqrt.f32 instruction. Next I will try a filter to see if MACs are used. This is again with a simple makefile project, so only what is supplied free by ST is needed.
_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1585
Location: West Red Spot, Jupiter
Audio files: 190

PostPosted: Thu Jan 04, 2018 4:30 pm    Post subject: Reply with quote  Mark this post and the followings unread

In looking through the CMSIS DSP library supplied, I didn't find much besides the fast square root useful. Either the vector dot product function or the linear interpolator function appeared to be able to do a low pass single pole IIR filter. I tried to use the vector dot product to do this and it turns out that writing it in C is about 4 times faster than the vector dot product DSP function. These functions are all written to process blocks of data (where I would like to process one sample at a time), so there is likely looping overhead that is bogging it down. Unfortunately, the source code doesn't appear to be available for the library.

Given this, I've taken a plunge at writing inline assembly language for a single pole low pass IIR filter. I've been able to do some simple things (change the value of two C variables) so I'd like to try the filter and see how that goes. If it works, I'll benchmark it against a C version and report back to this thread.

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1585
Location: West Red Spot, Jupiter
Audio files: 190

PostPosted: Fri Jan 05, 2018 7:49 pm    Post subject: Reply with quote  Mark this post and the followings unread

Here's a demo that shows a lot more of what this synth can do.


rec_20180105-170415_a.mp3
 Description:
A wild demo of my KS32 (STM32F746) synth

Download
 Filename:  rec_20180105-170415_a.mp3
 Filesize:  3.58 MB
 Downloaded:  162 Time(s)


_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1585
Location: West Red Spot, Jupiter
Audio files: 190

PostPosted: Mon Jan 08, 2018 6:57 am    Post subject: Reply with quote  Mark this post and the followings unread

I've managed to get an inline assembly language filter working, but it didn't go as I had expected. First, the assembly code is slower than the C code by a significant amount (about double the time) and the output value doesn't exactly track with the C version. If I run the filter (to keep re-filtering without clearing the memory z) 10,000 times, it will start out giving identical results, but eventually a small difference crops up. I tried 4 methods and all do the same thing.

1) use vmul and vmla
2) use vmul and vfma
3) use two vmul and a vadd
4) use vmul and vmla, but get C variable values with mov and vmov

This is the vmul and vmla code:
Code:

asm
    (
    "vmul.f32 s0, %[__z], %[_b1]"           "\n\t"
    "vmla.f32 s0, %[_in], %[_a0]"           "\n\t"
    "vmov.f32 %[_z], s0"                    "\n\t"
    : [_z] "=t" (z)
    : [__z] "t" (z), [_a0] "t" (a0) , [_b1] "t" (b1), [_in] "t" (in)
    : "s0"
    );


I tried vfma because it does rounding, but the results were the same. All the methods I tried were slower than the straight C one way or the other which I believe to be caused by inefficient register loading when perhaps it's not needed. I tried all levels of optimization.

I am probably doing some wrong/bad newbie things, but at this point, these simple things seem better done in C because they are faster and C is a lot easier to read than assembly. I found that in depth information (such as complete examples) is rather scarce. I found no examples on using floating point except for a single instruction sqrt function I found in arm_math.h. From that example, I was able to create the above code.

I'm sure I will look at this again, but presently, I'm getting satisfactory performance now, so that will be more of a leisure activity. One thing I will do is to look carefully at the code that gets created for the C statement
Code:
z = a0 * in + b1 * z;

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
emeb



Joined: Dec 16, 2008
Posts: 34
Location: Arizona

PostPosted: Mon Jan 08, 2018 8:51 am    Post subject: Reply with quote  Mark this post and the followings unread

JovianPyx wrote:
First, the assembly code is slower than the C code by a significant amount


Yeah - I had the same experience when trying to do assembly on Cortex-M. I suspect that the compiler knows things about pipelining that I don't, so when I tried to add stuff it screwed up the flow.

About the only thing I do with assembly is force the use of the ssat and usat instructions - those are quite handy and the compiler doesn't seem to know about them (or else I don't know the proper inference syntax).

These days I mostly just relax and trust the compiler. Smile
Back to top
View user's profile Send private message
JovianPyx



Joined: Nov 20, 2007
Posts: 1585
Location: West Red Spot, Jupiter
Audio files: 190

PostPosted: Mon Jan 08, 2018 9:14 am    Post subject: Reply with quote  Mark this post and the followings unread

emeb wrote:
These days I mostly just relax and trust the compiler. Smile


Well, that is the plan going forward as I discovered something today that eliminates the need for inline assembly anyway.

Some experiments I did required that I dump a disassembly and check the generated code to see what is in it. To my surprise, I found that a simple filter like:
Code:
z = a0 * in + b1 * z;

can cause gcc to use DSP instructions like vfma.f32, but only under certain conditions:
1) The filter must be inside of a loop
2) Optimization must be set to either -O2 or -O3.
There may be other conditions as well, but once I did that, I started seeing vfma.f32 in the test code. I then went back and disassembled my KS32 synthesizer code (which contains many such filters) and I see vfma.f32 everywhere in it.

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1585
Location: West Red Spot, Jupiter
Audio files: 190

PostPosted: Sat Mar 17, 2018 8:15 am    Post subject: Reply with quote  Mark this post and the followings unread

Yesterday I was able to write an SDRAM diagnostic. It was easier than I expected. The diagnostic uses random data from a 32 bit LFSR (because the C functions for random return signed values that are only positive so bit 31 is never set) and access to the SDRAM is done with a pointer. All 8 megabytes are accessible. Rough timing tests show that the SDRAM can do about 16 million mixed read/write transfers per second. The only small drawback is that to use SDRAM, the system clock must be set at 200 MHz (I believe slower will also work, but I don't know the lower limit). Seems it might be fast enough to work as a reverb.
_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: State Machine
Page 5 of 5 [113 Posts]
View unread posts
View new posts in the last week
Goto page: Previous 1, 2, 3, 4, 5
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Microcontrollers and Programmable Logic
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use