Package: pydv
pydvCollection of Python code to experiment with D-STAR and the proposedvocoder extensionthat allows the use of the open sourceCodec 2with D-STAR.Provides Python interfaces to manage DExtra and DPlus connections (protocols used by reflectors), convert from network data to D-STAR streams (header and frames) and vice versa, as well as encode and decode voice data usingmbelib(decode only) andcodec2, and transcode using an AMBEd server (the version included in myxlxd fork).Installs the following executables:dv-recorder, which connects to a reflector and records traffic in .dvtool filesdv-player, which plays back a .dvtool file to a reflectordv-encoder, which converts a .wav fle to a .dvtool file using the Codec 2 vocoderdv-decoder, which converts a .dvtool file using any vocoder to .wavdv-transcoder, which connects to an AMBEd server and converts a .dvtool file using the AMBE vocoder to a .dvtool file using the Codec 2 vocoder and vice versaD-STAR vocoder extensionI propose the use of the "Flag 3" byte of the header, to mark the vocoder type in the voice frames, as follows (in accordance to section 2.1.1, page 4 of theD-STAR specification):BitMeaningFunction0000000xVocoder0: AMBE (backwards compatible)1: Codec 2000000x1Mode0: Codec 2 3200 (160 samples/20 ms into 64 bits)1: Codec 2 2400 (160 samples/20 ms into 48 bits) plus FEC (22 bits)00000100to11111111UndefinedUse for future expansionThe total space available in the frame for voice data is 72 bits. With Codec 2 3200, there is not much space left for FEC, so this option should only be used for communications over the Internet. On the other hand, using Codec 2 2400, allows us to protect the first 24 bits of the voice data with two applications of the (23, 12) Golay code.Note: An early version of the extension used one more bit to control the presence of FEC. It was later decided to always include FEC when there is available space in the frame.The vocoder extension is compatible with all current D-STAR hardware (repeaters, hotspots, etc.) and software (repeater controllers, reflectors, etc.), except - of course - transceivers that assume voice data to be in AMBE format and use the corresponding chip for processing.D-STAR reflectors, likexlxd, can be used to transcode and bridge the two formats. Although implementations of the vocoder extension can use the same reflector connections as AMBE-only clients, it should be avoided, to save the user confusion and establish interoperability.The solution implemented in thevocoder-extensionbranch of myxlxd forkuses another DExtra listener on a different port (30201 instead of 30001). The new port is to be used by reflectors using the "ORF" prefix (Open ReFlector). Any client connected to an ORF reflector will receive streams encoded with Codec 2. All other D-STAR protocol handlers will still send out data encoded with AMBE. Note that the protocol/port only affects data transmitted by the reflector. The stream vocoder is recognized by all protocol handlers, so a client can still transmit data using any vocoder on any port. The rationale behind this is that DExtra links may be used by repeaters or other reflectors, so it is not really possible to know what their clients support. So, nothing will change when linking a repeater to an XRF reflector, but will do when linking to an ORF one.The open source vocoder, allows homebrewing transceivers using aRasbperry Pi, anMMDVM modem(evenone constructed with through-hole components), and an old radio. Thus, one could use a D-STAR hotspot as a transceiver, assuming a method to attach a microphone and speaker. It also allows using software clients to communicate through reflectors without the need of any AMBE hardware.All included utilities implement the vocoder extension. Use the-p dextraopenflag, or substitude the reflector's callsign prefix with "ORF", to makedv-playeranddv-recorderuse the "open" DExtra port.BuildingTo build, you must first build and installmbelibandcodec2.On Mac OS X, I usedMacPortsto installcmake,speexDSP, andlibsamplerate.mbelibcompiles and installs to/usr/localwithout problems. To buildcodec2, I had toexport LIBRARY_PATH=$LIBRARY_PATH:/opt/local/libbefore runningmake, and edit the following files to remove unsupportedgccflags (from thebuildfolder):unittest/CMakeFiles/ofdm_stack.dir/flags.make, to remove-fstack-usageunittest/CMakeFiles/ofdm_stack.dir/link.txt, to remove-Wl,-Map=ofdm_stack.mapBased onircDDBGatewayandxlxd. Tested with myxlxd fork.73 de SV9OAN