[Vorbis] Re: Write pure sine to *.ogg directly?
Gan Uesli Starling
alias at starling.us
Mon Feb 20 12:32:10 PST 2006
Monty writes:
>
> On Mon, Feb 20, 2006 at 09:39:35AM -0500, Gan Uesli Starling wrote:
>> I'd like some means of writing a pure sine wave straight
>> to *.ogg just as I currently can to *.wav (using the Perl
>> Audio::Wav module).
>
> Slightly more fundamnetally complex, but it wouldn't bee too hard if
> you're not *too* picky about the *exact* frequency you want to output.
Anywhere in the range of 750 Hz to 800 Hz is close enough. All that counts
is that it not waver to the human ear.
> What will probably suck, though, is getting ahold of a perl binding
> for libogg and enough of libvorbis to set a few packet fields.
>
>> This would involve turning on and off a sine wave of N mS
>> duration with silences between. And the leading edges of
>> these sine-wave segments require a not-too-abrupt rise time
>> to avoid what Morse folks call "key clicks" and, if I read
>> correctly, cause "pre echos" in compressed audio.
>
> I'd expect you'd want to build the tone packets directly from the
> spectral math you'd need for a given sine wave; preecho would be
> vaguely irrelevant.
I can define a sine wave in Perl easily enough, or a haversine, or
a bezier. Have done all three previously.
>> Bearing in mind that I know nothing about audio codecs beyond
>> being able to use Perl's Audio::Wav module, have I any hope of
>> accomplishing such a task in Perl with output direct to *.ogg?
>> Where would I start in such a case?
>
> Yes... but it depends on what perl bindings already exist. Building
> the vorbis packets in Perl wouldn't be too bad (I expect you only need
> a couple 'canned' packets), but stitching them into the Ogg stream
> would require a bit more code if Ogg code isn't already available.
They have some Perl modules for parsing and editing Ogg tags. But all
I have seen otherwise were just wrappers for oggenc. Guess I need to
have a look at the Ogg file format, encode some morse from *.wav using
oggenc and see if I can grok the result. Did that once for an automotive
road load data acquisition format. It took forever and wasn't fun. But
the result was worthwile...in fact, I use it quite a lot.
What docs ought I read first? And where might I find them?
Thanks,
Gan Starling, KY8D
Kalamazoo MI USA
More information about the Vorbis
mailing list