Alternative voice files for en_GB_2
Also, added abilty to read from separate ambe files in a dir as well as the G4KLX style indexed files
This commit is contained in:
parent
22068bfbb1
commit
6ba08711e2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
υ‰Ε'RΙΞχ£uwL¥Ή<C2A5>ΡεzCp_”<>¦ΔsqKθυ2XΨ<58>^4h‘®µΛ€@<0F><>σ"Z§}r <09>T—c¶[―@¦©ΧήτΑ=Έψ±½¥¦]φJX+δ<>†ez<65><7A>&'Ρ=η9 ζΆkΰΗ^^Δρ-βεzNΔδ^χΗ_R<5F>Δ4UΘYϊBΫA&ωk^ΒτbΖΟQ‹)_>θΞo>"B!ƒ}/Η[B K(c—,z#s(Fΐϋ79§E>5G<35>Ο,Λe;)ΞqΣ;οbXαω_oβ"`eLEiΗ<69>Ρ`6]eOΗ<4F>ΰC?Xχ<58>„@&ODG8†Wh{0ο<05><¦3L<33>c<EFBFBD>]/§Ζc(Έ4Α<34>M|σD<0F><08>E§Δ*°Cdz01ψ·IΗ!“'
|
|
@ -0,0 +1,3 @@
|
|||
ÃtÇ`d˜û³€ÓÑç%exñ†jÇPƒq¶Û¢!pŒØƒå:¢v6=S¾õ‹å'LÍ_–Ø %"ýþÅ€ï¦ac…Ø¥—¢<E28094>u
fÃÂX¥±‚W+pÒµI¤ £WHdñ£o{ëâ3+SOË£óŽ€`>#šYÍÂŽ€`˜/û&¿~‹Òör5<04> kœ÷Lyܨ!ütÁ=]Wï!·â…Ø8w\°ZȆãME3úÁ†Ánhf劈ү bXÜM˜{äDÃØ@€GŽ <09>e†÷(ØXJÏ#“…1jº• -9ý[R <09>',JÅCÇ×6l^/Y40Ú…d.²N|K*ö’©]櫧Eo÷"ñœ†cóoëTÙ@ç‚} !Qp¶±<C2B6>ˆ¤
|
||||
b½_˨#¤G‹…7 ûNƒ)o
|
||||
§æ›å6 Tèzõˆå!S`)Ø
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,4 @@
|
|||
Æ^£?#€¯oĉå!b4«)±´Ç'QQ1u<31>óõ a4ÔgÂÔ¢ch×1Àô a/ÂVD¨çä•g‘å=cÊÇæP𪂃ܿ<C39C>¦3µ*Sî袒…±q‹c±<63>¤GÖv‹rmXxÊÅfZV.xj<>€wZmRî\™Óå%涌@ËÕ,ó%‚=ˆ<>6lŒ4Èóö<C3B3>¯Ñ(¿Y€„H¯¦:¬{1€ÆI<C386>‡óA¢¬5½þ¶4#IÇ%Òêð"#44Íì<Ç—G
|
||||
hbÇqÇZ
|
||||
¡ƒL8n¡à ]Ñ[½üÐy*H
|
||||
ËOL`\Q¬»ÒZ/ƒoõš“L-Fpí êã¤L»¹
O¢Ñe.ÛTIÈ·“7<E2809C>VS(HùÀEÅP&©ÿã
|
|
@ -0,0 +1,2 @@
|
|||
ä™Å'RË+±†ç6#!urŒ¡•åRd$Vþ´ø¢+Ή…Äsê,"xõ,‡›"®EMŽÚÀߥÅó¢O¯#¹;¿Ü¢ù•ãQëG•š[r•9$îK<C3AE>.¶8$Øk…]ƒ:=EнE2fç9&çAÒxw(ã%¶_!
|
||||
mHŸ Çp<>¨s’Ri¦N™ØÚáPOزg_i³%á0Z‚ÞP@~íÌÁ{J:9íÂ(M<>Ï:êk<1C>ø<EFBFBD>#‘
B· \qÞ´&’¢ Ìú£·'’¶>Ý<>ò÷%m_:l@tžñ[HND<4E>½„†oÝPÉ]²ÔR)Ûu™>zód.<2E>DoŒrÅÂWçSaŸŒã
|
|
@ -0,0 +1 @@
|
|||
çºçqYù°ñÄos_”ïæ˜ÇEf%<1B>.²—çpbv@0É÷aÈv{×Mƒãæ¢`=–VsçŒæT«™#NÍ YíÓÊšl Ï¢,ðû-™Ï>qI"°ƒÍž;/bkä°ÜžzmFžÉª/¶ Ѧ¯Zt&`O+ŸE¦²Š<C2B2>·9™½£„u×(ˆÛH¶x›õu›S÷Yây·×\<5C>r½J¢Å[˜—“"thºU€c~ÔdaÔÓašnÒ<&ÀJ‘χòðI+h;düÛ³àX+iK@¸ž<C2B8>ÀKhOØ-0Þ°8*¥˜@(zÂkO€ ÑÕ·fO³'ÕýÕV qH¶r;œ«Ø†½¡C"HtC
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
lÝ…d5™yVòvåd`aøȷשåg`4\Ñå‚riÄGsÑç€&)µ"gíæƒs'^“þò†1NIïÑí©Åï–<C3AF>ÑqÊK7›µ³Ýs¹}õwµ$…|"¤Æ2œ9cXe±ðˆÏ
.)`†6TIÍNolT9…š<E280A6>”‡yj„ar}‹ØiÔ/%àJKnà{!¦d)=i!’7ð{JHB¬Pͳ jÀkѦeÑ-Ê}qÕ^i€oHŽI Kבn€"vcѶ·ƒ emG×…-êÀ‡$7‰mÎGùÓÄ;&¿mÙÁ…FSÉŽwxX²Ì?0é<^ƒì…±Ÿ‡Ä»åB1É:
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
À<EFBFBD>ƒKua<75>ãþõ¡SJçûÏÔ<C38F>Sr'M¡<4D>–Ù‚A3xŸŠÑ÷Cú}á
£ä*€7tMSœß䦟)´<>£hÍü†–÷Ù“›h¥„˜k±è=áQ²vWÏþgÝ9¾ÄëÈgû7ê^ÔÁèî€%ÉQ…GY.wf˜e¢(ÞÊ6éQA’wxngRêÑ£¦×åÊQgÁ<67>iNnÿcÆC0»^áoÇ} -O› .H´1ý—ùM)©´ª{²&,#y±pãk‘J¤ ‘–=klO‡[ô§„HeÇnaȮ§YhìŸ?3ái>£8 D¦ÿ³ å`¸u[h÷
|
||||
öG;Àãº
|
||||
–Mð³!ÈBé:d<1F>:»Ã†Ô”·{ÿOíÑh™(*¿ç—‡_̆k¢›£ÁWµµ#²‡3<E280A1>}6Z)ÄŠÇ'rMˆ
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
ΤΈε%0M‹;ΐυΆpaX΄G3‘‡ΗGfc™ΓΕΆD?†Rc<52>Τ‚4b]Ρ4c‚¤η2 3VCάµιΆ%2mΝνΧ¶¤Ξ<C2A4><CE9E><EFBFBD>»X5έβγβ1δλe®³lλΓ4οdκ9<CEBA>Z2…‘zBΏ*LΦ@ƒΞ›f<E280BA>£.®]ι4ϊU›µρp\z=HM-(™/Ψ)¦v<08>M
|
||||
Ο/<2F>‘<>3£mΉo¶'LΤZβ8Χ<38>°ή>{ήu<75>΅ά<>σ`Ε<>"Ωο“·–βΩ“:Υ. ‚“¤ΐkκ yF)γ<0C>{η£(T#Mμ§π>igGΰ<47>Κ*‚5KΛQfh#/½$΅w0„²οwΖ)5+pχμA<CEBC><41>?足LΰpC™“y‹ρ/¦Tf·BsΖΆ7g a3Ίη<CE8A>ε6@mΨ
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,6 @@
|
|||
•KæP°w¤ZäA‘#H‚ÂC@l#ÇIZƒÂCm°_{‚â åïdÄDfi ®7£` ³Ù݆¼¡lYÝt„q;²ó×wèÑ…'GØNÏc߇B'ÍüÉ•¡ÁB!ØFk3·‚¡B,säõMl%8‹X|Œak~v.K“åŠfv^ ³_!/,R@O‡%—b<E28094>>t@m
íŠÁg^q_ÈÛ/(#EÇ”g†ÿ(tF,Ô¬÷i–à؈Fû-
|
||||
ÂâÊ<C3A2><C38A>+|e0Ä”z;;¢@&žeíÓ#\Ôp¶9˜VzXÏ(Ð
|
||||
Ñv“>üw2´ÔåÐPÅACâ
|
||||
ˆP?¯¤#4(-DïöçSm3.UÔþ
µYjìÌ6À
|
||||
)&ѱ@æóôF´Jß–^J&Ôd<C394>ú¢†.h,<ÁHµÃ÷%h•8AÍJ¶†!ož"Ë]’÷AÊVàé
|
||||
.’}ÍÓrD¨?]·a4èmV
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,4 @@
|
|||
ÿǃVe9Àÿœ·Ä1‹ÖÌÖ<C38C>qRçÿ“„ç!d@A®yɨB}׉€6€|\šX‚‚q#ymý´ø 4
|
||||
ü‹Ã¼´§Q9—.(jÈѹzÝ<>+²?Ä•¬ÏÜ<@{Ññë®jM#6¦ÞO«¶
|
||||
3bßÁ/§f›EúöM”Ã1ï%<14>œº”þ%gØRœ¾ÁS#cÃö<C383>#A4‰`}Àpw<>M}éY¨ß&d!)]4-
|
||||
;NEȉ;½;„oâFP£CÀ˜ÌÐœû£Ô§¢oƒoES€‚³z‰,O7O¥JŽ(Æ)e˜ÙS^˜/ÖK¤E§>Y|k;öS~5}$§Žk²}-DÙ8Ëö±Ln#z¼G«<47>
G1Í9ê÷€nG0ÝË÷âkn¢fõ¡ÁµH.Îg
€ëGуƒNA&t½Å
|
Binary file not shown.
|
@ -568,8 +568,8 @@ def ident():
|
|||
_say.append(words[character])
|
||||
_say.append(words['silence'])
|
||||
_say.append(words['silence'])
|
||||
#test
|
||||
#_say.append(AMBEobj.readSingleFile('44xx.ambe'))
|
||||
test
|
||||
#_say.append(AMBEobj.readSingleFile('alpha.ambe'))
|
||||
_all_call = bytes_3(16777215)
|
||||
_source_id= bytes_3(5000)
|
||||
speech = pkt_gen(_source_id, _all_call, bytes_4(16777215), 1, _say)
|
||||
|
|
|
@ -2,6 +2,38 @@ voiceMap = {
|
|||
'en_GB': {
|
||||
'to': '2',
|
||||
},
|
||||
|
||||
'en_GB_2': {
|
||||
'A': 'alpha',
|
||||
'B': 'bravo',
|
||||
'C': 'charlie',
|
||||
'D': 'delta',
|
||||
'E': 'echo',
|
||||
'F': 'foxtrot',
|
||||
'G': 'golf',
|
||||
'H': 'hotel',
|
||||
'I': 'india',
|
||||
'J': 'juliet',
|
||||
'K': 'kilo',
|
||||
'L': 'lima',
|
||||
'M': 'mike',
|
||||
'N': 'november',
|
||||
'O': 'oscar',
|
||||
'P': 'papa',
|
||||
'Q': 'quebec',
|
||||
'R': 'romeo',
|
||||
#'S': 'sierra',
|
||||
'T': 'tango',
|
||||
'U': 'uniform',
|
||||
'V': 'victor',
|
||||
'W': 'whiskey',
|
||||
'X': 'x-ray',
|
||||
'Y': 'yankee',
|
||||
'Z': 'zulu',
|
||||
'to': 'silence',
|
||||
'notlinked': 'not-linked',
|
||||
'linkedto': 'linked-to'
|
||||
},
|
||||
|
||||
'en_US:': {
|
||||
'to': '2',
|
||||
|
|
131
read_ambe.py
131
read_ambe.py
|
@ -1,5 +1,7 @@
|
|||
from bitarray import bitarray
|
||||
from itertools import islice
|
||||
import os
|
||||
import glob
|
||||
|
||||
class readAMBE:
|
||||
|
||||
|
@ -17,51 +19,88 @@ class readAMBE:
|
|||
def readfiles(self):
|
||||
_AMBE_LENGTH = 9
|
||||
indexDict = {}
|
||||
try:
|
||||
with open(self.prefix+'.indx') as index:
|
||||
for line in index:
|
||||
(voice,start,length) = line.split()
|
||||
indexDict[voice] = [int(start) * _AMBE_LENGTH ,int(length) * _AMBE_LENGTH]
|
||||
index.close()
|
||||
except IOError:
|
||||
return False
|
||||
|
||||
ambeBytearray = {}
|
||||
_wordBitarray = bitarray(endian='big')
|
||||
_wordBADict = {}
|
||||
try:
|
||||
with open(self.prefix+'.ambe','rb') as ambe:
|
||||
for _voice in indexDict:
|
||||
ambe.seek(indexDict[_voice][0])
|
||||
_wordBitarray.frombytes(ambe.read(indexDict[_voice][1]))
|
||||
#108
|
||||
_wordBADict[_voice] = []
|
||||
pairs = 1
|
||||
_lastburst = ''
|
||||
for _burst in self._make_bursts(_wordBitarray):
|
||||
#Not sure if we need to pad or not? Seems to make little difference.
|
||||
if len(_burst) < 108:
|
||||
pad = (108 - len(_burst))
|
||||
for i in range(0,pad,1):
|
||||
_burst.append(False)
|
||||
if pairs == 2:
|
||||
_wordBADict[_voice].append([_lastburst,_burst])
|
||||
_lastburst = ''
|
||||
pairs = 1
|
||||
next
|
||||
else:
|
||||
pairs = pairs + 1
|
||||
_lastburst = _burst
|
||||
|
||||
_wordBitarray.clear()
|
||||
ambe.close()
|
||||
except IOError:
|
||||
return False
|
||||
_wordBADict['silence'] = ([
|
||||
[bitarray('101011000000101010100000010000000000001000000000000000000000010001000000010000000000100000000000100000000000'),
|
||||
bitarray('001010110000001010101000000100000000000010000000000000000000000100010000000100000000001000000000001000000000')]
|
||||
])
|
||||
return _wordBADict
|
||||
if os.path.isdir(self.prefix):
|
||||
ambeBytearray = {}
|
||||
_wordBitarray = bitarray(endian='big')
|
||||
_wordBADict = {}
|
||||
_glob = self.prefix + "/*.ambe"
|
||||
for ambe in glob.glob(_glob):
|
||||
basename = os.path.basename(ambe)
|
||||
_voice,ext = basename.split('.')
|
||||
inambe = open(ambe,'rb')
|
||||
_wordBitarray.frombytes(inambe.read())
|
||||
inambe.close()
|
||||
_wordBADict[_voice] = []
|
||||
pairs = 1
|
||||
_lastburst = ''
|
||||
for _burst in self._make_bursts(_wordBitarray):
|
||||
#Not sure if we need to pad or not? Seems to make little difference.
|
||||
if len(_burst) < 108:
|
||||
pad = (108 - len(_burst))
|
||||
for i in range(0,pad,1):
|
||||
_burst.append(False)
|
||||
if pairs == 2:
|
||||
_wordBADict[_voice].append([_lastburst,_burst])
|
||||
_lastburst = ''
|
||||
pairs = 1
|
||||
next
|
||||
else:
|
||||
pairs = pairs + 1
|
||||
_lastburst = _burst
|
||||
|
||||
_wordBitarray.clear()
|
||||
_wordBADict['silence'] = ([
|
||||
[bitarray('101011000000101010100000010000000000001000000000000000000000010001000000010000000000100000000000100000000000'),
|
||||
bitarray('001010110000001010101000000100000000000010000000000000000000000100010000000100000000001000000000001000000000')]
|
||||
])
|
||||
return _wordBADict
|
||||
else:
|
||||
try:
|
||||
with open(self.prefix+'.indx') as index:
|
||||
for line in index:
|
||||
(voice,start,length) = line.split()
|
||||
indexDict[voice] = [int(start) * _AMBE_LENGTH ,int(length) * _AMBE_LENGTH]
|
||||
index.close()
|
||||
except IOError:
|
||||
return False
|
||||
|
||||
ambeBytearray = {}
|
||||
_wordBitarray = bitarray(endian='big')
|
||||
_wordBADict = {}
|
||||
try:
|
||||
with open(self.prefix+'.ambe','rb') as ambe:
|
||||
for _voice in indexDict:
|
||||
ambe.seek(indexDict[_voice][0])
|
||||
_wordBitarray.frombytes(ambe.read(indexDict[_voice][1]))
|
||||
#108
|
||||
_wordBADict[_voice] = []
|
||||
pairs = 1
|
||||
_lastburst = ''
|
||||
for _burst in self._make_bursts(_wordBitarray):
|
||||
#Not sure if we need to pad or not? Seems to make little difference.
|
||||
if len(_burst) < 108:
|
||||
pad = (108 - len(_burst))
|
||||
for i in range(0,pad,1):
|
||||
_burst.append(False)
|
||||
if pairs == 2:
|
||||
_wordBADict[_voice].append([_lastburst,_burst])
|
||||
_lastburst = ''
|
||||
pairs = 1
|
||||
next
|
||||
else:
|
||||
pairs = pairs + 1
|
||||
_lastburst = _burst
|
||||
|
||||
_wordBitarray.clear()
|
||||
ambe.close()
|
||||
except IOError:
|
||||
return False
|
||||
_wordBADict['silence'] = ([
|
||||
[bitarray('101011000000101010100000010000000000001000000000000000000000010001000000010000000000100000000000100000000000'),
|
||||
bitarray('001010110000001010101000000100000000000010000000000000000000000100010000000100000000001000000000001000000000')]
|
||||
])
|
||||
return _wordBADict
|
||||
|
||||
#Read a single ambe file from the audio directory
|
||||
def readSingleFile(self,filename):
|
||||
|
@ -100,7 +139,9 @@ class readAMBE:
|
|||
|
||||
if __name__ == '__main__':
|
||||
|
||||
test = readAMBE('en_GB','./Audio/')
|
||||
#test = readAMBE('en_GB','./Audio/')
|
||||
|
||||
#print(test.readfiles())
|
||||
test = readAMBE('en_GB_2','./Audio/')
|
||||
print(test.readfiles())
|
||||
print(test.readSingleFile('44xx.ambe'))
|
||||
|
|
Loading…
Reference in New Issue