Tormods blog

Feed on Posts 04 September 2010

Category ArchiveTechnical stuff



Technical stuff &Uncategorized Tormod Ravnanger Landet on 26 Jan 2010

Digital TV med CAM og kabel fra Canal Digital

Jeg kjøpte meg en CA-modul (CAM/CI/Common Interface) på Lefdal etter at jeg hørte at Canal Digital endelig hadde godkjent en slik for bruk i kabelnettet. Dette betyr at hvis man har en avansert nok TV vil man kunne ta inn digital-TV på kabelnettet uten å kjøpe en stygg og dyr boks. I stedet må du kjøpe en dyr CA-modul (jeg betalte 1095,- kr) og 299,- i året i kortleie fra Canal Digital.

Etter å ha kjøpt CAM-en ventet jeg litt under en uke før jeg fikk smart-kortet og en antennekabel fra Canal Digital. Så begynte moroa … Det viser seg at TV-en min ikke er så glad i norsk digital kabel-TV (DVB-C). Jeg visste at den ikke var på lista over godkjente tv-er, men jeg hadde håpet at det skulle fungere (jeg var litt vag i butikken om hvilken modell jeg hadde så jeg fikk kjøpe CAM likevel). Etter litt undersøkelser viser det seg at det er mulig å få det til å fungere, men det er en del mikk.

Bruksanvisning for Samsung A676:

Sett inn CAM som beskrevet i bruksanvisningen. Hvis du går inn på CI-menyen vil det stå at abonnementet ditt er gyldig til 1990. Ikke bra. TV-en finner heller ingen kanaler. Løsningen er:

  • Sett språk til finsk på digital tv (ikke analog)
  • Velg manuelt søk og så kabel-tv
  • Velg symbol rate: 6950 kS/s og QAM 64 (256 på noen få frekvenser det 64 ikke fungerer. Disse sender HD tror jeg)
  • Punch inn alle frekvensene under. 80% funker med QAM 64 og resten fungerer (med noen få unntak) med QAM 256. Vet ikke om det er noe på disse eller om det er mulig å få inn noe mer. Det kan være at frekvensene er geografisk bestemt.

    - 290000 MHz (QAM 256)
    - 298000 MHz (QAM 256)
    - 306000 MHz
    - 314000 MHz
    - 322000 MHz
    - 330000 MHz (tom?)
    - 338000 MHz (tom?)
    - 346000 MHz
    - 354000 MHz
    - 362000 MHz
    - 370000 MHz
    - 378000 MHz
    - 386000 MHz
    - 394000 MHz
    - 402000 MHz
    - 410000 MHz
    - 418000 MHz
    - 426000 MHz
    - 434000 MHz (QAM 256)
    - 442000 MHz (tom?)
    - 450000 MHz
    - 458000 MHz
    - 466000 MHz (QAM 256)
    - 474000 MHz
    - 482000 MHz
    - 490000 MHz
    - 498000 MHz

    Data fra her og her. Det kan være det mangler noen frekvenser i lista. Det kan også være at du må søke gjennom alle frekvensene i ny og ne for å finne kanaler som er lagt til. Ikke helt ideelt altså.

    Etter en stund fikk jeg ikke lenger melding om at kanalene var sperret og CI-menyen viste at noe var oppdatert og at gyldighetsdatoen nå var 2010. Jeg fikk plutselig inn alle kanaler, men jeg tror dette er et lokkemiddel og at Canal+ etc blir blokkert etter en stund (når du er passelig hekta).

Hvis du ikke gidder å kjøpe CAM til en tusenlapp før du finner ut om det fungerer for deg så skal det visst være mulig å gjøre alt det som står over også uten CAM. Du vil da få melding om at alle kanalene er blokkert, men du skal kunne søke dem inn og få opp TV-guide etc. Tv-guidene er jo også en av grunnene til å ha digital-TV. Samsung sin er litt (som i VELDIG) mye penere enn den som er på Canal Digital sine bokser. Hvorfor kjøpe boks til 3000 kr og TV til vesentlig mer når du ender opp med verdens styggeste menysystem? Det frister i alle fall ikke meg. Nå er det bare å håpe på at det kommer PVR-er som støtter CAM-modulen min og som har hakket lekrere menysystem enn boksen til Canal Digital. Jeg betaler gladelig litt mellomlegg for å slippe å ha noe så stygt i stua.

Jeg har en Samsung LE40A676A1WXXE, men jeg tror det skal fungere på andre TV-er i samme serien, altså LExxA676. Disse er RiksTV-godkjent (DVB-T).

Moralen er: kjøper du ny TV og vil være sikker på at det fungerer, sjekk lista over godkjente TV-er på www.canaldigital.no. Har du en A676 fra 2008/2009 så kan du få det til å fungere likevel, men det er en del mikk.



English posts &Not on frontpage &Technical stuff Tormod Ravnanger Landet on 19 Jun 2009

Streaming audio from Spotify on Linux to Squeezebox

I have tried the WaveInput route for SqueezeCenter, but due to a non-cooperative sound card and various problems with permissions related to SqueezeCenter running as a limited user I decided to go another route and stream sound from my Linux laptop via Icecast. If you want try using WaveInput and have the same problems with recording from the sound card as I have (it plain doesn’t work with arecord and friends) there is a recipe here that might work for you.

PulseAudio

I need to use PulseAudio to get recording of sound played through the sound card to work as my Intel sound card refuses to allow me to record the sound directly. Luckily PulseAudio finally works OK for me now. I configured Wine with padsp winecfg and chose the OSS output driver for sound (ALSA works poorly at the moment). Now, run Spotify as padsp wine spotify.exe. Spotify should pop up in your PulseAudio Volume Control (pavucontrol) in the Playback tab.

You need to define a PulseAudio sink that is different from the normal (output to PC speakers). I chose to call this sink spotify. Create the sink with the following command.

pactl load-module module-null-sink sink_name=spotify

The sink should pop up in the volume control under the Output Devices tab. Next, select this sink as the default for Spotify in the Playback tab (click the small down-arrow and choose Move Stream and then Null Output).

Icecast

You can run Icecast with a minimalistic configuration. I used the minimal example (/usr/share/doc/icecast2/icecast_minimal.xml.dist on Ubuntu) where I modified the passwords and the log directory (I set the log directory a directory where I have write permissions so that I can run Icecast as my own user). Start Icecast with

icecast2 -c icecast.xml

Gstreamer

Finally I take the spotify PulseAudio sink and channel it to Icecast by use of Gstreamer. The magic command is (in one line).

gst-launch-0.10 pulsesrc device=spotify.monitor ! audioconvert ! vorbisenc bitrate=300000 ! oggmux ! shout2send ip=localhost port=8000 password=PASSWORD mount=stream.ogg

The bit rate is set to the highest I could use without getting error messages (300kbps). I assume this is pretty transparent and does not degrade the 160kbps Spotify output much.

Now tune your Squeezebox to URL http://ip-address-of-linux-machine:8000/stream.ogg. Modify the file name and port according to your configuration.

Comments are disabled on this article due to problems with spam. Somehow spammers believe that link-spamming this page with praise for the article will send them lots of readers or google-points or something …



English posts &Not on frontpage &Technical stuff Tormod Ravnanger Landet on 24 Oct 2008

Full screen music info

I’ve written a short program to show the currently playing song in a full screen view to avoid having to walk over to the computer when I want to know what the current song is called. The Squeezebox has mostly made this obsolete as I now just look at the screen on the hand held Squeezebox Controller, but it’s still nice to have once in a while so I decided to put it up for you to play with if you find it useful. it looks like this in full screen mode:

Marit Larsen - This Is Me, This Is You - The Chase

Supported programs are Amarok (pre KDE4/QT4), Spotify and SqueezeCenter. You probably need to run some sort of Unix OS, at least for the Amarok support to work (it uses dcop from the command line).

The program with a short description can be found here: full screen music info.

Tags: , ,

English posts &Not on frontpage &Technical stuff Tormod Ravnanger Landet on 17 Oct 2008

Using jsMath in MoinMoin with ReStructuredText

This is not a typical post for this blog, but it was just convenient to put the following here. Feel free to skip this post if you are reading this blog for the normal content and haven’t gotten here by searching for just this.

I spent a few hours at work today researching how best to add math (displayed equations) support to the docutils ReStructuredText parser for use with the MoinMoin wiki engine. I put my findings up here for the search engines to pick up in case more people need this.

The best solution today seems to be jsMath. It is more versatile than the various LaTeX -> dvi -> png solutions (and easier to set up). It is also much better supported than MathML.

Docutils, which is the library used by MoinMoin to render ReStructuredText to html, does not yet support math natively (as of version 0.6). Fortunately it can easily be extended with new directives. The only thing you need to do is add the following code to a Python file that is executed while rendering your wiki pages. The theme module is a good place, just stick the following at the bottom of your theme’s .py file:

# LaTeX support
from docutils.parsers.rst import directives, roles
from docutils import nodes

def latex_directive(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine):
    latex = '\n'.join(content)
    return [nodes.raw('', '\\['+latex+'\\]', format='html')]

latex_directive.content = 1
directives.register_directive('latex', latex_directive)

def latex_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
    latex = rawtext.split('`')[1].replace('\\\\','\\')  # Restore escaped backslashes
    return [nodes.raw(rawtext, '\\('+latex+'\\)', format='html')], []

roles.register_canonical_role('latex', latex_role)

This is a bit of a hack as it uses the old style function-as-directive model, but hey, it works, and I did not even know of docutils directives until today, so working is most definitely a big plus :-) It is based on this, but simplified a whole lot due to using jsMath to render the LaTeX equations.

You also need to include

 <script type="text/javascript" src="/path/to/jsMath/easy/load.js"></script>

somewhere in your html code. I put it in the page header with an ugly hack by adding the script to the output around line 680 of MoinMoin/theme/__index__.py. It can (and should) probably go in your theme’s .py file somewhere so that it does not disappear when MoinMoin is upgraded. I did not bother to do this for testing purposes, though.

Now you can write :latex:`e^{i\pi} + 1 = 0` in your wiki pages and it should be rendered to \(e^{i\pi} + 1 = 0\) in the final output (which seems like a small change, but believe me, it is easier this way then double backslashing the LaTeX code in the wiki page. You can also have displaymath equations with the following syntax:

.. latex::
   e^{quation} g_{oes} = here

which is turned into

\[
  e^{quation} g_{oes} = here
\]

The \( ... \) and \[ ... \] is picked up by jsMath and turned into beautiful equations (depending on field of work and definition of beautiful ;-) ). For non-javascript enabled browsers the code is left as is, so the equation can still be deciphered by LaTeX savvy readers. See here for examples of what jsMath can do.

So, in the end it was fairly easy to get good looking math support in MoinMoin. Hopefully docutils will come with jsMath support in the future. The new upcoming 0.5 version of Sphinx seems to do, and it is based on docutils and ReST. Shinx is a new documentation power tool for Python developers. Highly recommended to make documenting code a bit more fun.

Comments are disabled on this article due to problems with spam. Somehow spammers believe that link-spamming this page with praise for the article will send them lots of readers or google-points or something …

Tags: , , ,