Mittwoch, 16. Februar 2011

Teamspeak 3 Wav to Mp3

This is rather a note to myself. If you try to convert a wav-file with Lame, which had been written by Teamspeak 3, you'll probably encounter the following error:

Unsupported data format: 0x0003

One solution is, to resample it with Sox:

sox ts3.wav -b 16 -r 44100 converted.wav

Now, you may convert it with lame (or oggenc):

lame -V9 converted.wav final.mp3

or directly by piping:

sox ts3.wav -b 16 -r 44100 -t wav - | lame \
-V9 - final.mp3


I've chosen -V9 since that voice quality was still good for me. The original file had 906 MB, the other wav (generated by Sox) had 417 MB. I finally got mp3's of 18 MB (with -V9) and 26 MB (with -V8).

Montag, 4. Januar 2010

PrimaCom Internet verteilen mit Knoppix

Wenn Sie einen PrimaCom-Anschluss besitzen und das hier lesen, werden sie vermutlich bemerkt haben, dass im Windows für die LAN Verbindung keine Internetverbindungsfreigabe möglich ist. Das liegt möglicherweise daran, dass das PrimaCom-Gerät sich einmalig den erstbesten Rechner sucht, und ihm eine dynamische, externe IP zuweist. Über diese wird dann kommuniziert. Es ist eben ein "Cable-Modem", das via Ethernet funktioniert, zum Leidwesen aller Windows-User, die nur eine Netzwerkkarte haben - oder grad keinen Hardware-Router zur Hand. Aber es gibt ja zum Glück noch andere Systeme. Mit Knoppix lässt sich alles ordentlich dahin routen wo es hin soll.

Wir wollen:
  • Beliebig viele PCs online haben
  • Ohne Hardware-Router
  • Mit nur einer Netzwerkkarte pro PC
Was man dafür braucht:
  • Einen Hub oder Switch
  • Einen Rechner auf dem Knoppix dann laufen wird (oder ein anderes Linux)
Letzteres sollte idealerweise das Gerät sein, auf das das Modem standardmäßig anspricht. Sollte dies nicht der Fall sein, könnte eventuell ein Modem-Reset von Nöten sein, was ich allerdings nicht ausprobiert habe.

So sieht die Konfiguration dann aus:
|---------|        ________        _____________
| Knoppix |_______| Switch | _| PrimaCom |
| PC | #-oooo-o-# / | Cable-Modem |
|---------| || \____/ #-------------#
||
|---------| || |---------|
| Anderer |_________||____________| Anderer |
| PC 1 | | PC 2 |
|---------| |---------|
Wenn kein Crosskabel vorhanden ist, kommt das Modem an den Uplink-Port des Switches (die sind meistens extra gekennzeichnet). Wenn der PC mit Knoppix startet, müssten die Netzwerkeinstellungen für's Internet schon korrekt sein.

Unter Knoppix dann folgendes (mit sudo davor, wenn es Probleme mit den Berechtigungen gibt):

  • ifconfig eth0:1 192.168.0.1 netmask 255.255.255.0 up
  • sysctl net.ipv4.ip_forward=1
  • iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Nun gibt es für die anderen Geräte zwei Möglichkeiten:

A) Manuelle Konfiguration
B) Automatische Konfiguration

A geht mit Linux so:

  • ifconfig eth0 192.168.0.2 netmask 255.255.255.0 up
  • route add default gw 192.168.0.1
  • echo "nameserver 8.8.8.8" >> /etc/resolv.conf

Und für Windows:

  • IP-Adresse: 192.168.0.2
  • Subnetzmaske: 255.255.255.0
  • Standardgateway: 192.168.0.1
  • DNS: 8.8.8.8
Natürlich brauch der nächste Rechner dann 192.168.0.3 usw.

Für Möglichkeit B muss ein DHCP Server auf dem Knoppix Rechner eingerichtet werden.

Das Cable-Modem ist ansich nicht schlecht. Vor allem mag ich den dicken, großen Knopf zum An- und Ausschalten. Es bietet zwar einen DHCP Server, aber keine Routing Funktionalität. Warum man nun scheinbar ausschließlich durch einen Reset des Modems den Zielrechner ändern kann... tja. Als langfristige Lösung bietet sich am Besten ein wLan Hardware-Router an.

Mittwoch, 25. November 2009

PXE Odyssey

Booting via network is a nice thing, when it works. I tried to boot my laptop (which didn't recognize my CDRW) with the help of another Windows machine to finally install a Linux distribution from the Internet. At first, the best solution wasn't obvious. You'll need a few server apps which are all nicely integrated into a program which goes by the name tftpd32. Next prerequisites are some files (bootloader, installer...) which will be actually loaded into the target machine. Just follow the instructions of this excellent post.

I had a few problems, though. Unfortunally, PXE error messages aren't very enlightening. At best you'll be able to find out to which server application the error message is referring to. For example I got that one:

PXE-E53: No boot filename received

I don't know why it happened. I guess it simply asked the wrong DHCP server (although I saw that tftpd32 was correctly responding). As soon as I removed my DSL router, I got another error:

PXE-E51: No DHCP or proxyDHCP offers were received

Guess this is another DHCP problem :-). He claims that he didn't receive an offer from tftpd32, and he's a damn liar. tftpd32 told me otherwise. I struggled around for a half an hour and got it finally done. I read something on the net about Full-Duplex problems and so on... well, nonsense. Solution was to go back to basic. I put both machines on a switch, configured the windows network adapter manually just with 192.168.0.1 / 255.255.255.0, adjusted "IP pool starting address" in tftpd32 to 192.168.0.2, made the default router 192.168.0.1 and it worked. Well, DHCP worked, but not TFTP:

PXE-E32: TFTP open timeout

tftpd32 told me this instead:

Rcvd DHCP Discover Msg for IP 0.0.0.0, Mac 00:00:39:59:11:B4 [24/11 22:14:37.161]
DHCP: proposed address 192.168.0.1 [24/11 22:14:37.161]
2868 Request 2 not processed [24/11 22:14:37.239]
Rcvd DHCP Rqst Msg for IP 0.0.0.0, Mac 00:00:39:59:11:B4 [24/11 22:14:38.145]
Previously allocated address 192.168.0.1 acked [24/11 22:14:38.145]
Connection received from 192.168.0.1 on port 2070 [24/11 22:14:38.161]
Read request for file <pxelinux.0>. Mode octet [24/11 22:14:38.161]
OACK: <blksize=1456,> [24/11 22:14:38.161]
Using local port 55153 [24/11 22:14:38.161]
2868 Request 2 not processed [24/11 22:14:38.208]
File <pxelinux.0> : error 10054 in system call recv An existing connection was forcibly closed by the remote host. [24/11 22:14:38.270]

Okay. That is, he tries to read 1456 bytes from pxelinux.0 and closes the connection. Something went wrong at the remote machine. The laptop doesn't remember and simply says "timeout". So I tried lots of things. Shortened the directory names (C:\pxe\...), tried other pxelinux.0 files and so on.

Nothing changed, till I deleted everything except tftpd32.exe/.ini and pxelinux.0 and suddenly the laptop complained about several missing files (e.g. pxelinux.cfg/default). So I added step-by-step the remaining files and it worked. It loaded all files necessary for booting the debian installer. I switched back cables and re-configured network connections (also in the installer) and could complete the installation. Happy end with PXE.