How to embarrass yourself with a piece of Python code

Everything and anything, but nothing about the LinuxSampler project.
Post Reply
User avatar
dahnielson
Moderator
Posts: 632
Joined: Wed Jan 23, 2008 11:25 pm
Location: Linköping / Tranås, Sweden
Contact:

How to embarrass yourself with a piece of Python code

Post by dahnielson » Sat Mar 01, 2008 1:09 am

0. Keep you monitor system switched on the whole day (as usual) and forget about it.

1. Make sure it's in the middle of the night and that all your neighbors are home.

2. Dip your toes into SndObj and write the simplest thing that could possibly work:

Code: Select all

import sndobj
import time

tab = sndobj.HarmTable()
osc = sndobj.Oscili(tab, 440, 16000)

outp = sndobj.SndJackIO("example")
outp.SetOutput(1, osc)

mod = sndobj.Oscili(tab, 2, 44)
osc.SetFreq(440, mod)

thread = sndobj.SndThread()
thread.AddObj(mod)
thread.AddObj(osc)
thread.AddObj(outp, sndobj.SNDIO_OUT)

thread.ProcOn()
time.sleep(30)
thread.ProcOff()
3. Run it.

:oops:

(I'm actually glad I didn't use any headphones.)
Last edited by dahnielson on Sat Mar 01, 2008 2:19 am, edited 2 times in total.
Anders Dahnielson

Ardour2, Qtractor, Linuxsampler, M-AUDIO Delta 1010, Axiom 61, Korg D12, AKAI S2000, E-MU Proteus 2k, Roland R-5, Roland HP 1300e, Zoom RFX-1000, 4GB RAM x86_64 Intel Pentium Dual 1.80GHz Gentoo Linux

User avatar
Consul
Moderator
Posts: 189
Joined: Wed Jan 23, 2008 11:19 pm
Location: Port Huron, Michigan, USA
Contact:

Re: How to embarrass yourself with a piece of Python code

Post by Consul » Sat Mar 01, 2008 2:02 am

I'm going to take a guess and say that the neighbors a half-mile down heard it? :D
Darren Landrum

User avatar
dahnielson
Moderator
Posts: 632
Joined: Wed Jan 23, 2008 11:25 pm
Location: Linköping / Tranås, Sweden
Contact:

Re: How to embarrass yourself with a piece of Python code

Post by dahnielson » Sat Mar 01, 2008 2:15 am

:D

I realized that "amplifier" is a misnomer in any synthesis signal path, what the above is missing is an attenuator since 1.0f is 0db and I don't have any volume control sitting between my audio interface and the monitors. At least I now know that I can get near maximum volume without distortion for any 440 Hz tone.

All I wanted to know was if it showed up in QJackCtl...
Anders Dahnielson

Ardour2, Qtractor, Linuxsampler, M-AUDIO Delta 1010, Axiom 61, Korg D12, AKAI S2000, E-MU Proteus 2k, Roland R-5, Roland HP 1300e, Zoom RFX-1000, 4GB RAM x86_64 Intel Pentium Dual 1.80GHz Gentoo Linux

Post Reply