I’m about to start on an inexpensive audio playout system for radio stations. I was going to use Winamp as the player via Windows messages but FMOD will would make it much tidier.
The only problem is crossfading. Everyone I know using Winamp for LPFM & streaming is using the SQRSoft Crossfading output plug-in. I use it myself for my LPFM station. It works brilliantly by testing the volume of the outgoing and incoming songs (in a large buffer) and intelligently working out where to crossfade and for how long.
I presume this feature is not in FMOD but has anyone else produced anything of this nature (preferably in Delphi)? I would not want to write it myself! If not, any chance this feature could be officially added to thge next FMOD release?
- rlevis asked 15 years ago
[quote="brett":au0ullp6]just use FSOUND_GetCurrentLevels[/quote:au0ullp6]
I don’t see how that is going to work. I need to scan the last 15 seconds of the song before it is played to find the last point where the volume exceeds a certain db. A song could be low in volume near the end put finish with a louder piece. It is no good crossfading at the point where the volume dropped.
I don’t see how I can do it unless I can read the audio as data, put it into a rotating buffer where I scan it for volume, and then send the audio to the output device. It’s a lot of work I know. I haven’t read the API so I’m not sure if this is possible or not. Please let me know.
i have done something like this, if your looking to create a semi-prof radio playback system im assuming you dont want to work with simple playlists ( i hate the winamp simple playlists), i have an import routine which import tracks into a database (access or MS SQL server – which i use ), the import routine catalogues new tracks and stores all information like tags, length, replay gain value ( for volume normalization). I also have tested saving VERY inaccurate volume information ( i just read the start and end of the track and store an array that can be used to work with crossfade times ( but thats slow ). i also have a riding volume value that is the overall volume that floats towards the current average volume ( i also use as a fail-safe to check if nothing is playing).
NB: simple playlists suck, be more inventive – why not record your track selections and use the information to ‘guess’ what to play next. I know i don’t want to hear the same track in the same order ( or random order ) over again….. i want to say….give me something chilled….slow bpm…low energy….but no Avril ( the fake puppet) ???
if anybody wants to tech stuff to the above ..just shout….
I am just thinking of a somewhat more efficient method, altough it’s not really easy, I think it is a method that might work.
Instead of a stream dsp, you create a dsp on the output (there are some samples about creating dsp’s included in the sdk).
Now, you create your own buffer of 15 seconds long and you put in all the data you receive from the dsp callback.
As long as your buffer isn’t filled, you fill the buffer from the callback with zero’s.
When your buffer is (almost) filled, you buffer the data you receive, and you return the data that is at the beginning of your buffer.
Now your buffer contains 15 seconds of data ahead of time.
From the moment your stream has stopped, you know that your buffer still contains 15 seconds, so you do your calculations at that point. And you determine when you should start your second song.
-oops- almost forgot that the second song has to be in the 15 second buffer too for the third song. This means that the buffer you have to create will be 30 seconds long, so that you can start the second song 15 seconds ahead of time.
I hope this was somewhat clear and usefull…
and another thing, why do you guys not like databases, storing info in each file gives you no command over your total music catalogue – and not statistical information at all. Fine for jonnies bedroom player, but in the real world where information is power…..
“I need to know what track was played last tuesday just after midnight, how many times has the track been aired now…..we had so many enquiries”
“…lets have an hour of tracks we have not played for a few months…..”
“I’ve got the audience figures for last months….could you do some analysis on the listeners vs playlists”
Isnt possible start one channel 15s before the song, set the volume of this channel to zero, and analyse the volume of song?
You need play the song in two channels, with 15s of delay between them, but with volume of first channel setted to zero.
I dont know if this work….
I think both aproaches are possible.
The reason databases are not good is that you have a different database in each program that you use.
I think the best approach is to store a lot of information (such as title/artist/album/bpm/length/genre and cue-points) in the file itself.
Your program could then immediately use that data (or gather it using some kind of dsp processing).
Of course, when you want to be able to generate playlists or look up songs with specific features, then you would rather have a database.
But you could build dat database from the tags, which might save a lot of time if some other program already filled in some tags.
Then I would use the database only as a quick lookup for all information and to gather information that has no use in a single file, such as times played, or times skipped or things like that.
- Adion answered 14 years ago
That is an interesting idea! Would this work?
Load a 2nd copy of the same song sometime while it’s playing and tell it to start 15 seconds from the end and analyze the input volume. I could do this anytime in the middle of the song.
What do the experts say? If it’s this simple then it shouldn’t take long to implement.
i do agree…but if your aiming for a proffesional product……a universaly accesable database driven app give functionality to the user that static ‘in file’ tags cannot offer..
but then again…if you put together the code that reads from tags…and searches from the tags…..and put it all together in one ‘object’ ….then what you got……. a custom database app with multiple data-sources..
use ODBC…..heck! your playlists could even be on-line with one simple php script
Is it possible to know the point for intelligent crossfade using “replay gain value”? Not the gain for the entire file, but for the last (or/and first) ‘n’ seconds. This way is possible to save (in a tag and/or in a data base) the time-points to jump to next file…. only an idea.
Do you have a delphi replay gain source code?
the replay gain i figured is important for a decent crossfade ’cause if your going to try a -smooth- fade or have an -effect fade- i though it would be important to take into consideration the relative volume of each track (being that not everybody’s samples or mp3’s are recorded at the same -volume-. one loud track fading into a really quiet one can be difficult to control ????
Check out the replay-gain website – can’t remember at mo – google
have no delphi code…..vb/c/gerbil – see above
[quote="cmstein":1j6rtana]My doubt is:
is it possible to use FSOUND_GetCurrentLevels in a channel with no volume (volume = zero)?[/quote:1j6rtana]
Can someone please confirm this. I hope so, otherwise I may have to plead with Brett to implement another call to provide the original input volume.
[quote="Richie":3gswk6gz]the replay gain i figured is …[/quote:3gswk6gz]
I know what replay gain is. I think about two levels:
- one is the ‘normal’ volume, says 92dB;
- othe is the volume to ‘mix with next file’, says 70dB
When the music volume is 70dB (considering only the last 15s, for example), make crossfading.
These dB values can be obtined using ReplayGain. I think this is not so complicated…..
I think this is possible. For a really easy way of doing it you could load both of the songs into different channels (i.e Channel1 and Channel2) then when the first channel reaches near the end of the file you could slowly reduce the volume of Channel1. Then for Channel2 you could slowly increase the volume so that you get a nice fading effect. I’m not sure if that is what you wanted but I’m sure you could do this in FMOD.
- Paranoid_Android answered 15 years ago
I have successfully written a radio playout system called DARP and I find the best method is to have a database holding information about each song, link, spot and so on. You can then do clever things like setting intro points, hook points and the all important extro point.
So instead of examining a stream that is playing for it’s volume you compare the current position of the stream with the extro point set in the database.
This method is more reliable and flexible, especially for the user of the system.
BTW – DARP currently uses the mmsystem.dll and is 16 bit, but now thanks to FMOD I am in the process of upgrading. It’s FAB MOD!
Please login first to submit.