iPhone VFP and memory performance

March 18, 2010

I have array of floats for output buffer and array of shorts for input. I need to add values from input buffer to values in output buffer. Using VFP unit the code looks as follows:

int temp[8];
while (numVectors--)
{   
  temp[0] = bin[0];
  temp[1] = bin[1];
  temp[2] = bin[2];
  temp[3] = bin[3];
  temp[4] = bin[4];
  temp[5] = bin[5];
  temp[6] = bin[6];
  temp[7] = bin[7];
  bin+=8;
                    
  ASM ("fldmias  %0, {s8-s15} \n\t"
       "fldmias  %2, {s16-s23} \n\t"
       "fsitos s16,s16 \n\t"
       "fsitos s17,s17 \n\t"
       "fsitos s18,s18 \n\t"
       "fsitos s19,s19 \n\t"
       "fsitos s20,s20 \n\t"
       "fsitos s21,s21 \n\t"
       "fsitos s22,s22 \n\t"
       "fsitos s23,s23 \n\t"
       "fadds s8, s8, s16 \n\t"
       "fstmias  %0!, {s8-s15} \n\t" 
       : "=r" (bout)
       : "0" (bout), "r" (temp)
       : (long reg list was here);
}

So shorts first converted to ints (pair of ldrsh/str operations), then loaded into VFP vector, converted to floats and added to existing values in output buffer eight-at-once. This works without problems and is fast.

Then I tried to preconvert shorts to floats and use array of floats as input to get rid of extra short->int->float conversion:

while (numVectors--)
{
  ASM ("fldmias  %0, {s8-s15} \n\t"
       "fldmias  %1!, {s16-s23} \n\t"
       "fadds s8, s8, s16 \n\t"
       "fstmias  %0!, {s8-s15} \n\t" 
       : "=r" (bout), "=r" (fbin)
       : "0" (bout), "1" (fbin)
       : (long reg list was here);
}

Imaging how was I surprised when measurements showed this code is actually much slower then previous. I’m not quite sure why but I think this is because array of floats takes twice more memory than array of shorts of the same length. It seems because of some caching access to large regions of memory is much slower than extra copy operations and VFP conversion together but accessing lesser memory range.

You should never "optimize" anything without doublechecking that things are really optimized, even if it looks obvious.

·

WikiPlaces 2.0 sent for approval

January 22, 2010
Final list of changes:
  • Search
  • Bookmarks
  • Support for multiple Wikimapia languages
  • New redesigned sleek UI
  • Faster downloading because of direct access to DB
  • New modern overlay visual style
  • Better place details display - just text, no ads and so on
  • Advanced settings
  • UI translations: English, Russian, French, German
  • Many more improvements and fixes
·

WikiPlaces 2.0 is coming soon!

January 20, 2010
Redesigned UI, Search, Multiple languages and much more. Stay tuned!
·

New SoundBank: Dubh Drums

January 15, 2010
Jonny McEwen contributed great soundbank for SoundGrid - Dubh Drums. To install it go to Get More Sound Banks in Community menu, then select Official Server and find this soundbank.

Thank you, Jonny! And by the way, here is his music: http://dubh.bandcamp.com/
·

Inotia 2 – Waste of money

December 11, 2009

Boring. Stupid. Pointless.

Very nice graphics, though.

·

PicasaWeb image quality is awful

December 10, 2009
Had an idea to use PicasaWeb instead of MobileMe Gallery because it’s faster and several other reasons. But quality of ‘web-optimized’ images it generates and shows is really awful and unacceptable.

PicasaWeb on the left and MobileMe Gallery on the right, notice JPEG compression artifacts.
·

Explanation of the idea with SoundFonts

October 12, 2009

You know I’m going to add exporting to MIDI files in one of next versions. This will allow users to import SoundGrid Grids into any other DAW and each layer will become MIDI track. But this will not give you the same sound output without samples from soundbanks that were used in original Grid.

So I’m going to create SoundFont files matching all my soundbanks. Then you can assign appropriate SoundFonts to MIDI tracks (DAWs have either built-in support for SoundFonts or plugins) and hear the same sound. Unfortunately filters and effects can’t be exported/imported but I think this solution is still better than nothing.

·

SoundGrid 2: Creating and installing your own Sound Banks

September 27, 2009
This instruction is out of date, SoundGrid 3.0 includes Web Console for easier creation of new Instruments with your samples.

Many users asked me how to create sound banks and add them to SoundGrid after version 2.0 became available. And it’s actually my fault that I didn’t provide appropriate documentation in time. In this post I’ll describe anatomy of sound banks, how to create your own and how to add them to SoundGrid. Samples Format SoundGrid accepts samples in uncompressed wav/aiff formats, 44100 kHz sample rate, mono or stereo. Little-endian better but it’s not usually controllable by regular users. Sound Banks Sound bank contains (obviously) samples in said format. It can have unlimited number of samples inside but only 16 of them accessible on the grid at a time. To solve this problem sound bank can define some number of musical scales that determine what notes are accessible. For example, sound bank can include samples for all 12 pitches in several octaves and define C major scale among others which will project only corresponding pithes onto the grid. Same mechanism can be used for drums kits even ‘musical scale’ term isn’t appropriate in this case. Every sound bank has unique ID so that all other properties can be changed at any time without breaking existing projects. Sound Banks Server Sound banks server hosts number of sound banks and allows users to download and install them after configuring that server in the application. One official server is preconfigured for all users. How to create your own sound banks Later I will provide easy to use applications for Windows/Mac platforms that will simplify this process as much as possible. Until that the procedure may be somewhat complicated, I’m sorry and working on releasing these applications soon. To get started let’s take a look at one of available sound banks. Download Waterdrillo.bundle.zip and unpack it. You will see folder (or bundle on Mac, use Show Package Contents in context menu to get inside) Waterdrillo.bundle with number of audio files and one Info.plist file inside. Assuming you have your samples prepared in good format (btw, of course you can include less than 16 samples, then not all rows in the grid will produce sound) you can now delete these audio files and replace them with your samples. Then open Info.plist in any text editor (or property list editor on Mac if available). It’s actually an XML file that defines all properties of sound bank, replace them with appropriate information about your sound bank.
  • Title - name of your sound bank as it will be visible to users
  • Author - your name, email and so on
  • Descr - description, any text; currently not shown anywhere but will be in future
  • ID - unique ID, any short text
  • Type - type of audio samples, 'wav’ or 'if’, this corresponds to extension of audio files
  • DefaultScale - ID of default scale if several scales defined below
  • Scales - array of scales definitions. Five scales defined in example sound bank, you may remove some of them but one scale must always exist. Below is description of scale properties:
  • ID - unique (for this sound bank) ID
  • Name - name as it will be shown in scales list
  • Descr - description, currently usually list of note names (will be deprecated in 2.1)
  • Tones - space-separated list of names of corresponding audio files from lower to higher (without extension)
  • MIDINotes - space-separated list of corresponding note names for upcoming exporting to MIDI feature. Examples of correct notes are: C2, F#3, Ab1 and so on (even D#-1). To skip note (eg. if there’s no sample provided) enter - (minus sign). This property isn’t actually required but will ensure correct mapping when exporting to MIDI.
That’s all. After you places your samples inside and modified Info.plist file you can rename Waterdrillo.bundle to anything you like, compress entire folder to get Something.zip Now, important moment. If you want to share your new sound bank with other users just send me resulting archive and I’ll upload it to official server for all users and first of all for you. If not, read the rest. Setting up sound banks server Sound banks server is just regular web server with compressed sound banks and one additional Info.plist file with brief information about hosted sound banks. So you need any web server to which you can upload files and then access from your iPhone / iPod Touch. On Mac you can use Web Sharing feature, on Windows I recommend using free HFS application. Create some folder and place all your sound banks inside. Then download example Info.plist (use Download Linked File or Save As in context menu) to that folder, open it in text editor and modify following properties:
  • ServerName - name of your server, will be visible in server list
  • SoundBanks - array of sound banks definitions, use provided definition of Waterdrillo sound bank as example, all properties have self-explanatory names (file sizes are in kilobytes). Don’t forget to change waterdrillo1 to ID of your sound bank.
When you finish editing server Info.plist just launch SoundGrid application go to 'Get More Sound Banks’ in Community section, click on plus button and enter address of your web server. Hope it will work! Again, sorry that it’s currently too complicated. Af you have any problems or questions always feel free to contact me, I’ll do my best to help you. Note that although you can share grids that make use of your private sound banks, other users won’t be able to play them correctly.
·

SoundGrid 2.0 released!

September 23, 2009
It’s been a long time since last version and now the wait is over. We have many great new features in 2.0: Redesigned UI and visual effects
To keep UI simple, elegant and attractive for novice users. If you have difficulties placing notes on the grid now you can enable assistance lines to make life easier. Song Mode
Few people use all eight available patterns because it may be hard to switch them while playing. In Song Mode filled patterns will be automatically activated one after another enabling you to create longer compositions easily. Also now you can touch pattern button twice to switch pattern for all layers at once; or to switch pattern and start from its beginning in song mode. Switchable musical scales
There are only 16 rows (notes) on the grid and much more keys on piano keyboard. And now you can select set of tones you want to be available on the grid. Recording
Now you can record audio files while playing. Then either easily upload tracks directly to SoundCloud or send by email as is or as ringtone More and more Sound Banks
Additional sound banks now installable from external servers. Either my official server or your own. Ratings for shared grids
Many new grids become shared everyday. Now you can rate them and best ones will deservedly be always on top when sorting by rating. New shared grids since last update now marked too. Other fixes and improvements
Many bugs were fixed and many things made better. One of them is improved (means reduced) latency and UI reaction. SoundGrid 2.0 on the App Store
·