2016-12-28

Tcl bindings for OpenAL (open audio library): tclopenal

Source code:
tclopenal


用途:
只是簡單的包裝 OpenAL 的 API,然後配合 tclmpg123 或者是 tclsndfile 來播放音樂檔案。因為 OpenAL 選項很多,所以我做了一些簡化假設(所以這是一個簡化的版本)。

然後 capture 的部份我遇到很麻煩的問題,因為 Windows 7 (64bit), Ubuntu 14.04 (VM) 無法找到可以使用的 capture device,openSUSE 可以找到但是開啟失敗。所以目前只有 playback 功能的部份。


更新:
Windows 7 要插入麥克風才會出現 device。

更新:
我大概知道為什麼會開啟 capture device 失敗了。

更新:
推送上去開啟 capture device OK 的 code。
但是只有執行測試沒問題,沒有實際錄音。

2016/12/29 更新:
目前的實作使用 1 source 1 buffer,如果播放比較大的音樂檔案會遇到問題才對。
目前不知道怎麼解決,所以我先 tag 一個 v0.1 的版本,然後研究以後再看能不能改善。

更新:
嘗試加入超過 1 個 buffer 的支援。

2016/12/30 更新:
加入更多關於使用超過 1 個 buffer 的支援。
tag 一個 v0.2 的版本。

2016-12-21

Tcl bindings for PulseAudio simple API: tpulsesimple v0.1

Source code


tpulsesimple


About

PulseAudio is a network-capable sound server program distributed by freedesktop.org.

The simple API is designed for applications with very basic sound playback or capture needs. It can only support a single stream per connection and has no handling of complex features like events, channel mappings and volume control.

This extension is Tcl bindings for PulseAudio simple API.


說明


用來測試 PulseAudio simple API。write 的部份使用播放 mp3 檔案的方式來測試,read 的部份只有做執行測試(沒有實際 record)。

2016-12-15

rl_json extension

rl_json - Extends Tcl with a json value type and a command to manipulate json values directly. Similar in spirit to how the dict command manipulates dictionary values, and comparable in speed


之前在 Tcler's wiki 發現的套件,他展示了一個我現在還不會的 Tcl extension 技巧,就是將 JSON 視為 value type (defines a new Tcl_Obj type to store the parsed JSON document)。

因為這個想法實在是太厲害了,我記錄一下這個套件。

2016-12-14

Tcltaglib v0.9

網站:

Tcltaglib


ChangeLog:
  • Upgrade TEA to 3.10

在試著使用 MSYS2/MinGW-W64 來編譯的時候,我發現會編譯失敗,不過升級 TEA 版本到 3.10 以後就可以解決。

所以我把 TEA 升版到 3.10。然後將 README.md 的說明寫的更清楚一些,所以重新出發,github 上的被我刪除重建了。然後將文件的更新也放到 Tcltaglib 的網頁上。

更新:
嗯…… 有東西沒更新到,所以我又重建了一次(囧),然後重新上傳檔案。

更新 x2:
狀態不太好,還是有東西沒更新到,重新更新一次。

2016-12-13

Tclmpg123

Source code:
tclmpg123


因為 MP3 的專利的關係,所以 libsndfile 的作者沒有寫關於 mp3 格式的部份(因為他開了一家公司來處理 libsndfile 的維護,所以如果 MPEG 組織找上門來索取專利費的話會帶來問題),如果要讀取 mp3,就要使用其它的 library。

所以 tclmpg123 就是用來透過 libmpg123 處理讀取 mp3 檔案的工作,然後再把讀出來的音訊訊號丟給 tcllibao 輸出。

2016-12-10

Tcllibao and Tclsndfile

Tcllibao:
source code

Tclsndfile:
source code


Tcl/Tk 已經有二個 audio extension 可以使用,一個是 Snack,一個是 SDL_mixer bindings for Tcl

Snack 其實原作者看起來已經沒有什麼更新,不過 Tcl/Tk 社群仍然有人持續在維護,是一個很普遍的套件。


我寫 tcllibao 和 tclsndfile 只是為了探索 Linux audio library 的使用方式。libsndfile 是讀取檔案以後拿到音訊資料,而 libao 用來將聲音輸出(還有其它的 library 可以用,例如 SDL_mixer)。

要注意的是,libao 使用 GPL 授權,所以我 tcllibao 使用同樣的授權方式。同樣的,libsndfile 使用 LGPL 授權,tclsndfile 我也使用同樣的授權方式。

下面就是我的測試程式:
#!/usr/bin/tclsh
#
# Using libao and libsndfile to play a wav/ogg file
#

package require libao
package require sndfile

if {$argc > 0} {
    set name [lindex $argv 0]
} else {
    puts "Please input filename."
    exit
}

if {[catch {set data [sndfile snd0 $name READ]}]} {
    puts "sndfile: read file failed."
    exit
}
set encoding [dict get $data encoding]

# only for test seek
snd0 seek 0 SET

libao::ao initialize
set id [libao::ao default_id]

set bits 16
switch $encoding {
 {pcm_16} {
    set bits 16
 }
 {pcm_24} {
    set bits 24
 }
 {pcm_32} {
    set bits 32
 }
 {pcm_s8} {
    set bits 8
 }
 {pcm_u8} {
    set bits 8
 }
 default {
    set bits 16
 }
}

libao::ao open_live $id -bits $bits \
  -rate [dict get $data samplerate] \
  -channels [dict get $data channels] -byteformat 4

# libao needs use read_short to get data
while {[catch {set buffer [snd0 read_short]}] == 0} {
    libao::ao play $buffer
}

snd0 close
libao::ao close
libao::ao shutdown



更新: 我發現 tclsndfile README.md 我有打錯說明,所以刪掉重新建了一個新的上去 github。


2016/12/12
嘗試在 Windows 7 (64bit) 使用 MSYS2/MinGW-W64 編譯與使用測試,我把遇到的問題跟解法記錄在 github README.md。

2016-12-08

tclcubrid v0.9.4

Source code

tclcubrid

About


CUBRID is an open source SQL-based relational database management system with object extensions developed by Naver Corporation for web applications.

tclcubrid is a Tcl extension by using CUBRID CCI (CCI Client Interface) driver to connect CUBRID. I write this extension to research CUBRID and CCI (CCI Client Interface) driver.

Main changelog

  1. Add Date/Time types with timezone support

這個版本增加 Date/Time types with timezone 的支援。

2016-12-05

Tclunqlite v0.3.2

檔案放置網頁


Tclunqlite

About

This is the UnQLite extension for Tcl using the Tcl Extension Architecture (TEA).

UnQLite is a in-process software library which implements a self-contained, serverless, zero-configuration, transactional NoSQL (Key/Value store and Document-store) database engine. This extension provides an easy to use interface for accessing UnQLite database files from Tcl.

Main Change

  1. Update UnQLite version to 1.1.7

說明


這是一個小更新版本,更新 UnQLite 的版本。