Help - Search - Members - Calendar
Full Version: MP3 Playback Speed - what interface level?
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - Tech
Mathimagics
Could someone explain how playback software typically supports adjustable mp3 playback speed (when it does support it, that is)?

On Win boxes, the only way I seem to be able to access this capability from software is to use a "Windows Media Player" plugin (msdxm.ocx). This control has a "Rate" property, and it works fine.

The playback rate is not a mixer-level control setting, unfortunately - changing the setting only affects mp3's played through the plugin.

That means to add speed control (which I want) I have to rebuild the playback interface in my music player.

That's no big deal, really, but I'd like to know for sure that I have no other option before I do that conversion.

I'm getting the impression that control of playback speed is a very low-level (driver?) function ... I see that "dx" in the plugin name probably means DirectX, and also I see that, unlike the similar (but sadly speed-challenged) MCI plugin, the WMP plugin appears to make no calls to any media-management dll's.
Trancer
I don't know why you would like to write (yet) another mp3 player, but if it's just for this feature, all DJ Software has this as a feature... Like Mixmeister Fusion or Traktor DJ. There are plenty others... GIYF
Mathimagics
I write my own player software because
  • I'm a software engineer
  • I love music
  • players are easy to code
  • I get a Playlist manager with some intelligence, and which I can change any time, instead of the fixed and generally dodgy browsers that come with most players (on Win platforms, at any rate)
I was looking at XMplay and WinAmp today, testing their ability to handle VBR format, particularly when the file doesn't have a Xing or VBRI header. They did excellent and well respectively, but both of them have fundamental flaws in their playlist/browser interface.

As with many other Win-platform players, adding stuff to the playlist is done by a Windows Common Dialog window - these are really annoying, particularly for this sort of application.

Navigating from album to album is tedious (up to parent folder, repeat if changing artist, then down again).

This ubiquitous dialog window has one particularly inconvenient feature - when you select multiple tracks in any one album (folder), you can't choose the order of play! The dialog box insists on sorting the list before passing it back to the client (the player).

So you have to change the order in the playlist manager ... but can you do that? I haven't noticed such a feature in any I've seen, but no doubt some exist.

It was precisely this kind of shoddy design that made me decide very early on, years ago, that I wanted my own custom browser for music programming.

Writing a player is also a good way to learn about mixer software architecture, and soundcard interfaces, etc ... bound to come in handy one day! cool.gif
incunabula
The playlist interfaces for players that i have used (Winamp, Foobar, etc.) support drag-and-drop which is much more efficient than using the windows common dialog to add files. Changing the playback order of the playlist is fairly simplistic as well - typically sorting by different criteria is supported as well as dragging the tracks around in the list window.
Mathimagics
Fine, you should always be able to change the order of the playlist, in any case. Few of us would put up with a player where you couldn't.

One caveat though - drag'n'drop is not everybody's ideal interface. Where it is used, it should be an option, not the only method available.

But the real issue here is not playlist tweaking, it's the "browse and select" (add to playlist) function that I'm on about here. Wouldn't life be easier if tracks were added to the playlist in the order that you clicked them? Then you only need to manipulate the playlist itself if you change your mind about that order. cool.gif

By the way - while having my little whinge about the Common Dialog, I forgot to mention the "feature" that it always opens up in "List" mode, not "Details" mode, which is usually the one you want.

I'm not alone in my dislike of this control - a Google search will turn up heaps of entries like "How to get FileOpen dialog to open in Details mode?" and "How to get file list returned in order selected?"

Writing your own "Explorer" dialog is dead simple, it is very easy to improve on the MS Common Dialog.

I just can't help but wince when I see players that are crammed with Hi-Fi bells and whistles, but still have this Lo-Fi browser dialog. Like a car with a BMW body and a Fiat 500cc engine mad.gif
Sebastian Mares
Is it easy to write an explorer dialog that works well with network shares, bluetooth disks, symlinks etc. and not only simple folders and drives (I am really curious since I would need a directory tree for a program I am currently working on).
Mathimagics
Back to the original question - playback rate control - for what it's worth, I think the answer (for Win platforms) is something like this
  • if the soundcard provides a "Playback rate" mixer control, then you should be able to set it via the MCI (Mixer Control Interface), in this case mixerSetControlDetails, or waveOutSetPlaybackRate.
  • otherwise, it has to be done at the data-stream level, such as done by the WMP control (Rate property) which uses DirectX to play audio files, bypassing MCI altogether. You'll have to use this control for all the playback functions, so some conversion of existing code may be necessary. Or you could rewrite your player to use DirectX (although how you then go about adjusting playback rate I don't know!)

I suspect only high-end soundcards provide a mixer control. If anybody has one, I'd be interested to know whether it shows up in the standard Win "Volume Control" window.
cabbagerat
QUOTE (Sebastian Mares @ Apr 26 2008, 03:52) *
Is it easy to write an explorer dialog that works well with network shares, bluetooth disks, symlinks etc. and not only simple folders and drives (I am really curious since I would need a directory tree for a program I am currently working on).

I my experience, this is pretty hard with the Win32 API. Using the Qt toolkit, though, wraps a whole lot of the complexity and makes doing this sort of thing pretty easy. I understand why MS are reluctant to change the win32 API, but a modern windows API taking lessons from some of the better ones available (I personally like Qt, and the KDE extension to it) would make developing for Windows less painful.

QUOTE (Mathimagics @ Apr 26 2008, 03:57) *
Back to the original question - playback rate control - for what it's worth, I think the answer (for Win platforms) is something like this
  • if the soundcard provides a "Playback rate" mixer control, then you should be able to set it via the MCI (Mixer Control Interface), in this case mixerSetControlDetails, or waveOutSetPlaybackRate.
  • otherwise, it has to be done at the data-stream level, such as done by the WMP control (Rate property) which uses DirectX to play audio files, bypassing MCI altogether. You'll have to use this control for all the playback functions, so some conversion of existing code may be necessary. Or you could rewrite your player to use DirectX (although how you then go about adjusting playback rate I don't know!)
I suspect only high-end soundcards provide a mixer control. If anybody has one, I'd be interested to know whether it shows up in the standard Win "Volume Control" window.
I really think that using the API (Directx or MCI) is the wrong way to go about it. Doing it in your app would probably be much easier - you could use something like libsamplerate to do it with very little pain.
Mathimagics
QUOTE (cabbagerat @ Apr 26 2008, 23:03) *
I understand why MS are reluctant to change the win32 API


So do I, it's because they're just fat and lazy! cool.gif

QUOTE (cabbagerat @ Apr 26 2008, 23:03) *
I really think that using the API (Directx or MCI) is the wrong way to go about it. Doing it in your app would probably be much easier - you could use something like libsamplerate to do it with very little pain.


I think it depends on what "it" is ... I'm not talking studio mixer here, I'm just talking about an mp3 player. Having an ActiveX control which you drive via code like MM.Play "it.mp3", MM.Pause, MM.Volume = x, MM.Rate = y, etc, is not really what you would call painful.

I was just curious about how playback speed controls (with and without pitch change) worked in general ...

I do have a use for rate adjustment, or more specifically the pitch adjustment that goes with it.

The reason is simple - so I don't have to keep retuning my guitar if I want to play along!

If I tune by ear to CD-sourced tracks, there are various other types of recordings that might not be "in sync" pitch wise and it's a bummer having to stop everything and retune.

Problem sources include vinyl-sourced MP3's where the turntable speed at ATD time wasn't quite bang-on 33.33333, or live recordings from any source, where the band's probably out of it and don't know they aren't in concert pitch ... or don't care, etc ...

If I could adjust the pitch to +/- 1 semitone, or even +/- half a semitone, I'd usually be able to play along with any track without retuning (assuming I keep the guitar itself in tune!) ... cool.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.