Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Technology

Software to Buffer and Delay Audio Playback? 86

NaDrew asks: "Fox has seen fit to use two of its worst broadcasters (Joe Buck and the horrid Tim McCarver) for the upcoming World Series. I'd love to just turn down the TV and listen to the Giants' regular broadcast team (Duane Kuiper, Mike Krukow, Jon Miller) on my local Giants affiliate radio station, but as a DirecTV user this doesn't work. Why? Think about it: The radio signal traverses the 20-odd miles from Sutro Tower to my home in Palo Alto in a fraction of a second, but the video signal goes from KTVU's broadcast center in Oakland via satellite to DirecTV's operations center in Boulder, then via satellite again to my home--22,500 miles x 4 bounces equals almost 100,000 miles. Coupled with the MPEG processing done at DirecTV's operations center, this adds up to a delay of about six seconds. What I would like to do is buffer the audio from my radio for the appropriate amount of time and then play it back in sync with the video. Ideally I'd like a software solution that will run under Win32. A Google search yielded some specialized hardware solutions but nothing for my purpose. Ideas, pointers, even 'you idiot it's right here' flames are welcome. Thanks!"
This discussion has been archived. No new comments can be posted.

Software to Buffer and Delay Audio Playback?

Comments Filter:
  • you should get all the delay you want that way
  • Radio Delay (Score:5, Interesting)

    by yasth ( 203461 ) on Thursday October 17, 2002 @02:21PM (#4471341) Homepage Journal
    Actually I am suprised that you aren't hit by a seven seccond radio delay. A simple way would be to write the data to disc, and use annother program to follow behind it. I.e. use some program to record the stream, and then 6 secconds later set winamp on the still recording stream, that should work, but no promises.
    • Re:Radio Delay (Score:3, Informative)

      by Blkdeath ( 530393 )
      A simple way would be to write the data to disc, and use annother program to follow behind it. I.e. use some program to record the stream, and then 6 secconds later set winamp on the still recording stream, that should work, but no promises.
      I was thinking exactly that. DarkIce [sourceforge.net] is probably exactly what the submitter wants. It has a built-in delay function which would do exactly what he's looking for.

      Record the radio via the Line-In, set it to stream with a 5 second delay. Send the stream through IceCast [icecast.org] and connect with XMMS/WinAmp and away you go. Heck, you could even use one of these [radioshack.com] and connect your soundcard's line out to your television and control the whole she-bang with your remote control.

      • I was just trying to do this myself (actually, originally wanted to get a "rebroadcaster" going for a radio-station -> icecast connection so I could listen to a radio station at work w/o having a radio at work. Wow, that's much geekier than a walkman. :^)

        Anyway, try this. It ends up with about a 10s delay for me to encode / re-encode.

        ## command to oggenc line-in and play it out again.
        rec --type=.wav -o - | oggenc - -q 5 -o - | ogg123 -


        Try removing the oggenc line, and do something like the following:

        rec --type=.wav -o delayme.wav & ; sleep 6 ; play delayme.wav ...and don't forget about the "tee" command, which will allow you to "duplicate" an output stream (ie: record one to disk, for archiving, but realtime play the other one).

        I never realized how much fun this kind of stuff is... and consider: plug in a radio overnight and OGG the station to disk. (or do it all with a Hauppauge WinTV/Radio card and you can cron up specific radio shows as you want). With OGG, I'm getting ~25 mb / hour on quality 5 (approximately 64 kbps, which is almost exactly the quality I can get from radio broadcasts). Burn each show to CD and bring it in to work, and skip through all those annoying "Laser eye surgery" commercials, but still listen to the music. You can probably get all this automated w/o much trouble at all, which is the coolest thing about linux for me. Sometimes it's tough to remember just how much power and control you can have by putting simple, well-designed commands together.


        rames@spike:/usr/local/music/106.7$ ogginfo Oct18.ogg
        Processing file "Oct18.ogg"...

        New logical stream (#1, serial: 68036320): type vorbis
        Vorbis headers parsed for stream 1, information follows...
        Version: 0
        Vendor: Xiph.Org libVorbis I 20020717 (1.0)
        Channels: 1
        Rate: 22000

        Nominal bitrate: 50.000000 kb/s
        Upper bitrate not set
        Lower bitrate not set
        Warning: EOS not set on stream 1
        Vorbis stream 1:
        Total data length: 183817997 bytes
        Playback length: 435m:34s
        Average bitrate: 56.267717 kbps


        --Robert
  • by Anonymous Coward
    Take two tape recorders apart (actually only one needs to be able to "record") and mount the guts side by side on a board. You will have to do some modification of the drive assembly so that both mechanisms run from the same motor. Take apart a cassette tape and remove the actual tape. Run this piece of tape through the two tape recorder mechanisms and loop it back over itself -- some scotch tape will hold the two ends together nicely.

    Place the sound input to the one of the recorder mechanisms and take the sound output from the other mechanism.

    You can controll the amount of delay between the two by varying the speed of the motor.
    • However, once the tape got recorded over a few hundred times, it would start to sound like CRAP with all the residue of previous recordings building up. You would have to use a really long tape loop to have it be reasonable sound quality after 15 minutes or so of recording and re-recording.
  • by gowen ( 141411 ) <gwowen@gmail.com> on Thursday October 17, 2002 @02:23PM (#4471373) Homepage Journal
    Put your speaker about 1.167 miles away and turn them up *really* loud...
    • by Anonymous Coward on Thursday October 17, 2002 @02:33PM (#4471479)
      Somebody Arrest this person.

      The modulation of an analog audio signal over a high frequency carrier wave is an "effective" copy control mechanism.

      By turning up your speakers really loud so that anybody can hear the broadcast is a circumvention technology that is not only illegal to implement under the DMCA but is also illegal to tell anybody else how to implement it.

      You sir are an INTELLECTUAL PROPERTY THIEF and are no better than the cranked up dope head that steals the purse of the poor widowed pensioner to pay for his next hit.
      • You sir are an INTELLECTUAL PROPERTY THIEF and are no better than the cranked up dope head that steals the purse of the poor widowed pensioner to pay for his next hit.
        Actually, I'm also that cranked up dope head...

        PS: my last post was, apparently my 500th slashdot post. I need to get out more.
      • ...and besides the MLB rules that the announcer reads says "...any rebroadcast of the descriptions or accounts of this game without the express written permission of [Team Name and /or Major League Baseball] are expressly prohibited."

        The speaker can't "broadcast" beyond your home unless you want the baseball hit squad to show up on your doorstep.
  • That's right, there could very well be a radio delay as well, which would mean you might luck out, or worse yet, you might find yourself needing to delay your video. A Tivo might help there, or simply dealing with it might be the best approach.

    I guess I'm just not a big enough sports fan to understand...

  • Seriously, imagine what the radio comentator says, then use the video to verify it. If it doesn't match, you need to work on your imagination.

    -1 Offtopic +2 Funny -3 Funny = doh!

  • by fingal ( 49160 ) on Thursday October 17, 2002 @02:32PM (#4471468) Homepage
    Why not download PD from here [ucsd.edu] and have a play around. Creating a delay between the audio inputs and outputs is very easy...
    • Why not download PD from
      here [ucsd.edu] and have a play around. Creating a delay between the audio inputs and outputs is very easy...
      Thanks for the tip and I'll definitely be checking this out later today.
  • Very simple solution using 1980's tech. You need a video tape and a cassette tape. Record the television signal on one, and the radio on the other. Afterwards, just cue them up, and you can watch everything in sync.
  • Simple... (Score:2, Informative)

    by qengho ( 54305 )

    Get a TiVo (you know you want one anyway), start watching the game, pause for six seconds to fill its buffer, then resume watching, happily in sync with the radio.

    • I think you have it backwards. The radio comes in before the satellite feed does.
      • I think you have it backwards.

        Right, sorry. Somebody mod that down (-1, Poor Grasp of Chronology).

        Fortuntately, I'm compatible with my wife. We have a VCR with "commercial advance", a feature that marks commercials after a show is recorded and automatically skips past them on replay. After viewing a few shows this way, we were watching live TV and a commercial came on. "Why are we watching this?", she says. "Can't you just fast forward through it?"

      • I think he was referring to the next generation Tivo that lets you pause, rewind, and FAST FORWARD live TV. Now *that* would be a cool feature.

        Caution: Use could result in widespread "Lone Gunmen" postings.
    • Um, no... when you do that, your video will be 12 seconds behind. The question specifically said he wanted to delay the AUDIO, not the video.

      I've actually noticed this with DirecTV: I'll be watching football, and about five seconds before a big play, the people downstairs would start celebrating.
    • Umm.... Who the hell modded this guy up? ( no offense)

      Read the problem again. What you say would make his audio play TWELVE seconds before his video feed.

      You got it backwards. He doesn't need a solution to delay the video.

      Again, no offense to you for reading the question wrong, but Whoever modded you up is...... uhh... _not_ supposed to have mod points.
    • I've had a couple of beers but wouldn't that put the gap at 12 seconds? Or maybe I'm still running on pub time...
    • This won't work. The TV broadcast is delayed, not the radio. Pausing on your TiVo only delays the TV broadcast more, which is why he was asking to be able to buffer his radio.
      I wish I had some appropriate analogy for this this situation. The SF Giants are the only sports team I truly care about and the tools Fox has foisted upon us make me want to pull an Elvis on my TV. People have been calling the radio station all week begging them to put a longer delay on their broadcast. I have been looking for a similar technological solution myself.
      • I wish I had some appropriate analogy for this this situation. The SF Giants are the only sports team I truly care about and the tools Fox has foisted upon us make me want to pull an Elvis on my TV.
        It was pointed out to me that Joe Buck isn't that bad and is actually tolerable. McCarver on the other hand is just awful. I can't stand how he'll keep going ON and ON and ON about some pointless minutia that happened three innings ago, or worse, in a Yankees game three weeks ago. Notice how he always gets a mention of the Yankees in there?
        Anyway the PD [ucsd.edu] software mentioned above looks like a complex, but workable solution. If I can make it work I'll follow up here.
        • Of course, the team Fox had doing the Twins/Angels series (and the Twins/Oakland Series) are even worse... Thom Brennaman and Steve Lyons make you want to turn off the audio even faster... The pre/post/ingame stuff with Kennedy/Zelasko is completely intolerable, and smacks of typical Fox coverage - all (bad) style, no substance...

          Joe Buck is pretty good, especially with a decent partner.
    • Get a TiVo (you know you want one anyway), start watching the game, pause for six seconds to fill its buffer, then resume watching, happily in sync with the radio.

      Well, that's a very good suggestion, if by "happily in sync" you mean "off by twelve seconds".
    • Get a TiVo (you know you want one anyway), start watching the game, pause for six seconds to fill its buffer, then resume watching, happily in sync with the radio.

      I'd laugh, if it weren't for the fact that I catch myself starting to do this *almost every week*, before I remember, dammit, it doesn't work this way!

      My current solution (which I haven't even begun to work on yet) is to:

      * Get an FM radio card
      * Hook it to a linux box in the basement
      * Get streaming shoutcast working
      * Point my Rio Receiver at it

      Somewhere in there I'm going to have to add a delay, either at the shoutcast level, or (if necessary) as a separate process in the FM->shoutcast pipeline. Extra points awarded if I can make it easily variable (and controllable from the Rio), but that's even lower on the priority scale.

      Of course, until the Redskins start winning again, I won't have much enthusiasm for this.

      LONG-term plan? Replace the single FM card with one of those cool high-end A/D converters and get GNUradio running, so I can select any of my favorite off-air radio stations on the fly, and listen to 2-4 of them at once. :)

      But I gotta mow the lawn, first.
  • by Geek Boy ( 15178 ) on Thursday October 17, 2002 @02:37PM (#4471516)


    Get a spool of about 1,800,000 km of wire and use it to connect your speakers to the radio with carefully placed signal boosters/repeaters.
    YMMV

  • Got a TiVo? (Score:4, Interesting)

    by cybermage ( 112274 ) on Thursday October 17, 2002 @02:42PM (#4471588) Homepage Journal
    If you have, or can get, a TiVo that is seperate from your DirecTV receiver, you can try the following:

    1. Run the DirecTV Video straight to the tube.
    2. Connect the Audio from your Radio Tuner to the Audio In on the TiVo.
    3. Watch the DirctTV feed and listen to the TiVo feed.
    4. Pause/Fast Forward the TiVo until the audio is in sync with what you're seeing.

    To make sure the TiVo doesn't decide to change channels or anything, you might program it to record something as long as the game (like the game.)
    • Yeah, that would work great if the TiVo could predict 6 seconds into the future what the broadcast stream would contain.

      The problem is the radio signal arrives in advance of the video feed. Your TiVo can do nothing to fix that.

      Don't mod this up; mod the parent (and equivalent posts) back down.
      • You sir are the one that doesn't understand. His suggestion is to watch the DirectTV feed (which is delayed 6 seconds) and listen to the radio feed (which isn't delayed) through the Tivo, using the Tivo to delay the audio.

        Moderators, please mod parent down.
      • You use the tivo to delay the audio, and watch the DirecTV feed. So the Tivo buffers 6 seconds worth of audio, then starts playing. The DirecTV, which is already 6 seconds behind, plays normally. And wow. They're in sync.

        ---Audio-->Tivo, wait 6 seconds-----> TV
        ---Video-->No Tive, already delayed-> TV

        See, the arrive in sync at that point.
        • You use the tivo to delay the audio, and watch the DirecTV feed. So the Tivo buffers 6 seconds worth of audio, then starts playing. The DirecTV, which is already 6 seconds behind, plays normally. And wow. They're in sync.


          ---Audio-->Tivo, wait 6 seconds-----> TV
          ---Video-->No Tivo, already delayed-> TV
          Ah-ha! I figured there had to be a way to get a TiVo into the picture somehow. More ammunition in my battle to get one. Well not a battle really, but my wife doesn't quite understand (she will be assimilated, resistance is futile).

  • http://www.google.com/search?num=100&hl=en&lr=la ng _en&ie=ISO-8859-1&q=freeware+windows+audio+recordi ng+real+time+effects+delay&btnG=Google+Search

  • > 22,500 miles x 4 bounces equals almost 100,000 miles. Coupled with
    > the MPEG processing done at DirecTV's operations center,
    > this adds up to a delay of about six seconds.

    Given an overall system processing delay more than an order of magnitude larger than the total signal propagation delay through space, why even bother mentioning it, let alone do the math? That 100K miles adds only a small fraction of a second to the many seconds of processing on the ground and in the transponder.
    • Given an overall system processing delay more than an order of magnitude larger than the total signal propagation delay through space, why even bother mentioning it, let alone do the math? That 100K miles adds only a small fraction of a second to the many seconds of processing on the ground and in the transponder.
      You're right and I should have edited that before posting it. The only delay I can truly account for is the speed-of-light effect between broadcaster, satellite, DirecTV, satellite, and me. It didn't seem like enough so I tried to figure out what the rest could be. Someone suggested above that either the broadcaster or DirecTV might have additional delays for censoring profanity (or outfield streakers) but I seem to recall a CBS affiliate getting in trouble last year for doing something like that with an NFL game.
      In any case, it doesn't really matter the cause of the delay, and I appreciate the suggestions made in this thread to work around it.
    • That 100K miles adds only a small fraction of a second to the many seconds of processing on the ground and in the transponder.

      Actually, a fairly large fraction of a second - about 0.54 seconds, if you wanna get picky.
  • by MrResistor ( 120588 ) <peterahoff.gmail@com> on Thursday October 17, 2002 @03:16PM (#4472088) Homepage
    All professional TV broadcasters have equipment that does MPEG processing in realtime (I'm one of the techs that fixes it when it breaks). Yeah, I guess maybe it could contribute a few ms of delay, but nothing you couldn't compensate for with the delay setting in a good reciever, and it is still probably less than the delay introduced by retransmitting, which still doesn't account for the 13-15s your talking about (6s + typical 7-8s delay on live radio).

    It's much more likely that KTVU has a playback delay set on their video server, mainly for the same reason that radio has one: bleeping out profanity before it hits the air.

    DirecTV certainly has a playback delay of at least 4s, which gives their automation system (which I also service) time to switch to an alternate stream if something goes wrong with the current one.

    Anyway, my point is your placing blame on the wrong parts of the process. That doesn't help with your case, of course. But my suggestion is to do exactly what the broadcasters are doing (except a lot cheaper):

    Run sound from your reciever to the line in on your soundcard. Record that with any sound recording program (the default Windows Sound Recorder will work just fine). Have a player up with the record target file ready to play, and start playback manually when you think the time is right.

    I haven't tried this so it might not work if Windows locks the record file during recording, but essentially that's exactly how it's being done on the video servers the broadcasters are using. I'm sure there's a better way to do this in Linux, but I haven't got around to playing with any of the Linux media tools yet.

    • All professional TV broadcasters have equipment that does MPEG processing in realtime (I'm one of the techs that fixes it when it breaks). Yeah, I guess maybe it could contribute a few ms of delay, but nothing you couldn't compensate for with the delay setting in a good reciever, and it is still probably less than the delay introduced by retransmitting, which still doesn't account for the 13-15s your talking about (6s + typical 7-8s delay on live radio).
      I appreciate the different perspective. I originally talked about the problem with my dad, a signal engineer from the old days at Bell Labs, and we more or less agreed that the speed-of-light delay wasn't enough to produce the effect I was seeing. DirecTV MPEG processing was the only other thing I could think of that might affect it.
      It's much more likely that KTVU has a playback delay set on their video server, mainly for the same reason that radio has one: bleeping out profanity before it hits the air.
      Which explains why I heard J.T. Snow screaming "FUCK!" very loudly after screwing something up last week? I'm often surprised at what gets on the air on baseball broadcasts.
      • Which explains why I heard J.T. Snow screaming "FUCK!" very loudly after screwing something up last week? I'm often surprised at what gets on the air on baseball broadcasts.

        That's pretty funny!

        Anyway, any bleeping is done by a human, and they're bound to make mistakes, especially since they're just sitting in front of a switcher waiting for a good time to cue the commercials. I doubt a professional announcer would do something like that if he didn't think there was somebody manning the button, they can get in serious trouble for that.

        DirecTV MPEG processing was the only other thing I could think of that might affect it.

        Actually, the MPEG processing is probably happening at KTVU. That's pretty much the state of the industry at this point. DirecTV might further compress it in their facility (or recompress it, I guess), but that would add any significant delay.

        The playback delay would be at both sites, though, and there are a lot of reasons for it. The 2 most practical reasons I've already listed, but when I'm testing the servers I usually delay playback up to 40s. Sometimes you can have some wierd issues if the playback starts too soon. I wouldn't expect that in a real world situation it would be nearly as critical, though, since I run them at or slightly above the maximum sustainable bandwidth of the RAID controllers for a minimum of 2 days.

  • Very easy to do. Get yourself a copy of Windows Media Encoder [microsoft.com] (free) from Microsoft, and set it up on your PC (or another - doesnt really matter).

    Set it up to stream audio, and connect your radio to the sound card that WME is running on. Start it encoding.

    Using Windows Media Player you can connect to the encoder (either on your local machine or a network machine) and listen to the streamed audio. There will naturally be a delay, which you should be able to tweak by playing with the buffer settings in WME and WMP.

    I reckon you could get this to about 6 seconds.
    • Using Windows Media Player you can connect to the encoder (either on your local machine or a network machine) and listen to the streamed audio. There will naturally be a delay, which you should be able to tweak by playing with the buffer settings in WME and WMP.
      But what about "Any reproduction or retransmission of this broadcast... etc, etc."? Wouldn't want MLB to get on my case.
      Seriously though, good idea and I'll give it a try, along with the PD [ucsd.edu] software mentioned above.
      Thanks for all the responses.
  • by Anonymous Coward
    By the time you get it all running nicely, you would have missed the game and so it is no longer a problem.
  • use winamp (Score:3, Informative)

    by jilles ( 20976 ) on Thursday October 17, 2002 @03:42PM (#4472397) Homepage
    and set the streaming buffer to a suitable size. By default it will probably be something like 64 KB which depending on the bitrate of your audiostream may be enough. Otherwise just make it a bit larger. For a 128kbit stream you probably want to set it to 96 KB. Winamp will try to keep the buffer filled so, effectively there will be a delay proportional to the buffersize.
    • I don't think this would work since winamp can fill that buffer faster than realtime. The point of the buffer is to have some ready audio if the system gets bogged down, but with a modern processor, it can fill that buffer much much faster (if it couldn't, it could never create a buffer in the first place...think about it)
      • There's no way it can fill the buffer faster than the data is coming in. The data is coming in in real-time and is going out in real-time. So there must be a period of time between the moment the data enters the buffer and leaves it. Of course the server can momentarily send the data faster than real-time, however not on a continuous basis (certainly not in the case of a live transmission).
  • Get an old tape deck from a pawn shop, and disassemble it. Now reposition the parts so that the recording head and playback head are running separate input/output. Adjust the distance between both heads until it syncs up with your video. Tada!

    Add more playback heads and you can sell it to your neighbor as a home-made guitar delay box :)
  • by i_am_nitrogen ( 524475 ) on Thursday October 17, 2002 @04:19PM (#4472823) Homepage Journal
    I don't know if it's still around, but there was at one point a program called Audiomulch [audiomulch.com] that worked kinda like a modular synthesizer setup. It has input and output modules, and a delay module, so you can just hook the audio out from the radio to your sound card, and connect the delay in-line between the input and output.

  • by stinkydog ( 191778 ) <sd@s t r angedog.net> on Thursday October 17, 2002 @05:02PM (#4473285) Homepage
    Get a digital effects module with a delay feature [www.sfu.ca]
    .

    I have an Alesis Nanoverb [alesis.com] that I use for sound design work. You can get them on Ebay for under $100 [ebay.com]. Acording to the specs [alesis.com] you can get over 1200ms delay per channel (loop left out to right in for 2400ms or about 2.5 seconds). Correcting the delay involves turning a nice analog knob.

    The Alesis QuadraVerb [neato.org] has a full 5 seconds of delay per channel [alesis.com] and should do the trick for you for about $130 [ebay.com] .

    SD
  • So you want a TiVo for your radio? We're sorry, but with ClearChannel you just need to wait a few minutes before it's broadcast again, so there'd be no market.

  • I've seen one comment hint at this, but everyone else seems to be suggesting complex technical solutions when this is really quite simple. Winamp will stream MP3 files even while they're being written to, so all you need to do is this:
    1. Encode the audio from the radio to MP3 in realtime using the Winamp Live Input plugin.
    2. In another Winamp session, manually start playback of the file after the appropriate delay.

    Voila, it's that easy.

  • Tape both and synch them up later for viewing/listening. Oh, sorry you didn't specify that you had to be able to start watching the game before it has ended.
  • Musicians have long done audio delay using an analog tape machine with playback "taps" for trippy overlayed sound effects. Just look for DSP software designed to replicate this functionality. There are numerous possibilities for Linux or Windoze.

    Then again.. this is all a lot of work just to watch a silly sports event. (:
  • Don't radio stations buffer their own output for editing purposes? I thought I read once that radio stations buffered anywhere from 5 to 15 seconds of radio play in case something went over the air that wasn't supposed to. Maybe that's just for call-in talk-radio.
  • ..just use esound. All the lag you ever need.

    Seriously, check the esound sources for the esddsp program. Modify it so it uses a large buffer, then run it on your radio app. 20 minute job.
  • I was watching a football (soccer) game once using the superior radio commentary and the sound turned off on the TV. It came down to a penalty shoot-out and the commentator shouted "he's missed it!", a few seconds later the TV showed the striker hoofing the ball straight over the bar. Commentator must have put him off...

  • ... it's obvious folks. Get something that will let you do real-time effects (Reaktor springs to mind here). Set up a delay that's 6 seconds minus the latency in the sound card. Tweak for best results.

    Forget all this "set up a wma streaming server" etc. It's too complicated for this job.
  • My experience is that Tim McCarver is so slow witted, it sounds like the game he is watching is 6 to 8 seconds behind the one the rest of us are watching.

The Tao is like a glob pattern: used but never used up. It is like the extern void: filled with infinite possibilities.

Working...