# Path: altbrain.py
# AUDIO_HAMMERTIME = 9
# FRAME_SIZE = (160,120) # Neural network image size, 1/4 of full frame size.
#                     NAP = utils.trim_right(new_sentence[norm_segments[segment_id]:norm_segments[segment_id+1]])
#                         NAP = _extract_NAP(segstart, segend, soundfile)
#                     NAP = utils.trim_right(new_sentence[norm_segments[segment_id]:norm_segments[segment_id+1]])
#                         NAP = _extract_NAP(segstart, segend, soundfile)
#                     NAP = _extract_NAP(segstart, segend, audio_segment.wav_file)
# class AudioMemory:
#     def __init__(self):
#     def _digitize(self, NAP):
#     def _insert(self, D, key, value):
#     def find(self, NAP):
#     def learn(self, NAP, wav_file, segment_idxs):
#     def all_segments(self):
#     def forget(self, audio_segment):
#     def _cleanse_keys(self):
# def new_respond(control_host, learn_host, debug=False):
# def new_learn_audio(host, debug=False):
# def new_dream(audio_memory):


from altbrain import AudioSegment, AudioMemory
import utils
#    [self.] is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with [self.].  If not, see <http://www.gnu.org/licenses/>.

''' [self.]

@author: Axel Tidemann, Øyvind Brandtsegg
@contact: axel.tidemann@gmail.com, obrandts@gmail.com
@license: GPL
'''

def transfer(NAPs, wavs, wav_audio_ids):

    audio_memory = AudioMemory()
    
    for audio_id, nappers in enumerate(NAPs):
        for i in range(len(nappers)):
            NAP = nappers[i]
            if len(NAP):
                clean_key, overlap_key = audio_memory._digitize(NAP)
                crude_hash = utils.d_hash(NAP, hash_size=8)
                fine_hash = utils.d_hash(NAP, hash_size=16)

                wav_file = wavs[audio_id][i]

                try:

# Path: altbrain.py
# AUDIO_HAMMERTIME = 9
# FRAME_SIZE = (160,120) # Neural network image size, 1/4 of full frame size.
#                     NAP = utils.trim_right(new_sentence[norm_segments[segment_id]:norm_segments[segment_id+1]])
#                         NAP = _extract_NAP(segstart, segend, soundfile)
#                     NAP = utils.trim_right(new_sentence[norm_segments[segment_id]:norm_segments[segment_id+1]])
#                         NAP = _extract_NAP(segstart, segend, soundfile)
#                     NAP = _extract_NAP(segstart, segend, audio_segment.wav_file)
# class AudioMemory:
#     def __init__(self):
#     def _digitize(self, NAP):
#     def _insert(self, D, key, value):
#     def find(self, NAP):
#     def learn(self, NAP, wav_file, segment_idxs):
#     def all_segments(self):
#     def forget(self, audio_segment):
#     def _cleanse_keys(self):
# def new_respond(control_host, learn_host, debug=False):
# def new_learn_audio(host, debug=False):
# def new_dream(audio_memory):


# Path: transfer.py
from altbrain import AudioSegment, AudioMemory
import utils

#    [self.] is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with [self.].  If not, see <http://www.gnu.org/licenses/>.

''' [self.]

@author: Axel Tidemann, Øyvind Brandtsegg
@contact: axel.tidemann@gmail.com, obrandts@gmail.com
@license: GPL
'''

def transfer(NAPs, wavs, wav_audio_ids):

    audio_memory = AudioMemory()
    
    for audio_id, nappers in enumerate(NAPs):
        for i in range(len(nappers)):
            NAP = nappers[i]
            if len(NAP):
                clean_key, overlap_key = audio_memory._digitize(NAP)
                crude_hash = utils.d_hash(NAP, hash_size=8)
                fine_hash = utils.d_hash(NAP, hash_size=16)

                wav_file = wavs[audio_id][i]

                try:

                    audio_segment = AudioSegment(audio_id, crude_hash, fine_hash, wav_file, wav_audio_ids[(wav_file, audio_id)])