Turntable Emulation
Turntable Emulation
Turntable Emulation
Turntable Emulation
Turntable Emulation
Turntable Emulation Turntable Emulation Turntable Emulation Turntable Emulation Turntable Emulation Turntable Emulation Turntable Emulation Turntable Emulation
Turntable Emulation Turntable Emulation
Turntable Emulation
Go Back  Xtreme Visual Basic Talk > > > Turntable Emulation


Reply
 
Thread Tools Display Modes
  #1  
Old 01-26-2017, 08:56 AM
Mathimagics's Avatar
MathimagicsTurntable Emulation Mathimagics is offline
Algorithms 'R' Us

Forum Leader
* Guru *
 
Join Date: Jun 2002
Location: Canberra
Posts: 4,159
Default Turntable Emulation


I have just completed v3 of my custom music player (written entirely in VB6), which, along with giving me playlist access that knows just what I like (a feature sadly lacking in most media players), features a nice turntable emulation.

I was hoping to provide a video of the thing in action, but converting BMP/JPG images to AVI seems to be like pulling teeth - I downloaded half a dozen "Easy BMP to API" type apps but they all had some fault or other.

I have attached some screen shots that show the basic idea. The background image was derived from a hi-res photo of a '60s vintage turntable. I isolated the tonearm by carefully (and painstakingly) picking around its edges. Then I removed the tonearm from the "master" image and filled in the missing parts as realistically as possible.

Each live image is a blend of 4 components
  • the master background image (900 x 700)
  • the vinyl texture map
  • the track label (360 x 360)
  • the tonearm overlay (synchronised with tracktime/playposition)

By working with 8-bit greyscale images, and reserving 32 colors for the track labels, it is a simple process to overlay the labels (generated on the fly) on the background+texture images.

8-bit bitmaps are particularly convenient due to their relatively modest size. Thus I'm able to handle the required frame rate of 100 fps at 33.333 rpm (135 fps at 45 rpm) based on 180 frames per full platter rotation cycle, with time to spare (30% idle at 33 rpm, 10% idle at 45 rpm). That's on one core of a 2.8GHz cpu (6 cores).

I played around with actually rotating the image, but the results were so poor (in terms of image quality) that I reverted to generating the label images (size 360 x 360) by generating the required angled fonts, thus getting a much sharper image as a result.

The font-edges are smoothed automatically by the system according to background colour, and it seems with one or 2 coloured backgrounds, and black primary text color, 32 different colours is sufficient in most cases for accurate translation to 8-bit format.


The back-end of the player uses the BASS music library (a little gem), which gives me access to features like pitch adjustment (handy when your guitar is not in tune with the recording), and of course a callback facility for end-of-track.

I also wrote a custom progress bar (for the level meters), and a custom slider control, both of which are evident in the screenshots. The position slider which appears below the platter has a transparent background.
Attached Images
File Type: jpg DemoFrame1.jpg (243.8 KB, 7 views)
File Type: jpg DemoFrame2.jpg (248.4 KB, 5 views)
File Type: jpg DemoFrame3.jpg (243.0 KB, 5 views)
File Type: jpg DemoFrame4.jpg (244.1 KB, 6 views)
__________________
Cogito, ergo codo

Last edited by Mathimagics; 01-26-2017 at 11:42 PM.
Reply With Quote
  #2  
Old 02-04-2017, 02:04 AM
abeginner abeginner is offline
Newcomer
 
Join Date: Jul 2008
Posts: 10
Default

There is "Spinning Illusions by Robert Rayment" with Antialias that I came across on PlanetVB which sort of reminds me of a spinning record. Not sure if it is applicable, but just in case here is the code.
Attached Files
File Type: zip Spinning_Illusions.zip (102.2 KB, 4 views)
Reply With Quote
  #3  
Old 02-04-2017, 02:49 AM
Mathimagics's Avatar
MathimagicsTurntable Emulation Mathimagics is offline
Algorithms 'R' Us

Forum Leader
* Guru *
 
Join Date: Jun 2002
Location: Canberra
Posts: 4,159
Default

Interesting. You may have noticed that the performance hit of doing anti-aliasing is significant. Even in ASM mode the spin rate drops appreciably. In VB mode it slows to a crawl.

But anti-aliasing for other than simple geometric images is really necessary to get a "smooth" visual effect.

Fortunately I avoid this problem altogether by using the Win32 font system to draw my label "rotations". I draw 180 labels at 2-degree intervals - all the font-edge smoothing is done for me and as a sresult I get a very smooth image transition with minimal overheads.

Of course, Mr Rayment could have done this too - ie, generate the anti-aliased images first and then display them in rotation.
__________________
Cogito, ergo codo
Reply With Quote
Reply

Tags
image, images, rpm, background, custom, 8-bit, turntable, idle, labels, label, track, features, required, master, player, music, emulation, fps, access, generating, slider, tonearm, platter, size, poor


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Turntable Emulation
Turntable Emulation
Turntable Emulation Turntable Emulation
Turntable Emulation
Turntable Emulation
Turntable Emulation Turntable Emulation Turntable Emulation Turntable Emulation Turntable Emulation Turntable Emulation Turntable Emulation
Turntable Emulation
Turntable Emulation
 
Turntable Emulation
Turntable Emulation
 
-->