9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] sound, graphics, tuner
@ 2011-01-15 10:04 Rudolf Sykora
  2011-01-15 10:38 ` lucio
  0 siblings, 1 reply; 17+ messages in thread
From: Rudolf Sykora @ 2011-01-15 10:04 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,

Recently I came across a need to tune a musical instrument.

I tried to think how difficult it'd be to write a program which would
1) read the signal from a microphone, 2) process it, 3) show the tone
played and its deviation, possibly graphically. (In linux, lingot is
the example.)

I have a good notion about the middle task (2). So far I've never
tried to read anything from a soundcard, nor to create any graphics in
plan9. First, I am aware that in linux the soundsystem is controlled
by something called ALSA or OSS. It's always seemed to me a
complicated thing (I may be well wrong). Second, in linux there are
many graphical libraries like GTK, Qt, wxWidgets, Tk, others. Is there
anything in plan9 that could be simple to grasp and create an analog
gauge with it?

Can anybody comment this and/or possibly point me at some good documents?

Thanks
Ruda



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [9fans] sound, graphics, tuner
  2011-01-15 10:04 [9fans] sound, graphics, tuner Rudolf Sykora
@ 2011-01-15 10:38 ` lucio
  2011-01-15 12:05   ` Gorka Guardiola
  0 siblings, 1 reply; 17+ messages in thread
From: lucio @ 2011-01-15 10:38 UTC (permalink / raw)
  To: 9fans

> Can anybody comment this and/or possibly point me at some good documents?

It looks kind of easy, although I've never gone there myself.  After
all, you just need to display two lines, one fixed (you omitted to
mention that you need to specify the tone you are after) and one that
moves closer or further from the base line as the tuning is adjusted.
Two points may suffice, but they may be hard to read.

As for the audio input, I seem to recall that the audio device
delivers numeric values representing the sound, so all you need to do
is keep reading, deleting a previous display and producing a new one
as each sample is input.  Am I being overly simplistic?  It sounds
almost like a trivial shell (rc) script, if you don't need the
graphics.

++L




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [9fans] sound, graphics, tuner
  2011-01-15 10:38 ` lucio
@ 2011-01-15 12:05   ` Gorka Guardiola
  2011-01-15 18:50     ` Rudolf Sykora
  0 siblings, 1 reply; 17+ messages in thread
From: Gorka Guardiola @ 2011-01-15 12:05 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Sat, Jan 15, 2011 at 11:38 AM,  <lucio@proxima.alt.za> wrote:
>> Can anybody comment this and/or possibly point me at some good documents?
>
> It looks kind of easy, although I've never gone there myself.  After
> all, you just need to display two lines, one fixed (you omitted to
> mention that you need to specify the tone you are after) and one that
> moves closer or further from the base line as the tuning is adjusted.
> Two points may suffice, but they may be hard to read.

Aliasing... You need to read more than two points, even if you produce
only two after. Essentially I would do something like:

Read N PCM samples from the sound card, this is just a read from the
audio in file, easy part.
The samples you can read from http://plan9.bell-labs.com/magic/man2html/3/audio
audio(3) or a similar interfaces provided by usb/audio usb(4).

Calculate some sort of windowed FFT.
Find the peak (I would correlate with a moving peak shape and find a big value).
Generate the read/estimated frequency, fin.

Then you can draw the margin for the frequency  error you tolerate
which are probably two lines fthlow, fthhigh or different colors
dividing the window/output in three
parts, too high, too low and acceptable and superpose the
line depicting fin over it (something like the letonian flag).
fthlow and fthhigh can come from the user clicking on the window and
moving up and down
or from some slider (I would do the first)..

This last part, I would use draw
http://plan9.bell-labs.com/magic/man2html/2/draw
draw(2). You can use control
http://plan9.bell-labs.com/magic/man2html/2/control control(2)
to add sliders but for what you are doing just drawing rectangles and
lines should be fine.

HTH.

G.



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [9fans] sound, graphics, tuner
  2011-01-15 12:05   ` Gorka Guardiola
@ 2011-01-15 18:50     ` Rudolf Sykora
  2011-01-15 19:00       ` John Floren
  2011-01-15 20:30       ` Tristan Plumb
  0 siblings, 2 replies; 17+ messages in thread
From: Rudolf Sykora @ 2011-01-15 18:50 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> Read N PCM samples from the sound card, this is just a read from the
> audio in file, easy part.
> The samples you can read from http://plan9.bell-labs.com/magic/man2html/3/audio
> audio(3) or a similar interfaces provided by usb/audio usb(4).

Ok. To start with, audio(3) seems to support soundblaster-16-compatibles.
What about others? I guess mine could be AC'97 on one of my notebooks
(there fortunately seems to be some support for this one elsewhere,
too), while god knows what on another. Connected to this:
How do I find from within plan 9 what soundcard/hardware I have?

> This last part, I would use draw
> http://plan9.bell-labs.com/magic/man2html/2/draw
> draw(2). You can use control
> http://plan9.bell-labs.com/magic/man2html/2/control control(2)
> to add sliders but for what you are doing just drawing rectangles and
> lines should be fine.

Ok. I ask because some widget sets already have an analog-like gauge
I'd like to use, e.g. Tk::gauge. (What'd be the situation in Inferno?
They have some Tk, don't they?)

Thanks
Ruda



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [9fans] sound, graphics, tuner
  2011-01-15 18:50     ` Rudolf Sykora
@ 2011-01-15 19:00       ` John Floren
  2011-01-15 20:30       ` Tristan Plumb
  1 sibling, 0 replies; 17+ messages in thread
From: John Floren @ 2011-01-15 19:00 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Sat, Jan 15, 2011 at 10:50 AM, Rudolf Sykora <rudolf.sykora@gmail.com> wrote:
>> Read N PCM samples from the sound card, this is just a read from the
>> audio in file, easy part.
>> The samples you can read from http://plan9.bell-labs.com/magic/man2html/3/audio
>> audio(3) or a similar interfaces provided by usb/audio usb(4).
>
> Ok. To start with, audio(3) seems to support soundblaster-16-compatibles.
> What about others? I guess mine could be AC'97 on one of my notebooks
> (there fortunately seems to be some support for this one elsewhere,
> too), while god knows what on another. Connected to this:
> How do I find from within plan 9 what soundcard/hardware I have?
>
>> This last part, I would use draw
>> http://plan9.bell-labs.com/magic/man2html/2/draw
>> draw(2). You can use control
>> http://plan9.bell-labs.com/magic/man2html/2/control control(2)
>> to add sliders but for what you are doing just drawing rectangles and
>> lines should be fine.
>
> Ok. I ask because some widget sets already have an analog-like gauge
> I'd like to use, e.g. Tk::gauge. (What'd be the situation in Inferno?
> They have some Tk, don't they?)
>
> Thanks
> Ruda
>
>

If you're tuning a wind instrument, you could just print out the
frequency of middle C and then display the calculated frequency coming
into the microphone below it.

For a guitar tuner, just print out more frequencies (EADGBE)... this
is the lazy man's way to do it, but it would be a way to test it at
first, at least.

If I wanted to make it fancy and graphical, I'd have a horizontal
line, bisected in the center by a vertical line representing the
target frequency, then draw another moving vertical line to represent
the current frequency.


John



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [9fans] sound, graphics, tuner
  2011-01-15 18:50     ` Rudolf Sykora
  2011-01-15 19:00       ` John Floren
@ 2011-01-15 20:30       ` Tristan Plumb
  2011-01-16  3:52         ` Venkatesh Srinivas
  1 sibling, 1 reply; 17+ messages in thread
From: Tristan Plumb @ 2011-01-15 20:30 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> To start with, audio(3) seems to support soundblaster-16-compatibles.
> What about others?
to my knowledge you have: soundblaster comptibles, usb thingys, and
kirkwood. (the kirkwood driver is in my contrib, it's my 1½st driver, so
beware. oh, and record isn't tested (and I would guess doesn't work)).
hum, drawterm too (which is a bit of a corner case).

that said, the audio interface is pretty simple, and if your card is
reasonable (not my laptop) i doubt it would be hard to write, the mixing
interface has a lot of faces (which is why i havn't annoyed geoff with
the kw yet), but that won't matter for you.

> How do I find from within plan 9 what soundcard/hardware I have?
pci(1)?

enjoy,
tristan

--
All original matter is hereby placed immediately under the public domain.



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [9fans] sound, graphics, tuner
  2011-01-15 20:30       ` Tristan Plumb
@ 2011-01-16  3:52         ` Venkatesh Srinivas
  2011-01-16  4:00           ` Jacob Todd
                             ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Venkatesh Srinivas @ 2011-01-16  3:52 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 114 bytes --]

There exist two different AC97 drivers; look at the port of Doom to plan9
for pointers to one of them.

-- vs

[-- Attachment #2: Type: text/html, Size: 139 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [9fans] sound, graphics, tuner
  2011-01-16  3:52         ` Venkatesh Srinivas
@ 2011-01-16  4:00           ` Jacob Todd
  2011-01-16 19:20           ` [9fans] 9doom Lyndon Nerenberg (VE6BBM/VE7TFX)
  2011-01-17 13:30           ` [9fans] sound, graphics, tuner Pavel Klinkovsky
  2 siblings, 0 replies; 17+ messages in thread
From: Jacob Todd @ 2011-01-16  4:00 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 75 bytes --]

The hg repo for 9doom has been down for ages, so that's not possible atm.

[-- Attachment #2: Type: text/html, Size: 86 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [9fans] 9doom
  2011-01-16  3:52         ` Venkatesh Srinivas
  2011-01-16  4:00           ` Jacob Todd
@ 2011-01-16 19:20           ` Lyndon Nerenberg (VE6BBM/VE7TFX)
  2011-01-16 19:24             ` Jacob Todd
  2011-01-16 19:27             ` John Floren
  2011-01-17 13:30           ` [9fans] sound, graphics, tuner Pavel Klinkovsky
  2 siblings, 2 replies; 17+ messages in thread
From: Lyndon Nerenberg (VE6BBM/VE7TFX) @ 2011-01-16 19:20 UTC (permalink / raw)
  To: 9fans

Does anyone have a copy of the 9doom code they could put up on
contrib?




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [9fans] 9doom
  2011-01-16 19:20           ` [9fans] 9doom Lyndon Nerenberg (VE6BBM/VE7TFX)
@ 2011-01-16 19:24             ` Jacob Todd
  2011-01-16 19:27             ` John Floren
  1 sibling, 0 replies; 17+ messages in thread
From: Jacob Todd @ 2011-01-16 19:24 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 219 bytes --]

I emailed james yesterday, no response yet.
On Jan 16, 2011 2:22 PM, "Lyndon Nerenberg (VE6BBM/VE7TFX)" <
lyndon@orthanc.ca> wrote:
> Does anyone have a copy of the 9doom code they could put up on
> contrib?
>
>

[-- Attachment #2: Type: text/html, Size: 357 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [9fans] 9doom
  2011-01-16 19:20           ` [9fans] 9doom Lyndon Nerenberg (VE6BBM/VE7TFX)
  2011-01-16 19:24             ` Jacob Todd
@ 2011-01-16 19:27             ` John Floren
  2011-01-16 20:29               ` Jacob Todd
  1 sibling, 1 reply; 17+ messages in thread
From: John Floren @ 2011-01-16 19:27 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Sun, Jan 16, 2011 at 11:20 AM, Lyndon Nerenberg (VE6BBM/VE7TFX)
<lyndon@orthanc.ca> wrote:
> Does anyone have a copy of the 9doom code they could put up on
> contrib?
>
>
>

Did it ever get to a playable point?

Of course, even if it wasn't playable, the source should be instructive.

John



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [9fans] 9doom
  2011-01-16 19:27             ` John Floren
@ 2011-01-16 20:29               ` Jacob Todd
  2011-01-17  0:52                 ` Joel C. Salomon
  0 siblings, 1 reply; 17+ messages in thread
From: Jacob Todd @ 2011-01-16 20:29 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 172 bytes --]

http://jtomaschke.blogspot.com/

James was able to get the renderer working, and it could play through demos.
It even had sound. Input needed to be worked out, though.

[-- Attachment #2: Type: text/html, Size: 229 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [9fans] 9doom
  2011-01-16 20:29               ` Jacob Todd
@ 2011-01-17  0:52                 ` Joel C. Salomon
  2011-01-17  8:11                   ` James Tomaschke
  0 siblings, 1 reply; 17+ messages in thread
From: Joel C. Salomon @ 2011-01-17  0:52 UTC (permalink / raw)
  To: 9fans

On 01/16/2011 03:29 PM, Jacob Todd wrote:
> http://jtomaschke.blogspot.com/
<snip>
> Input needed to be worked out, though.

That’s nothing new: <http://9fans.net/archive/1995/09/281>.

—Joel






^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [9fans] 9doom
  2011-01-17  0:52                 ` Joel C. Salomon
@ 2011-01-17  8:11                   ` James Tomaschke
  0 siblings, 0 replies; 17+ messages in thread
From: James Tomaschke @ 2011-01-17  8:11 UTC (permalink / raw)
  To: 9fans

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I did modify my keyboard driver to get it to be playable.

It required an 8-bit display and would update the vga palette for some
of the visual effects.

Don't remember which AC'97 driver I was using, but at the time there
were only two that I came across.

I'll see if I can dig up the harddrive the source is on, I lost the host
system when Solaranite caused my capacitors to 'splode.  If I can't find
it, it's not difficult to reproduce.  It only took me a few days to port
to a point where it would play the demos with sound.

On 01/16/11 16:52, Joel C. Salomon wrote:
> On 01/16/2011 03:29 PM, Jacob Todd wrote:
>> http://jtomaschke.blogspot.com/
> <snip>
>> Input needed to be worked out, though.
>
> That’s nothing new: <http://9fans.net/archive/1995/09/281>.
>
> —Joel
>
>
>
>
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0z+cEACgkQl3JZTBu3/9mJ6ACeKJupJ2EDRotmlbg4QLEr1taE
Xm8An1Hz8+hFv37uTxfubbliff1/3Q1g
=IzAm
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [9fans] sound, graphics, tuner
  2011-01-16  3:52         ` Venkatesh Srinivas
  2011-01-16  4:00           ` Jacob Todd
  2011-01-16 19:20           ` [9fans] 9doom Lyndon Nerenberg (VE6BBM/VE7TFX)
@ 2011-01-17 13:30           ` Pavel Klinkovsky
  2011-01-17 14:52             ` Jacob Todd
  2 siblings, 1 reply; 17+ messages in thread
From: Pavel Klinkovsky @ 2011-01-17 13:30 UTC (permalink / raw)
  To: 9fans

> There exist two different AC97 drivers; look at the port of Doom to plan9
> for pointers to one of them.
I have my IBM Think Pad with AC'97 running Plan9.
The AC'97 driver supports only output mode.
Any link to some different driver supporting also input mode?

Pavel



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [9fans] sound, graphics, tuner
  2011-01-17 13:30           ` [9fans] sound, graphics, tuner Pavel Klinkovsky
@ 2011-01-17 14:52             ` Jacob Todd
  2011-01-17 16:53               ` Federico G. Benavento
  0 siblings, 1 reply; 17+ messages in thread
From: Jacob Todd @ 2011-01-17 14:52 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 615 bytes --]

http://www.cs.cmu.edu/~412/history/2006F/ac97

There's no source there, but you could probably find an email address at
http://www.cs.cmu.edu/~412 for someone who does have the source. It could be
on sources, though,  I haven't checked.
On Jan 17, 2011 8:36 AM, "Pavel Klinkovsky" <pavel.klinkovsky@gmail.com>
wrote:
>> There exist two different AC97 drivers; look at the port of Doom to plan9
>> for pointers to one of them.
> I have my IBM Think Pad with AC'97 running Plan9.
> The AC'97 driver supports only output mode.
> Any link to some different driver supporting also input mode?
>
> Pavel
>

[-- Attachment #2: Type: text/html, Size: 914 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [9fans] sound, graphics, tuner
  2011-01-17 14:52             ` Jacob Todd
@ 2011-01-17 16:53               ` Federico G. Benavento
  0 siblings, 0 replies; 17+ messages in thread
From: Federico G. Benavento @ 2011-01-17 16:53 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

http://plan9.bell-labs.com/sources/contrib/mason/ac97.tgz
aki's driver + a sys version added, the original used to be
at 9grid.net

On Mon, Jan 17, 2011 at 11:52 AM, Jacob Todd <jaketodd422@gmail.com> wrote:
> http://www.cs.cmu.edu/~412/history/2006F/ac97
>
> There's no source there, but you could probably find an email address at
> http://www.cs.cmu.edu/~412 for someone who does have the source. It could be
> on sources, though,  I haven't checked.
>
> On Jan 17, 2011 8:36 AM, "Pavel Klinkovsky" <pavel.klinkovsky@gmail.com>
> wrote:
>>> There exist two different AC97 drivers; look at the port of Doom to plan9
>>> for pointers to one of them.
>> I have my IBM Think Pad with AC'97 running Plan9.
>> The AC'97 driver supports only output mode.
>> Any link to some different driver supporting also input mode?
>>
>> Pavel
>>
>



-- 
Federico G. Benavento



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2011-01-17 16:53 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-15 10:04 [9fans] sound, graphics, tuner Rudolf Sykora
2011-01-15 10:38 ` lucio
2011-01-15 12:05   ` Gorka Guardiola
2011-01-15 18:50     ` Rudolf Sykora
2011-01-15 19:00       ` John Floren
2011-01-15 20:30       ` Tristan Plumb
2011-01-16  3:52         ` Venkatesh Srinivas
2011-01-16  4:00           ` Jacob Todd
2011-01-16 19:20           ` [9fans] 9doom Lyndon Nerenberg (VE6BBM/VE7TFX)
2011-01-16 19:24             ` Jacob Todd
2011-01-16 19:27             ` John Floren
2011-01-16 20:29               ` Jacob Todd
2011-01-17  0:52                 ` Joel C. Salomon
2011-01-17  8:11                   ` James Tomaschke
2011-01-17 13:30           ` [9fans] sound, graphics, tuner Pavel Klinkovsky
2011-01-17 14:52             ` Jacob Todd
2011-01-17 16:53               ` Federico G. Benavento

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).