Programming sound

Lee Braiden lee_b at digitalunleashed.com
Mon Sep 5 15:58:04 UTC 2005


On Monday 05 September 2005 16:33, Søren Hauberg wrote:
> Lee Braiden wrote:
> > On Monday 05 September 2005 15:49, Søren Hauberg wrote:
> >>As a minimum I need to be able to do a:
> >>      play_sine_wave( 440Hz )
> >
> > Can't help on that; sorry.  Shouldn't be too hard to find though :)
>
> I don't think so either, I just can't seem to find one anyway :-(

Well, I know the PC speaker interface takes a frequency param, if that 
helps ;)

> >>But it would also be nice if I had more advanced functions, like being
> >>able to synthesize a guitar, piano, or something similar without having
> >>to write a synthesizer from scratch.
> >
> > Sounds like you want a MIDI library for this.
>
> I don't know the first thing about sound (I'm into image processing),
> but I thought MIDI was a sound format. Is it something I can use for
> real-time programming?

MIDI stands for Musical Instrument Digital Interface.  It's basically a 
standardised programming language, which musical instruments like 
synthesisers understand.  For example, you can connect your electronic 
keyboard to a computer via a midi interface, then send it MIDI commands to 
play note X using instrument Y, volume Z, reverb A, etc.  If your sound 
card's driver supports MIDI synthesising, or you set up a software 
synthesiser, you can also send MIDI commands to /dev/sequencer (I think 
that's the right one), and get a similar result.

The MIDI file formats came about, I guess, because electronic keyboards have 
disk drives, and allow saving compositions.  So... yes, it's all related, 
just a bit bigger than you realised :)

p.s.: there are libraries which will play midi files directly for you, if you 
compose them earlier in MIDI sequencing software.  Or, you might want to look 
into "tracker" software, which is similar to a MIDI sequencer in purpose, but 
more computer-oriented, and game-oriented.  I know that they DO usually 
support things like simple sine waves.  Again, you can save tracker 
compositions to files, and just play them using libraries like mikmod from 
within your software.

-- 
Lee Braiden
http://www.DigitalUnleashed.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20050905/6a9dda08/attachment.pgp>


More information about the ubuntu-users mailing list