Question about streaming on Ruby

Ask a Question related to Ruby, Design and Development.

  1. #1

    Default Question about streaming on Ruby

    This is a multi-part message in MIME format.

    ------=_NextPart_000_0644_01C340CC.AC403160
    Content-Type: text/plain;
    charset="iso-2022-jp"
    Content-Transfer-Encoding: 7bit

    I have a problem which I even don't know where to start.
    My professor asked me to build a system in Ruby which uses streaming in
    order to play voice.
    It is a system where the server will give responses to what the user says.
    So, basically if the user says "hello", the system will reply saying "Fine,
    and you?".
    At the moment I don't have to care about the voice recognition, I just have
    to
    build something that can save a sound file in the server and something where
    the user can
    press a button called "record my voice" and that as soon as the server
    finishes recording the
    user's voice, the server will play the response file.

    My question is: how to start doing this with Ruby?
    Can Ruby do this?

    I asked my friends at my lab, and one friend said I should better forget
    Ruby and use active-X.
    But my professor said I should try to develop it using Ruby.

    Rob

    ------=_NextPart_000_0644_01C340CC.AC403160
    Content-Type: text/html;
    charset="iso-2022-jp"
    Content-Transfer-Encoding: quoted-printable

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META http-equiv=3DContent-Type content=3D"text/html; =
    charset=3Diso-2022-jp">
    <META content=3D"MSHTML 6.00.2800.1170" name=3DGENERATOR>
    <STYLE></STYLE>
    </HEAD>
    <BODY bgColor=3D#ffffff>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2>I have a problem which I even =
    don't know=20
    where to start.</FONT></DIV>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2>My professor asked me to build =
    a system in=20
    Ruby which uses streaming in order to play voice.</FONT></DIV>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2>It is a system where the =
    server will give=20
    responses to what the user says.</FONT></DIV>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2>So, basically if the user says =
    "hello",=20
    the system will reply saying "Fine, and you?".</FONT></DIV>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2>At the moment I don't have to =
    care about=20
    the voice recognition, I just have to</FONT></DIV>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2>build something that can save =
    a sound file=20
    in the server and something where the user can</FONT></DIV>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2>press a button called "record =
    my voice"=20
    and that as soon as the server finishes recording the</FONT></DIV>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2>user's voice, the server will =
    play the=20
    response file.</FONT></DIV>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2>My question is: how to start =
    doing this=20
    with Ruby?</FONT></DIV>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2>Can Ruby do this?</FONT></DIV>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2>I asked my friends at my lab, =
    and one=20
    friend said I should better forget Ruby and use active-X.</FONT></DIV>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2>But my professor said I should =
    try to=20
    develop it using Ruby.</FONT></DIV>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3D"MS UI Gothic" size=3D2>Rob</FONT></DIV></BODY></HTML>

    ------=_NextPart_000_0644_01C340CC.AC403160--


    Rob Guest

  2. Similar Questions and Discussions

    1. Media Streaming Question
      We woud like to host a live video stream on our website of an event at a remote site. My question is if I can use FMS3.0 to do this, and if I...
    2. General streaming question
      While I've been a graphics guy and a tech geek for many years now, I've started getting involved with streaming video in just the past 3 months. ...
    3. Question about streaming video
      I want to do the following: A swf movie is started with a certain id (media id) the swf should then question a php script for a video. This is a...
    4. i have a question about streaming sounds?
      when i load an external mp3 like this : sound_1.loadSound("tracks/alternativeguitar.mp3", true); true meaning isStreaming does the user still...
    5. mP3 streaming question
      Hello, I want to make mp3-streaming with Flash. It works almost, but I have a problem. First I tell you what I do: I have a play-Button, an...
  3. #2

    Default Re: Question about streaming on Ruby

    Hello Rob,

    Rob wrote:
    <snip>
    > My question is: how to start doing this with Ruby?
    > Can Ruby do this?
    >
    Yes! In fact, GStreamer is probably able to do this, and you can call
    GStreamer via Ruby using Ruby-GStreamer.

    I never tried this, but I think you could record audio from the
    microphone using the osssrc element from the ossaudio plugin.

    You will find more information about GStreamer on its homepage:

    [url]http://www.gstreamer.net[/url]

    And for Ruby bindings:

    [url]http://www.freesoftware.fsf.org/ruby-gst[/url]

    Current API (CVS):

    [url]http://lrz.samika.net/ruby-gst/api/index.html[/url]

    Ruby-GStreamer 0.1.1 will be released in a few days, featuring a lot of
    improvements.

    Cheers,

    --
    Laurent


    Laurent Sansonetti Guest

  4. #3

    Default Re: Question about streaming on Ruby


    "Rob" <robson@magario.com> schrieb im Newsbeitrag
    news:064801c34081$3c812000$a8c70b85@CPQ22906761423 ...
    > I have a problem which I even don't know where to start.
    > My professor asked me to build a system in Ruby which uses streaming in
    > order to play voice.
    > It is a system where the server will give responses to what the user
    says.
    > So, basically if the user says "hello", the system will reply saying
    "Fine,
    > and you?".
    > At the moment I don't have to care about the voice recognition, I just
    have
    > to
    > build something that can save a sound file in the server and something
    where
    > the user can
    > press a button called "record my voice" and that as soon as the server
    > finishes recording the
    > user's voice, the server will play the response file.
    >
    > My question is: how to start doing this with Ruby?
    > Can Ruby do this?
    >
    > I asked my friends at my lab, and one friend said I should better forget
    > Ruby and use active-X.
    > But my professor said I should try to develop it using Ruby.
    Apart from the sound recognition stuff this sounds like an ordinary web
    application. You can have a look at eruby and I think there's an Apache
    mod_ruby.

    The difficult part - independent of programming language used - will be
    the sound recording of the user's voice.

    robert

    Robert Klemme Guest

  5. #4

    Default Re: Question about streaming on Ruby

    I forgot to mention that GStreamer is *only* available on POSIX
    operating systems, such as GNU/Linux and FreeBSD for instance.

    [url]http://gstreamer.net/status/?category=7[/url]

    --
    Laurent


    Laurent Sansonetti Guest

  6. #5

    Default Re: Question about streaming on Ruby


    What you want todo is very easy todo in Squeak.
    [url]http://www.squeak.org/[/url]

    Ciao,
    -A

    Armin Roehrl Guest

  7. #6

    Default Re: Question about streaming on Ruby

    On Wed, Jul 02, 2003 at 07:03:57PM +0900, Rob wrote:
    > press a button called "record my voice" and that as soon as the server
    > finishes recording the
    >
    > user's voice, the server will play the response file.
    >
    >
    >
    > My question is: how to start doing this with Ruby?
    >
    > Can Ruby do this?
    Sure, at worst something like:

    system("wavrec -r 5 myfile.wav")

    Or I guess you could even open /dev/audio or /dev/dsp and read/write from
    them directly.

    Cheers,

    Brian.

    Brian Candler Guest

  8. #7

    Default Re: Question about streaming on Ruby

    Hi,

    "Rob" <robson@magario.com> wrote:
    > At the moment I don't have to care about the voice recognition, I just have to
    > build something that can save a sound file in the server and something where
    > the user can press a button called "record my voice" and that as soon as the
    > server finishes recording the user's voice, the server will play the response file.
    >
    > My question is: how to start doing this with Ruby?
    > Can Ruby do this?
    >
    > I asked my friends at my lab, and one friend said I should better forget
    > Ruby and use active-X.
    > But my professor said I should try to develop it using Ruby.
    Since you mention active-X I'm assuming you might be under Windows.

    Here's a way to Play sounds in Ruby under Windows:
    [url]http://www.ruby-talk.com/55423[/url]

    As for recording... I haven't recorded under Windows, but there's a high-level
    API available for recording, that we should be able to call from Ruby.

    This page has examples using Windows' winmm.dll MCISendString function to
    both play and record sounds. The examples are in VB, but translate easily
    to Ruby using Ruby's Win32API module.
    [url]http://www.geocities.com/smigman.geo/mci/wav.html[/url]
    (Hmm.. the page seems to be down at the moment... but it's still in Google's
    cache. If you search for "MCISendString record" [without the quotes] in
    Google, this site should come up as one of the first hits, called "Visual
    Basic WAV"... then click on the 'Cached' link :)

    Here's a Ruby example using MCISendString to play a sound:

    require 'Win32API'
    MCISendString = Win32API.new("winmm", "mciSendString", ['P', 'P', 'L', 'L'], 'L')

    MCISendString.call('open m:\download\snd\columbus.wav type waveaudio alias voice1', nil, 0, 0)
    MCISendString.call('play voice1', nil, 0, 0)

    ...I've tried the above on my system and it worked.

    I haven't tried the following, but the command lines are translated from
    the above web page:

    # prepare to record in buffer called "capture"
    MCISendString("open new type waveaudio alias capture", nil, 0, 0)

    # set bits-per-sample to 8 or 16
    MCISendString("set capture bitspersample 8", nil, 0, 0)

    # set sample rate (11025, 22050, or 44100)
    MCISendString("set capture samplespersec 11025", nil, 0, 0)

    # set mono or stereo (1 or 2 channels)
    MCISendString("set capture channels 1", nil, 0, 0)

    # apparently this will record until the user presses "stop"
    MCISendString("record capture", nil, 0, 0)

    # alternately it seems you can specify a range in the buffer
    # in which to record:
    MCISendString("record capture from 2000 to 4000", nil, 0, 0)
    # ...so presumably this would allow you to record for a few
    # seconds and stop automatically without the user having to
    # click anything.

    # finally to save the buffer to a file:
    MCISendString("save capture c:\NewWave.wav", nil, 0, 0)



    .....Hmmm.... In your case, if you really need to do streaming,
    a lower-level API would probably be needed. Are you saying you'd
    need to record a sound (what the user speaks) locally, stream that
    to the server, have the server do (eventual) voice recognition, and
    respond with an audio stream back to the user?

    Since the phrases spoken are probably short, I wonder if you might
    be able to just use a non-streamed API like MCISendString? And then
    just transmit the recorded audio file to the server?

    If you really need streaming, you might want to look into this
    lower-level WAV API:
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/mmfunc_1q5q.asp[/url]

    Here's some info on caling waveInOpen() from VB, which should
    be easy to translate to Ruby's Win32API like the MCISendString
    stuff above..
    [url]http://www.mentalis.org/apilist/waveInOpen.shtml[/url]



    Hope this helps,

    Bill




    Bill Kelly Guest

  9. #8

    Default Re: Question about streaming on Ruby

    Hi, Bill.

    Thanks a lot for the hints.
    I am under Windows, but the problem is that my professor wants this
    application to be compatible
    with any kinds of servers (windows and linux).
    I was thinking that this application is similar to Yahoo voice chat, since
    it deals with streaming.
    But Yahoo voice chat also needs Windows to run.
    Is that possible to make an application for this which runs in both windows,
    mac and linux and
    can be accessed from a browser like microsoft internet explorer, mozilla or
    netscape?

    Rob

    ----- Original Message -----
    From: "Bill Kelly" <billk@cts.com>
    To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
    Sent: Wednesday, July 02, 2003 11:01 PM
    Subject: Re: Question about streaming on Ruby

    > Hi,
    >
    > "Rob" <robson@magario.com> wrote:
    > > At the moment I don't have to care about the voice recognition, I just
    have to
    > > build something that can save a sound file in the server and something
    where
    > > the user can press a button called "record my voice" and that as soon as
    the
    > > server finishes recording the user's voice, the server will play the
    response file.
    > >
    > > My question is: how to start doing this with Ruby?
    > > Can Ruby do this?
    > >
    > > I asked my friends at my lab, and one friend said I should better forget
    > > Ruby and use active-X.
    > > But my professor said I should try to develop it using Ruby.
    >
    > Since you mention active-X I'm assuming you might be under Windows.
    >
    > Here's a way to Play sounds in Ruby under Windows:
    > [url]http://www.ruby-talk.com/55423[/url]
    >
    > As for recording... I haven't recorded under Windows, but there's a
    high-level
    > API available for recording, that we should be able to call from Ruby.
    >
    > This page has examples using Windows' winmm.dll MCISendString function to
    > both play and record sounds. The examples are in VB, but translate easily
    > to Ruby using Ruby's Win32API module.
    > [url]http://www.geocities.com/smigman.geo/mci/wav.html[/url]
    > (Hmm.. the page seems to be down at the moment... but it's still in
    Google's
    > cache. If you search for "MCISendString record" [without the quotes] in
    > Google, this site should come up as one of the first hits, called "Visual
    > Basic WAV"... then click on the 'Cached' link :)
    >
    > Here's a Ruby example using MCISendString to play a sound:
    >
    > require 'Win32API'
    > MCISendString = Win32API.new("winmm", "mciSendString", ['P', 'P', 'L',
    'L'], 'L')
    >
    > MCISendString.call('open m:\download\snd\columbus.wav type waveaudio alias
    voice1', nil, 0, 0)
    > MCISendString.call('play voice1', nil, 0, 0)
    >
    > ...I've tried the above on my system and it worked.
    >
    > I haven't tried the following, but the command lines are translated from
    > the above web page:
    >
    > # prepare to record in buffer called "capture"
    > MCISendString("open new type waveaudio alias capture", nil, 0, 0)
    >
    > # set bits-per-sample to 8 or 16
    > MCISendString("set capture bitspersample 8", nil, 0, 0)
    >
    > # set sample rate (11025, 22050, or 44100)
    > MCISendString("set capture samplespersec 11025", nil, 0, 0)
    >
    > # set mono or stereo (1 or 2 channels)
    > MCISendString("set capture channels 1", nil, 0, 0)
    >
    > # apparently this will record until the user presses "stop"
    > MCISendString("record capture", nil, 0, 0)
    >
    > # alternately it seems you can specify a range in the buffer
    > # in which to record:
    > MCISendString("record capture from 2000 to 4000", nil, 0, 0)
    > # ...so presumably this would allow you to record for a few
    > # seconds and stop automatically without the user having to
    > # click anything.
    >
    > # finally to save the buffer to a file:
    > MCISendString("save capture c:\NewWave.wav", nil, 0, 0)
    >
    >
    >
    > .....Hmmm.... In your case, if you really need to do streaming,
    > a lower-level API would probably be needed. Are you saying you'd
    > need to record a sound (what the user speaks) locally, stream that
    > to the server, have the server do (eventual) voice recognition, and
    > respond with an audio stream back to the user?
    >
    > Since the phrases spoken are probably short, I wonder if you might
    > be able to just use a non-streamed API like MCISendString? And then
    > just transmit the recorded audio file to the server?
    >
    > If you really need streaming, you might want to look into this
    > lower-level WAV API:
    >
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/mmfunc_1q5q.asp[/url]
    >
    > Here's some info on caling waveInOpen() from VB, which should
    > be easy to translate to Ruby's Win32API like the MCISendString
    > stuff above..
    > [url]http://www.mentalis.org/apilist/waveInOpen.shtml[/url]
    >
    >
    >
    > Hope this helps,
    >
    > Bill
    >
    >
    >
    >

    Rob Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139